Practice Maths

Line of Best Fit

Key Ideas

Key Terms

line of best fit
(also called a trend line) is a straight line drawn through the middle of a scatter plot so that approximately equal numbers of points lie above and below the line.
y = mx + c
Where m is the gradient (slope) and c is the y-intercept.
Interpolation
Using the line to predict values within the range of the original data — generally more reliable.
Extrapolation
Using the line to predict values outside the range of the original data — less reliable, as the pattern may not continue.

Drawing a Line of Best Fit

The line should follow the overall direction of the data. Aim for roughly half the points above and half below. Outliers should not strongly influence the line’s position.

Hot Tip Extrapolation becomes increasingly unreliable the further you go beyond the data range. A line of best fit for a child’s height vs age between ages 5 and 10 would give nonsense predictions at age 50.

Worked Example

Question: A line of best fit for a scatter plot of hours studied (x) versus test score (y) has equation y = 2.5x + 10. The data was collected from students who studied between 2 and 12 hours.
(a) Predict the test score for a student who studies 8 hours.
(b) Predict the test score for a student who studies 20 hours.
(c) Which prediction is more reliable? Why?

(a) Step 1 — Substitute x = 8 into the equation.
y = 2.5(8) + 10 = 20 + 10 = 30
Predicted score: 30 marks.

(b) Step 1 — Substitute x = 20.
y = 2.5(20) + 10 = 50 + 10 = 60
Predicted score: 60 marks.

(c) Reliability:
Part (a) is interpolation (8 is within the data range of 2–12) → more reliable.
Part (b) is extrapolation (20 is well beyond the data range) → less reliable.

What is a Line of Best Fit?

When a scatter plot shows a linear trend, we can draw a line of best fit (also called a trend line) to model the relationship. This is a straight line that captures the overall direction of the data. It does not need to pass through any specific points — its job is to represent the trend of all the points together.

The line of best fit is used to make predictions: given a value of x, we can read off a predicted value of y from the line.

Drawing a Line of Best Fit by Eye

To draw a line of best fit by eye: (1) Look at the overall direction of the points. (2) Draw a straight line so that roughly half the points are above the line and half are below. (3) The line should pass through the "middle" of the data — imagine balancing the scatter plot on the line. (4) The line does not have to pass through the origin or any specific data point.

A useful technique is to find the mean of the x-values and the mean of the y-values, and make sure your line passes through or near the point (¯x, ¯y) — the "centre of gravity" of the data.

Interpolation vs Extrapolation

Interpolation means using the line of best fit to predict a y-value for an x-value that is within the range of your data. This is generally reliable because the line is supported by the actual data around that point.

Extrapolation means predicting beyond the range of your data — reading the line extended past the last data point. This is less reliable because we don't know if the trend continues in the same way. For example, if data was collected for students studying 1–5 hours, predicting the score for 10 hours of study by extrapolation could be quite inaccurate.

Finding the Equation of the Line of Best Fit

Once you have drawn your line, you can find its equation in the form y = mx + b.

To find the gradient (m): choose two points on the line (not necessarily data points — use points that are clearly on the line), and calculate rise ÷ run = (y2 − y1) ÷ (x2 − x1).

To find the y-intercept (b): read where the line crosses the y-axis, or substitute one point on the line into y = mx + b and solve.

Example: If the line passes through (2, 50) and (8, 80), then m = (80 − 50) ÷ (8 − 2) = 30/6 = 5. Using (2, 50): 50 = 5(2) + b, so b = 40. Equation: y = 5x + 40.

Using the Equation to Make Predictions

Once you have the equation, you can substitute any x-value to predict y without reading a graph. For example, with y = 5x + 40 (where x = study hours and y = exam score), a student who studies 4 hours is predicted to score y = 5(4) + 40 = 60.

Always interpret predictions in context — state what the numbers mean, with units.

Key tip: When finding the gradient of your line of best fit, pick two points that are far apart on the line — this reduces the effect of small drawing errors and gives a more accurate gradient. Never pick two actual data points to calculate the gradient; use points that lie on the line you drew.

