Line of Best Fit

Learn to draw a line of best fit by eye on a scatter plot, find its equation from two points and explain what its slope and intercept mean.

Intermediate25 minLesson

Definition

A line of best fit (also called a trend line) is a straight line drawn through a scatter plot that shows the overall trend of the data. It does not have to pass through any of the points.
A good line of best fit drawn by eye:
  • has about half of the points above it and half below it
  • follows the direction of the points (up, down, how steep)
  • has the points spread along its whole length, not all above at one end and all below at the other
Once the line is drawn, pick two points on the line (not data points), far apart and on grid crossings, and find its equation y=mx+by = mx + b:
m=y2−y1x2−x1,b=y1−mx1m = \frac{y_2 - y_1}{x_2 - x_1}, \qquad b = y_1 - m x_1
The mean point (xˉ,yˉ)(\bar{x}, \bar{y}) is a useful guide: the least-squares regression line always passes through it, so a good line by eye should pass through it or very close to it.

Try it now

Which description fits a good line of best fit drawn by eye?

Worked Examples

Mia counts her push-ups in one minute after each week of training. Week 1 to 8: 6,6,9,12,12,16,16,196, 6, 9, 12, 12, 16, 16, 19. Three students draw a line by eye: - Line A: y=2x+3y = 2x + 3 - Line B: y=2x+7y = 2x + 7 - Line C: y=0.5x+9y = 0.5x + 9 Which line is the best line of best fit?
1

Check line B

Line B gives 9,11,13,15,17,19,21,239, 11, 13, 15, 17, 19, 21, 23 for weeks 1 to 8. Every data point is lower. → All 8 points are below line B: it is too high
2

Check line C

Line C gives 9.5,10,10.5,11,11.5,12,12.5,139.5, 10, 10.5, 11, 11.5, 12, 12.5, 13. Weeks 1 to 3 are below it, weeks 4 to 8 above it. → Points below at the left end, above at the right end: line C is too flat
3

Check line A

Line A gives 5,7,9,11,13,15,17,195, 7, 9, 11, 13, 15, 17, 19. Above: weeks 1, 4, 6. Below: weeks 2, 5, 7. On the line: weeks 3, 8. → 3 above, 3 below, spread along the whole line
4

Decide

Only line A has the points balanced on both sides along its whole length and follows the upward trend. → Line A is the best fit

Common Mistakes

Drawing the line from the first data point to the last one

Why it's wrong: The first and last points can be unusual. A line through them often has most points on one side.

Correct: Ignore single points and look at the whole cloud: about half the points above, half below. The line may pass through no point at all.

Balancing the number of points but not following the trend

Why it's wrong: A line that is too flat can have 4 points above and 4 below, but all the low ones sit at the left end and the high ones at the right end.

Correct: Check both ends: near each end of the line there should be points above and below it.

Finding the slope from two data points instead of two points on the line

Why it's wrong: Data points are usually not on the line, so their slope is not the slope of your line.

Correct: Read two points that lie on your drawn line, far apart and on grid crossings, then use m=y2−y1x2−x1m = \frac{y_2 - y_1}{x_2 - x_1}.

Reading the slope as a value of y instead of a change

Why it's wrong: In y=2x+3y = 2x + 3 for weeks and push-ups, 22 is not "2 push-ups". It is the change per week.

Correct: Say the slope with both units: about 2 more push-ups per week of training.

Interactive Visual

Scatter Plot

Weeks of training and push-ups

024685101520WeekPush-ups in one minute

ŷ = 1.93x + 3.32

r = 0.982 · strong positive correlation

Tap a point to see its coordinates.

Function graph

-1123456789-1123456789101112131415161718192021220WeekPush-ups

Tap the grid to place a point. Tap a point again to remove it.Place at least 2 points to see the line through them.

Interactive Sandbox

Interactive Grapher

02468100510152025xy

Tap or hover over the graph to read off values.

Try these examples:

y = 2x + 3

m=2, b=3

Expression Calculator

Try these:

History

No calculations yet

Practice Problems

18 problems
Problem 1 of 18
Easy
Which description fits a good line of best fit drawn by eye?

Why It Matters

Real data never lies exactly on a line, but it often follows a clear trend:
  • Sport: a coach sees how fast an athlete improves per week of training
  • Shops: a café sees how many fewer hot drinks it sells on every warmer day
  • Science: a student finds how fast a plant grows per day from scattered measurements
  • Money: a buyer sees how much a used bike loses in value per year
