What is a line of best fit?
A line of best fit is a straight line drawn through a scatter plot that shows the overall trend of the data as closely as possible. It passes through the middle of the points, with about as many above it as below. Its equation, ŷ = mx + b, lets you predict one variable from the other.
Line of Best Fit in a picture
Formal definition and notation
For paired data (x1, y1), …, (xn, yn) with a linear pattern, a line of best fit is a line ŷ = mx + b that keeps the residuals yi − ŷi small. The least-squares regression line is the one that minimizes the sum of squared residuals; its slope is m = Σ (xi − x)(yi − y)Σ (xi − x)2, and it passes through (x, y).
| Symbol | Read it as | Meaning |
|---|---|---|
| ŷ | y hat | the predicted value of y from the line, not an actual data value |
| y − ŷ | y minus y hat | a residual: how far a real point is above (+) or below (−) the line |
| (x, y) | x bar, y bar | the point of means; the least-squares line always goes through it |
Key facts
- Eyeball method: lay a ruler along the trend so the points are balanced on both sides, then find the equation from two points on the line (not necessarily data points).
- A rising line means a positive association; a falling line means a negative association.
- Interpolation (predicting inside the data’s x-range) is fairly safe. Extrapolation far outside it can be badly wrong.
- An outlier can pull the line toward itself, especially at the far left or right of the plot.
- A line of best fit shows association, not cause: more hours studied goes with higher scores here, but the line alone does not prove why.
- If the points curve or scatter with no trend, a straight line is the wrong model.
Equation of a line of best fit
- m
- the slope: the predicted change in y for each 1-unit increase in x
- b
- the y-intercept: the predicted y when x = 0 (meaningful only if 0 is a sensible x)
- ŷ
- the predicted y-value
By hand, pick two points on your drawn line and use the slope formula. Calculators and the linear regression tool find the least-squares line exactly.
Line of Best Fit examples, step by step
Example 1: Make a prediction
A line of best fit for plant height (cm) against weeks is ŷ = 2.5x + 4. Predict the height at 6 weeks.
- Substitute x = 6: ŷ = 2.5(6) + 4.
- 2.5 × 6 = 15, and 15 + 4 = 19.
Answer: The predicted height is 19 cm.
Example 2: Find the least-squares line
Find the least-squares line for the points (1, 2), (2, 3), (3, 5), (4, 6).
- Means: x = 2.5 and y = 4.
- Top sum: (−1.5)(−2) + (−0.5)(−1) = 3.5 and (0.5)(1) + (1.5)(2) = 3.5, so 7 in all.
- Bottom sum: 2.25 + 0.25 + 0.25 + 2.25 = 5, so m = 75 = 1.4.
- The line passes through (2.5, 4): b = 4 − 1.4 × 2.5 = 0.5.
Answer: ŷ = 1.4x + 0.5
Example 3: Residual and meaning
For hours studied x and score y, the line of best fit is ŷ = 3x + 50. A student who studied 9 hours scored 81. Find the residual and interpret the slope.
- Predicted score: ŷ = 3(9) + 50 = 77.
- Residual: y − ŷ = 81 − 77 = 4. The student scored 4 points above the line’s prediction.
- Slope 3: each additional hour of study is associated with about 3 more points, on average.
Answer: The residual is 4 points; the slope means about 3 more points per extra hour studied.
Common mistakes
The end points can be unusual. A line of best fit summarizes all of the data, not two of them.
Extrapolating far beyond the data assumes the trend keeps going forever, which real data rarely does. A test score cannot pass 100.
A positive residual means the point is above the line. Reversing the order flips every sign.
Not to be confused with
The scatter plot is the set of plotted points; the line of best fit is a line drawn on it to summarize the trend.
Correlation measures how tightly the points cluster around a line, with a number r from −1 to 1. The line of best fit is the line itself, with a slope and intercept.
An exact linear equation is true for every point on it. A line of best fit is a model: real points sit above and below it, and ŷ is only a prediction.
Quick check: 3 questions
The line of best fit for a car’s value (dollars) against age (years) is ŷ = −1800x + 24,000. What does −1800 mean?
Answer: B. The slope is the predicted change in value for each additional year: about 1,800 dollars lost per year. The 24,000 dollars is the y-intercept, the predicted value of a new car.Show answer and explanation
Using ŷ = 4x + 12, a point (5, 35) has what residual?
Answer: B. Predicted ŷ = 4(5) + 12 = 32. Residual = 35 − 32 = 3: the point is 3 above the line. −3 subtracts in the wrong order, and 32 and 35 are the predicted and actual values.Show answer and explanation
Which is the best description of a good line of best fit?
Answer: C. A line of best fit follows the overall trend so that the points are balanced on both sides and the gaps are small. It may touch no points at all and need not pass through the origin.Show answer and explanation
Line of Best Fit: frequently asked questions
How do you find the line of best fit?
By eye: draw a straight line through the middle of the points with about as many above as below, pick two points on your line, and find the slope and y-intercept. Exactly: use the least-squares formulas or a calculator’s linear regression, which gives the line that makes the squared residuals as small as possible.
Does the line of best fit have to go through the origin?
No. It goes wherever the data trend goes, and its y-intercept is usually not 0. Only when the situation forces zero to give zero, like distance driven after zero hours, would you expect it to pass near the origin. The least-squares line always passes through the point of means, (x, y), instead.
What is the difference between a line of best fit and a regression line?
A line of best fit is any line drawn to match the trend, often by eye in middle school. The least-squares regression line is one specific line of best fit, the one that minimizes the sum of the squared residuals. Two students eyeballing a trend may draw slightly different lines; regression always gives the same one.
Practice and tools
Sources
- Common Core State Standards, Grade 8 Statistics and Probability (8.SP.A.2, 8.SP.A.3)
- OpenStax, Introductory Statistics 2e, 12.3 The Regression Equation
- OpenStax, Introductory Statistics 2e, 12.2 Scatter Plots
Updated November 2026·Reviewed by the Effortless Math team·Standards: CCSS 8.SP.A.2, CCSS 8.SP.A.3
Cite this entry
Effortless Math Team. “Line of Best Fit.” Effortless Math Dictionary. Updated November 2026. https://www.effortlessmath.com/math-dictionary/line-of-best-fit/
Flashcard
Browse all terms in the Math Dictionary · More statistics terms · Random term