Mastery Practice

  1. Use the given equation of the line of best fit to predict y for each x value. State whether each is interpolation or extrapolation given the stated data range. Fluency

    Line of best fit: y = 3x + 5   (data range: x = 1 to x = 10)

    1. Predict y when x = 4.
    2. Predict y when x = 9.
    3. Predict y when x = 15.
    4. Predict y when x = 0.
  2. Use each equation to make the stated predictions. Fluency

    1. Line: y = −4x + 50  (data range: x = 0 to x = 10). Predict y when x = 6.
    2. Line: y = −4x + 50  (data range: x = 0 to x = 10). Predict y when x = 14.
    3. Line: y = 1.5x + 20  (data range: x = 5 to x = 30). Predict y when x = 18.
    4. Line: y = 1.5x + 20  (data range: x = 5 to x = 30). Predict y when x = 50.
    5. Line: y = 0.8x + 12  (data range: x = 10 to x = 40). Predict y when x = 25.
    6. Line: y = 0.8x + 12  (data range: x = 10 to x = 40). Predict y when x = 3.
  3. Answer these questions about line of best fit characteristics. Fluency

    1. A line of best fit has equation y = 5x + 2. Is the correlation positive or negative? How do you know?
    2. A line of best fit has equation y = −3x + 100. What does the gradient −3 mean in context if x = study hours and y = hours of gaming per week?
    3. A line of best fit passes through (0, 8) and (4, 24). Find the gradient and write the equation of the line.
    4. True or false: A line of best fit must pass through at least one data point.
    5. A line of best fit has a y-intercept of 15. What does this value represent on the scatter plot?
  4. Read predictions from the described lines. Understanding

    1. A line of best fit for data about rainfall (x, mm) and grass height (y, cm) after 2 weeks has equation y = 0.4x + 3. The data was collected for rainfall values between 10 mm and 80 mm.
      1. Predict the grass height after 2 weeks if rainfall is 50 mm.
      2. Predict the grass height if rainfall is 120 mm. Is this prediction reliable? Why or why not?
      3. What does the gradient of 0.4 mean in context?
    2. The line of best fit for age of a used car (x, years) versus selling price (y, $) is y = −2500x + 28 000. Data was collected from cars aged 1 to 8 years.
      1. Predict the price of a 5-year-old car.
      2. According to the model, when would the car be worth $0? Is this realistic?
      3. What does the y-intercept of 28 000 represent?
  5. Evaluate line of best fit descriptions. Understanding

    1. Jake draws a line through all the leftmost points on a scatter plot. Priya draws a line so that 6 points are above and 5 are below, evenly spread along the line. Whose line is a better fit? Explain.
    2. A scatter plot shows a strong negative correlation. Which of the following equations is most likely to be the line of best fit? Explain your choice.
        A: y = 4x + 1      B: y = −6x + 80      C: y = 0.2x + 5
    3. Two students draw lines of best fit for the same scatter plot. Student A’s line has equation y = 2x + 7. Student B’s line has equation y = 2x + 14. The actual y-intercept of the data cluster is around y = 9. Which student’s line is closer to the data? Explain.
  6. Applied line of best fit problems. Problem Solving

    1. A marine biologist measures the water temperature (x, °C) and the dissolved oxygen level (y, mg/L) in a river. The line of best fit is y = −0.3x + 14. Data was collected between 10°C and 30°C.
      1. Predict the dissolved oxygen level at 22°C.
      2. At what temperature does the model predict zero dissolved oxygen? Comment on whether this is meaningful in context.
      3. A reading of 8.5 mg/L is recorded at 18°C. The line predicts 8.6 mg/L at 18°C. How close is the actual value to the prediction?
    2. A fitness trainer records the number of weeks of training (x) and the time (y, minutes) a client takes to run 5 km. The line of best fit is y = −1.2x + 36. Training data runs from week 1 to week 20.
      1. What was the client’s approximate starting time (at week 0)?
      2. Predict the time at week 15.
      3. At what week does the model predict a time of 0 minutes? Explain why this is an example of the limitations of extrapolation.
    3. Two scatter plots are drawn for the same set of data. Plot A has a line of best fit y = 3x + 2, and Plot B has y = 3x + 2 as well but with the axes scaled differently. A student uses Plot A to predict y = 17 when x = 5. Verify this using the equation, then explain why changing the scale of axes does not change the equation of the line but can affect visual impressions of the correlation’s strength.
  7. Finding the equation. A student identifies two points that lie on a hand-drawn line of best fit and uses them to determine the equation of the line.
    Problem Solving
    1. The line passes through (2, 14) and (8, 38). Find the gradient and the equation of the line of best fit in the form y = mx + c.
    2. The line passes through (0, 5) and (10, 25). Write the equation and use it to predict y when x = 7. Is this interpolation or extrapolation if the data range is x = 0 to x = 12?
    3. The line passes through (5, 60) and (20, 30). Find the equation. What does the negative gradient tell you about the relationship between x and y?
    4. The line passes through (3, 11.5) and (9, 20.5). A student predicts y = 26 when x = 13. Use the equation to check this prediction and state whether the student is correct.
  8. Comparing predictions. Two researchers each fit a different line of best fit to the same scatter plot. Evaluate and compare their approaches.
    Problem Solving
    1. Researcher A fits y = 4x + 3 and Researcher B fits y = 3.5x + 6 to the same data. At x = 10, how far apart are their predictions? Which is likely to be more accurate, and what additional information would help you decide?
    2. A scatter plot of daily temperature (x, °C) versus ice-cream sales (y, units) has data from 18°C to 38°C. Line A is y = 12x − 160, line B is y = 10x − 100. (i) Find each line’s prediction at 25°C and 35°C. (ii) Which line predicts zero ice-cream sales at a lower temperature? Show your working.
    3. The actual mean point of a dataset is (14, 55). Line A is y = 3x + 13 and Line B is y = 3x + 10. Which line passes closer to the mean point? What does passing close to the mean point suggest about the quality of a line of best fit?
  9. Limitations in context. Analyse the limitations of using a line of best fit in each scenario.
    Problem Solving
    1. A school counsellor plots students’ absence rate (x, days per term) against their final exam score (y, %). The line of best fit is y = −4x + 92, fitted to data from students with 0 to 15 absences. (i) What score does the model predict for a student with 25 absences? (ii) Explain two reasons why this prediction is unreliable.
    2. A city records the relationship between average daily temperature (x, °C) and gas consumption (y, GJ) over 12 winter months. The line is y = −50x + 1200, fitted for x = 2 to x = 16. (i) Predict gas consumption when the temperature is 10°C. (ii) The model predicts gas use will be 0 GJ at a certain temperature — find this temperature and explain why the prediction is not meaningful.
    3. A researcher fits a line of best fit to data about weekly training hours (x) and 100 m sprint time (y, seconds) for elite athletes. The line is y = −0.05x + 11.8. (i) Predict the sprint time for an athlete training 20 hours per week. (ii) According to the model, when would the sprint time reach 0 seconds? (iii) Why is this model clearly limited for very large values of x?
  10. Full analysis. Use the line of best fit equation to complete a thorough analysis of a dataset.
    Problem Solving

    A geologist measures the depth of a soil sample (x, metres) and the temperature (y, °C) at that depth. Data was collected between depths of 5 m and 40 m. The line of best fit is y = 1.8x + 12.

    1. Interpret the gradient 1.8 in context.
    2. What does the y-intercept of 12 represent? Is it possible to collect data at x = 0 in this context?
    3. Predict the temperature at 25 m depth. Is this interpolation or extrapolation?
    4. Predict the temperature at 60 m depth. Explain why this prediction should be treated with caution.
    5. At what depth does the model predict a temperature of 90°C? Show all working. Would you trust this result? Explain.