Line of Best Fit Formula

The line of best fit (trend line) is the straight line that best represents the overall trend in a scatter plot by minimizing the sum of squared vertical distances between the line and all data points.

The Formula

y^=mx+b

Ask yourself: Are you drawing or reading a straight trend line on a scatter plot to summarize the dots and estimate values?

Quick example

Plotting study hours vs test scores. The line of best fit might be: score=5(hours)+60 so each extra hour of study goes with about 5 more points.

Notation

y^=b0+b1x is the same line as the formula y^=mx+b, with b1=m and b0=b. b1 (slope) is the change in y per unit change in x. b0 (intercept) is the predicted y when x=0.

What this formula means

The line of best fit (trend line) is the straight line that best represents the overall trend in a scatter plot by minimizing the sum of squared vertical distances between the line and all data points. Its equation enables predictions for new x-values.

A line of best fit is like a straight road built through a scattered village: it cannot pass every house, so it takes the route that stays as close as it can to all of them at once. If the village curves around a lake, no straight road serves it well, and you need a curved model instead.

Formal view

The line of best fit minimizes ∑i=1n(yi−y^i)2=∑i=1n(yi−b0−b1xi)2, yielding y^=b0+b1x.

Worked examples

Example 1

medium
Mean point is (xˉ,yˉ)=(4,11) and slope is −2. Write the line of best fit.
Show solution

Answer

y^=−2x+19

First step

1.
Use y^=mx+b and the mean point.

See the full worked solution + why-it-works coaching

SetupKey insightWhy it worksCommon pitfallConnection

Free: full solutions on 3 topics a day. No card.

Every topic, every day: the Family plan

Example 2

medium
Trend line for study hours x vs. test score y^ is y^=8x+50. Interpret the slope in context.

Example 3

medium
A scatter plot of weight (lb) vs. age (yr) for puppies gives y^=5x+2. Predict the weight at age 6 years and explain whether you should trust the prediction.

Common mistakes

  • Forcing line through origin when inappropriate
  • Using when relationship isn't linear
  • Ignoring outliers' influence

Why this formula matters

A trend line turns a cloud of points into a rule you can use: "each extra hour of study goes with about 5 more points", or "this taxi charges a $3 base plus $2 per kilometre". Without it, predictions are guesses read off scattered dots. Used carelessly, it misleads: forced through the origin, stretched far past the data, or laid over a curve.

Frequently asked questions

What is the Line of Best Fit formula?

The line of best fit (trend line) is the straight line that best represents the overall trend in a scatter plot by minimizing the sum of squared vertical distances between the line and all data points. Its equation enables predictions for new x-values.

How do you use the Line of Best Fit formula?

Use a line of best fit when a scatter plot of paired numerical data shows a roughly straight trend and the question asks you to predict, estimate, or describe a rate of change. Read the slope as change in y per unit of x and keep predictions inside the observed x-range. If the dots curve, a straight line is the wrong model; if you only need the strength of the link, use the correlation coefficient; for the exact least-squares equation and its errors, use linear regression.

What do the symbols mean in the Line of Best Fit formula?

y^=b0+b1x is the same line as the formula y^=mx+b, with b1=m and b0=b. b1 (slope) is the change in y per unit change in x. b0 (intercept) is the predicted y when x=0.

Why is the Line of Best Fit formula important in Statistics?

A trend line turns a cloud of points into a rule you can use: "each extra hour of study goes with about 5 more points", or "this taxi charges a $3 base plus $2 per kilometre". Without it, predictions are guesses read off scattered dots. Used carelessly, it misleads: forced through the origin, stretched far past the data, or laid over a curve.

What do students get wrong about Line of Best Fit?

Students often know a procedure related to line of best fit but skip the recognition step: Are you drawing or reading a straight trend line on a scatter plot to summarize the dots and estimate values? That leads to a calculation or graph that looks reasonable but answers a different question.

What should I learn before the Line of Best Fit formula?

Before studying the Line of Best Fit formula, you should understand: stat scatter plot.