Step by step
The question
Question: find the line of best fit for (20, 30), (22, 35), (24, 37), (26, 43), (28, 45).
The line of best fit is the straight line that comes closest to all the points.
1 Find the means
The mean of the x numbers: 120 divided by 5 is 24.
The mean of the y numbers: 190 divided by 5 is 38.
The line of best fit always goes through the mean point, (24, 38).
2 Make the table
A table with the points.
Each x minus the mean x, 24.
Each y minus the mean y, 38.
For the first point: 20 minus 24 is −4, and 30 minus 38 is −8.
The product: the two distances multiplied.
−4 times −8 is 32.
And the x distance squared.
−4 squared is 16.
We add the last two columns: 76 and 40.
3 Find the slope
A line is y = m x + b.
The slope m is how much y goes up when x goes up by 1.
The products show how y moves with x.
The squares show how x moves by itself.
So the slope is the total of the products, over the total of the squares.
Careful!
The bottom uses only the x distances, squared.
Not the y distances.
76/40 is 1.9.
4 Find b
b is where the line crosses the y axis.
The line goes through the mean point.
So the mean y is m times the mean x, plus b.
To get b alone, we take m times the mean x away from both sides.
1.9 times 24 is 45.6.
38 minus 45.6 is −7.6.
So the line of best fit is y = 1.9x − 7.6.
5 Draw the line
Now the points on a graph.
Each point is a dot.
The line goes through the mean point.
The line y = 1.9x − 7.6: it passes close to all the points.
6 Check
Let's check: the mean point must be on the line.
1.9 times 24 plus −7.6 is 38.
That is the mean y.
So it is right!
Let's look back.
First: find the means.
Then: make the table.
Then: find the slope.
Then: find b.
Then: draw the line.
Last: check.