Salam Academy
Regression and correlation · Subtopic 2 of 2

The Least Squares Regression Line

The regression line of yy on xx, y=a+bxy=a+bx, is the straight line that makes the squared vertical distances from the points as small as possible. Its gradient is b=SxySxxb=\dfrac{S_{xy}}{S_{xx}} and it always passes through (xˉ,yˉ)(\bar x,\bar y), so a=yˉ−bxˉa=\bar y-b\bar x.

Edexcel YMA01 WST01Edexcel YMA01 WST03Edexcel 9MA0 Paper 3Edexcel 9FM0 OptionAQA 7357 Paper 3≈ 35 minRevision 6 · updated 2026-10-27
Section 1 of 14

Learning objectives

  • Identify the explanatory and response variables.
  • Calculate bb and aa for the regression line of yy on xx.
  • Interpret aa and bb in context and make predictions.
  • Know when predictions are unreliable, and convert coded regression lines.
Pause and think

Draw a line through a scatter of points "by eye". How could you decide which of two lines fits better?

Section 2 of 14

Core idea

Start hereThe best straight line

Points on a scatter graph rarely lie on a line. Many lines could go "through the middle", but one is special: it makes the total of the squared vertical misses as small as possible. That's the least squares regression line.

The big idea

y=a+bxy=a+bx with b=SxySxxb=\frac{S_{xy}}{S_{xx}}, a=yˉ−bxˉa=\bar y-b\bar x. It passes through (xˉ,yˉ)(\bar x,\bar y). Interpolate safely; extrapolate with caution.

1. The line

Regression line y = 2.42 + 1.32x with residuals
246810121451015200xyy = 2.42 + 1.32x
Each dashed line is a residual: actual yy minus predicted yy. The line makes the total of their squares as small as it can be. It always passes through (xˉ,yˉ)=(7,11.6)(\bar x,\bar y)=(7,11.6).
b=SxySxxa=yˉ−bxˉb=\frac{S_{xy}}{S_{xx}}\qquad a=\bar y-b\bar x
where
bb
gradient: change in yy per unit of xx.
aa
intercept.
residual
observed − predicted.
Worked examplen=8n=8, ∑x=40\sum x=40, ∑y=160\sum y=160, Sxx=42S_{xx}=42, Sxy=63S_{xy}=63

Find the regression line of yy on xx.

Goal
aa, bb.
Strategy
Means, then formulas.
  1. xˉ=5, yˉ=20\bar x=5,\ \bar y=20
    Divide by 8.
  2. b=6342=1.5b=\tfrac{63}{42}=1.5
    Gradient.
  3. a=20−1.5(5)=12.5a=20-1.5(5)=12.5
    Through the means.
Answery=12.5+1.5xy=12.5+1.5x.
✓ CheckAt x=5x=5: 20=yˉ20=\bar y ✓.

2. Using it

Worked examplePredicting

Predict yy at x=6x=6 and x=30x=30 (data range 11–1010). Residual at (4,17)(4,17)?

Goal
Predictions; comment; residual.
Strategy
Substitute.
  1. x=6: 21.5x=6:\ 21.5
    Interpolation: reliable.
  2. x=30: 57.5x=30:\ 57.5
    Extrapolation: unreliable.
  3. 17−(12.5+6)=−1.517-(12.5+6)=-1.5
    Residual: point lies below the line.
Answer21.521.5 reliable; 57.557.5 unreliable; residual −1.5-1.5.
✓ CheckPredicted at x=4x=4: 12.5+1.5(4)=18.512.5+1.5(4)=18.5; 17<18.517<18.5 so negative ✓.
Common misconceptionWrong direction Use yy on xx to predict yy from xx; predicting xx from yy needs the other line.
Pause and think

Interpret b=1.5b=1.5.

Summary

  • b=Sxy/Sxxb=S_{xy}/S_{xx}; a=yˉ−bxˉa=\bar y-b\bar x.
  • Interpolate, don't extrapolate.
Key words
Residual
Observed − predicted.
Extrapolation
Predicting outside the data.
HistoryLegendre and Gauss. Adrien-Marie Legendre published the method of least squares in 1805 to fit comet orbits. Carl Friedrich Gauss claimed he had used it since 1795, sparking a priority dispute. The word "regression" came later, from Galton's studies of height.
Fun factRegression to the mean. Galton noticed that very tall parents tended to have children who were tall, but less extremely so. He called this "regression towards mediocrity", and the name "regression" stuck to the whole method.
Keep reading for free

Create a free account to read the rest of this lesson: key formulae, worked examples, explore the graph, common mistakes, exam tip, guided practice and more. Your answers are checked and your progress is saved.