Line of Best Fit

Definitionnoun phrase

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.

In Spanish
recta de mejor ajuste
Also called
trend line, best-fit line, regression line, least-squares line, line of fit
Grade level
6-8
Grade 8Algebra 1StatisticsCCSS 8.SP.A.2CCSS 8.SP.A.3SATACTGEDHiSETPSATAP

Line of Best Fit in a picture

Line of best fit on a scatter plotA scatter plot of test score against hours studied for 8 students with a rising line of best fit y-hat about 4.6x + 50.2. Dashed residuals show the vertical gaps from two points to the line.1234567895060708090hours studiedtest scoreresidualŷ ≈ 4.6x + 50.2about as many points above the line as below
The line misses most points, but the misses (the residuals) balance out. Its slope, about 4.6, says each extra hour of study goes with about 4.6 more points.

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

Equation of a line of best fit
ŷ = mx + b
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

Warm-up

A line of best fit for plant height (cm) against weeks is ŷ = 2.5x + 4. Predict the height at 6 weeks.

  1. Substitute x = 6: ŷ = 2.5(6) + 4.
  2. 2.5 × 6 = 15, and 15 + 4 = 19.

Answer: The predicted height is 19 cm.

Example 2: Find the least-squares line

Core

Find the least-squares line for the points (1, 2), (2, 3), (3, 5), (4, 6).

  1. Means: x = 2.5 and y = 4.
  2. Top sum: (−1.5)(−2) + (−0.5)(−1) = 3.5 and (0.5)(1) + (1.5)(2) = 3.5, so 7 in all.
  3. Bottom sum: 2.25 + 0.25 + 0.25 + 2.25 = 5, so m = 75 = 1.4.
  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

Test-style

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.

  1. Predicted score: ŷ = 3(9) + 50 = 77.
  2. Residual: y − ŷ = 81 − 77 = 4. The student scored 4 points above the line’s prediction.
  3. 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

✗ MistakeDrawing the line through the first and last data points.
✓ InsteadDraw the line through the middle of the whole cloud, balancing the points above and below it.

The end points can be unusual. A line of best fit summarizes all of the data, not two of them.

✗ MistakeUsing ŷ = 3x + 50 to predict the score for 40 hours of study: 170 points.
✓ InsteadOnly predict inside the range of the data (here about 1 to 10 hours).

Extrapolating far beyond the data assumes the trend keeps going forever, which real data rarely does. A test score cannot pass 100.

✗ MistakeResidual = ŷ − y.
✓ InsteadResidual = y − ŷ: actual minus predicted.

A positive residual means the point is above the line. Reversing the order flips every sign.

Not to be confused with

Line of Best Fitvs.Scatter plot

The scatter plot is the set of plotted points; the line of best fit is a line drawn on it to summarize the trend.

Line of Best Fitvs.Correlation

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.

Line of Best Fitvs.Linear equation

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

Question 1 of 3

The line of best fit for a car’s value (dollars) against age (years) is ŷ = −1800x + 24,000. What does −1800 mean?

Show answer and explanation

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.

Question 2 of 3

Using ŷ = 4x + 12, a point (5, 35) has what residual?

Show answer and explanation

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.

Question 3 of 3

Which is the best description of a good line of best fit?

Show answer and explanation

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.

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

  1. Common Core State Standards, Grade 8 Statistics and Probability (8.SP.A.2, 8.SP.A.3)
  2. OpenStax, Introductory Statistics 2e, 12.3 The Regression Equation
  3. 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

TermLine of Best Fittrend line on a scatter plot
DefinitionA straight line through the middle of a scatter plot that models the trend. Use ŷ = mx + b to predict y from x.
Study the full deck

Browse all terms in the Math Dictionary · More statistics terms · Random term