CalcHack Try it free

Line of best fit: make a table, run the regression, read a and b

An original SAT-style practice question on a line of best fit, worked step by step in Desmos — the same graphing calculator that's built into Bluebook — with the by-hand check alongside.

Practice question

A lemonade stand recorded the daily high temperature, in degrees Fahrenheit, and the number of cups of lemonade sold on five days.

High temperature (°F)Cups sold
6031
6543
7060
7577
8089

Using the linear regression model (line of best fit) for the data, how many cups of lemonade would the stand be predicted to sell on a day with a high temperature of 72°F?

⚡ Desmos is the fastest way here Desmos fits the line for you and shows the slope and intercept in the expression list — you only plug in one number.
Data analysisLinear regressionMedium⏱ ~60 sec

Step by step

1

Make a table and enter the data

Tap the + at the top of the expression list and choose table. Desmos labels the columns x₁ and y₁. Put the temperatures in the first column and the cups in the second. The points appear on the graph — zoom out or zoom-fit if they're off screen.

x₁: 60, 65, 70, 75, 80Temperature
y₁: 31, 43, 60, 77, 89Cups sold
2

Run the regression

On a new line, type the regression with a tilde (~), not an equals sign, and use the subscripts so Desmos knows to use the table columns.

y_{1}~ax_{1}+bFits the line and draws it
6065707580859020406080100 (72, 66) y = 3x − 150
What you see: a line running through the middle of the points, and under the regression line in the list, the values a = 3 and b = −150 (plus r² ≈ 0.9956, which says the fit is very tight).
3

Plug in the value the question gives

The line of best fit is y = 3x − 150. The question gives a temperature, which is x, so substitute 72 for x on a new line.

3(72)-150= 66 — done
What you see: the row shows = 66 on the right. That's the predicted number of cups.
Answer
66 cups

The line of best fit is y = 3x − 150, so at 72°F it predicts 3(72) − 150 = 216 − 150 = 66 cups. That sits sensibly between the 70°F day (60 cups) and the 75°F day (77 cups).

⚠ Common trap

Typing y~ax+b without the subscripts, or = instead of ~ — then Desmos doesn't fit anything to your table. Another one: answering with 3 or −150 straight from the panel. Those are the slope and intercept, not the prediction; the question wants the y-value at x = 72. And don't plug 72 in as y — temperature is the x column here.

The by-hand way, if you prefer

Least squares, with friendly numbers: the mean temperature is 70 and the mean number of cups is 300 ÷ 5 = 60. Take each point's distance from those means: the temperatures are −10, −5, 0, 5, 10 away and the cups are −29, −17, 0, 17, 29 away. The slope is the sum of the products divided by the sum of the squared temperature distances: (290 + 85 + 0 + 85 + 290) ÷ (100 + 25 + 0 + 25 + 100) = 750 ÷ 250 = 3. The line passes through the mean point (70, 60), so 60 = 3(70) + b, which gives b = −150.

That's a lot of arithmetic for one question, and most real data isn't this tidy, so Desmos is the realistic route. Once you have a and b from either method, the prediction is a single substitution.

More walkthroughs: exponential growth · systems of linear equations · vertex and maximum value · quadratic roots · circle equations · sum of a quadratic's solutions · solving for x by graphing · linear inequalities · absolute value equations · Desmos cheat sheet · all walkthroughs

Stuck on a different practice question?

Snap a photo of any SAT-style math practice question and CalcHack walks you through the fastest route, in Desmos or by hand. Five free scans every day, no account needed to start.

Try it on your own question