A line of best fit turns a cloud of points into one simple rule y=mx+by = mx + b. The slope says how much yy changes per unit of xx, the intercept says where the trend starts. It is the first step before making predictions, studying residuals and measuring how well a line fits.

Real World Applications

Training for a Race

Coaches draw a trend line through an athlete's times to see how much faster they get each week.

Example:

A runner's 5 km times drop from about 30 minutes to about 22 minutes over a few weeks. The trend line shows the steady improvement even on bad days.

1Try It Yourself

The line of best fit for a runner's 5 km time yy (minutes) after xx weeks passes through (2,30)(2, 30) and (6,22)(6, 22).

What is the slope of the line, in minutes per week?

Step 1: Write the mathematical expression

Slope = change in y divided by change in x:

Lemonade Stand

Small sellers plot temperature against sales to plan how much to prepare.

Example:

On hot days a stand sells many more cups. A trend line through a summer of data shows about how many extra cups each degree brings.

2Try It Yourself

A lemonade stand's line of best fit for temperature xx (°C) and cups sold yy passes through (20,30)(20, 30) and (30,50)(30, 50).

What is the y-intercept bb of this line?

Step 1: Write the mathematical expression

Find the slope, then use b=y1−mx1b = y_1 - m x_1:

Plant Growth Experiment

In science class, students measure a plant every few days and use a trend line to describe its growth rate.

Example:

Measurements are never perfect, so the heights scatter a little. The line of best fit gives one growth rate in centimeters per day.

3Try It Yourself

A plant is measured on days 2,4,6,82, 4, 6, 8 with heights 3,6,8,113, 6, 8, 11 cm. The line of best fit has slope 1.31.3 and passes through the mean point.

What is the intercept bb of the line?

Step 1: Write the mathematical expression

Use the mean point in b=yˉ−mxˉb = \bar{y} - m\bar{x}:

Key Takeaways

  • 1A line of best fit is a straight line that shows the overall trend of the points on a scatter plot
  • 2Draw it by eye so that about half the points are above it and half below, along its whole length
  • 3The line follows the direction of the data and may pass through no data point at all
  • 4Find its equation from two points on the line: m=y2−y1x2−x1m = \frac{y_2 - y_1}{x_2 - x_1}, then b=y1−mx1b = y_1 - m x_1
  • 5The slope is the change in yy per unit of xx; the intercept is the predicted yy at x=0x = 0, which may have no real meaning
  • 6The least-squares line always passes through the mean point (xˉ,yˉ)(\bar{x}, \bar{y}), so a good line by eye passes close to it

Frequently Asked Questions

By eye, no. Two students can draw slightly different lines and both be good. Their slopes and intercepts will be close. Only the least-squares line, from the Linear Regression lesson, is one exact line.
By eye, no. Two students can draw slightly different lines and both be good. Their slopes and intercepts will be close. Only the least-squares line, from the Linear Regression lesson, is one exact line.
No. The line goes wherever the data points it. Only force it through (0,0)(0, 0) if the situation really starts at zero and the data agrees.
Points on the line count for neither side. Balance the points above against the points below.
When the scatter plot shows no trend, or when the points follow a clear curve. A straight line only makes sense for a linear pattern.

Glossary

Line of best fit
A straight line through a scatter plot that shows the overall trend of the data (also called a trend line)
Slope
The change in yy for each increase of 1 in xx; along the line, m=y2−y1x2−x1m = \frac{y_2 - y_1}{x_2 - x_1}
Intercept
The value of yy where the line crosses the y-axis, at x=0x = 0
Mean point
The point (xˉ,yˉ)(\bar{x}, \bar{y}) made of the mean of all x-values and the mean of all y-values (also called the point of means)
Regression line
The exact line of best fit found by the least-squares method; it always passes through the mean point

Formula Card

Slope from two points

m=y2−y1x2−x1m = \frac{y_2 - y_1}{x_2 - x_1}

Use two points on the drawn line, not data points

Intercept

b=y1−mx1b = y_1 - m x_1

Put one point of the line and the slope into $y = mx + b$

Line of best fit

y=mx+by = mx + b

The equation of the trend line

Mean point

yˉ=mxˉ+b\bar{y} = m\bar{x} + b

The least-squares line passes through $(\bar{x}, \bar{y})$

Today's challengeOne problem, three tries

More in This Topic