Scribe logoScribeNotes & practice
Sign inStart free
  1. Notes
  2. ›IB Mathematics: Analysis and Approaches
  3. ›4 Statistics and probability
  4. ›4.10 Regression of x on y

IB Mathematics: Analysis and Approaches · Topic 4 · Statistics and probability

4.10 Regression of x on y

Find the regression line of x on y from data, interpret its coefficients, and use it to predict x for a given y.

  • 4 min read
  • 5 parts
  • 10 questions
  • Draft
Start a Quick 5 on this topic→Jump to the 10 questions
1/5The usual regression line predicts y from x
  1. 1The usual regression line predicts y from x
  2. 2The regression line of x on y minimises horizontal distances
  3. 3A worked calculation gives the equation of x on y
  4. 4The coefficients describe how x changes with y
  5. 5Predictions are reliable only inside the data range
  6. Check your recall
  7. Practice: 10 questions
1

Part 1 of 5: The usual regression line predicts y from x

A teacher records hours studied, xxx, and test score, yyy, for five students. On a scatter plot, the points rise together. The regression line of y on x is the line y=ax+by=ax+by=ax+b. It minimises the sum of squared vertical distances to the points.

This line answers one question: given xxx, predict yyy. It always passes through the mean point (xˉ,yˉ)(\bar x,\bar y)(xˉ,yˉ​), where xˉ\bar xxˉ and yˉ\bar yyˉ​ are the means of the data.

Now suppose the question is reversed. The teacher wants the hours needed to reach a target score. That asks for xxx from yyy, and it needs a different line.

Key term

regression line of y on x

The regression line of y on x is the line y=ax+by=ax+by=ax+b that minimises the sum of squared vertical distances from the data points.

Part 1 done

2

Part 2 of 5: The regression line of x on y minimises horizontal distances

To predict xxx from yyy, measure the distances horizontally instead. The regression line of x on y is x=cy+dx=cy+dx=cy+d, chosen to minimise the sum of squared horizontal distances. Its slope uses the covariance sxys_{xy}sxy​, which shows how xxx and yyy vary together.

The line is x−xˉ=sxysy2(y−yˉ)x-\bar x=\frac{s_{xy}}{s_y^2}(y-\bar y)x−xˉ=sy2​sxy​​(y−yˉ​), where sy2s_y^2sy2​ is the variance of yyy. So c=sxysy2c=\frac{s_{xy}}{s_y^2}c=sy2​sxy​​.

Only the denominator differs from the other line. Both slopes share the numerator sxys_{xy}sxy​, but they divide by the variances of different variables.

The two regression lines compared

Featurey on xx on y
Predictsyyy from xxxxxx from yyy
Equationy=ax+by=ax+by=ax+bx=cy+dx=cy+dx=cy+d
Distances minimisedverticalhorizontal
Slopesxysx2\frac{s_{xy}}{s_x^2}sx2​sxy​​sxysy2\frac{s_{xy}}{s_y^2}sy2​sxy​​
Passes through(xˉ,yˉ)(\bar x,\bar y)(xˉ,yˉ​)(xˉ,yˉ)(\bar x,\bar y)(xˉ,yˉ​)
Feature
Predicts
y on x
yyy from xxx
x on y
xxx from yyy
Feature
Equation
y on x
y=ax+by=ax+by=ax+b
x on y
x=cy+dx=cy+dx=cy+d
Feature
Distances minimised
y on x
vertical
x on y
horizontal
Feature
Slope
y on x
sxysx2\frac{s_{xy}}{s_x^2}sx2​sxy​​
x on y
sxysy2\frac{s_{xy}}{s_y^2}sy2​sxy​​
Feature
Passes through
y on x
(xˉ,yˉ)(\bar x,\bar y)(xˉ,yˉ​)
x on y
(xˉ,yˉ)(\bar x,\bar y)(xˉ,yˉ​)
Figure 1. Both lines pass through the mean point. The line of x on y is steeper on these axes.

Exam tip

With technology, enter the yyy data where the calculator expects xxx, and the xxx data where it expects yyy. Its output then gives x=cy+dx=cy+dx=cy+d.

Key terms · tap one for its definition

regression line of x on y

The regression line of x on y is the line x=cy+dx=cy+dx=cy+d that minimises the sum of squared horizontal distances from the data points.

covariance

The covariance sxys_{xy}sxy​ is 1n∑(x−xˉ)(y−yˉ)\frac{1}{n}\sum(x-\bar x)(y-\bar y)n1​∑(x−xˉ)(y−yˉ​), a measure of how xxx and yyy vary together.

Part 2 done

Quick check

One question on the part you just read

Easy

Identify the line to use to predict xxx from a given value of yyy.
Show answer and explanation

Answer: A · Worked explanation

The line of xxx on yyy is built to give the best predictions of xxx. Rearranging the line of yyy on xxx would instead be built to minimise vertical distances. It generally gives different predictions. Using the other line would give a different prediction, because it minimises distances in the other direction.
3

Part 3 of 5: A worked calculation gives the equation of x on y

Now apply the formula to the teacher's data. The method has three steps.

Working with deviations from the means keeps the numbers small. A table with columns for x−xˉx-\bar xx−xˉ, y−yˉy-\bar yy−yˉ​ and their products helps to avoid slips.

  • Find the means xˉ\bar xxˉ and yˉ\bar yyˉ​.
  • Find ∑(y−yˉ)2\sum(y-\bar y)^2∑(y−yˉ​)2 and ∑(x−xˉ)(y−yˉ)\sum(x-\bar x)(y-\bar y)∑(x−xˉ)(y−yˉ​).
  • Substitute into the formula, noting that the factor 1n\frac{1}{n}n1​ cancels in the slope.

Worked example

Regression line of x on y

Hours studied: x=1,2,3,4,5x=1,2,3,4,5x=1,2,3,4,5. Scores: y=50,48,66,60,76y=50,48,66,60,76y=50,48,66,60,76. Find the regression line of xxx on yyy.
  1. 1
    Means: xˉ=3\bar x=3xˉ=3 and yˉ=60\bar y=60yˉ​=60.
  2. 2
    Deviations of yyy from 60: −10,−12,6,0,16-10,-12,6,0,16−10,−12,6,0,16. So ∑(y−yˉ)2=100+144+36+0+256=536\sum(y-\bar y)^2=100+144+36+0+256=536∑(y−yˉ​)2=100+144+36+0+256=536.
  3. 3
    Products: (−2)(−10)+(−1)(−12)+0(6)+1(0)+2(16)=64(-2)(-10)+(-1)(-12)+0(6)+1(0)+2(16)=64(−2)(−10)+(−1)(−12)+0(6)+1(0)+2(16)=64.
  4. 4
    Slope: c=64536≈0.1194c=\frac{64}{536}\approx0.1194c=53664​≈0.1194.
  5. 5
    Line: x−3=64536(y−60)x-3=\frac{64}{536}(y-60)x−3=53664​(y−60).

Answer: x−3=0.119(y−60)x-3=0.119(y-60)x−3=0.119(y−60), which is x≈0.119y−4.16x\approx0.119y-4.16x≈0.119y−4.16

Check the result against the data. The line must pass through (xˉ,yˉ)=(3,60)(\bar x,\bar y)=(3,60)(xˉ,yˉ​)=(3,60). Substituting y=60y=60y=60 gives x=3x=3x=3, as required.

Technology gives the same line. Enter the data, then compare its coefficients with your hand calculation as a check.

Part 3 done

4

Part 4 of 5: The coefficients describe how x changes with y

Now look at what the numbers mean. The slope c≈0.119c\approx0.119c≈0.119 says that xxx rises by about 0.119 hours for each extra mark in yyy. Its sign matches the sign of the covariance.

The constant d≈−4.16d\approx-4.16d≈−4.16 is the value of xxx when y=0y=0y=0. Here it has no sensible meaning, since a time cannot be negative. Always check whether y=0y=0y=0 lies in a sensible range.

Units help with interpretation. Here ccc has units of hours per mark, and ddd is in hours.

Worked example

Predicting the hours needed

Use the line x−3=64536(y−60)x-3=\frac{64}{536}(y-60)x−3=53664​(y−60) to predict the hours of study for a score of 70.
  1. 1
    Substitute y=70y=70y=70: x−3=64536(10)x-3=\frac{64}{536}(10)x−3=53664​(10).
  2. 2
    Evaluate: x−3=1.194…x-3=1.194\ldotsx−3=1.194…
  3. 3
    So x=4.194…x=4.194\ldotsx=4.194…

Answer: About 4.19 hours of study

Common mistake

Do not rearrange the line of yyy on xxx to predict xxx. Here y=6.4x+40.8y=6.4x+40.8y=6.4x+40.8 gives x≈4.56x\approx4.56x≈4.56 for y=70y=70y=70, which differs from 4.19.

Part 4 done

Quick check

One question on the part you just read

Easy

Identify the point that both regression lines pass through.
Show answer and explanation

Answer: B · Worked explanation

Both regression lines pass through the point of means, (xˉ,yˉ)(\bar x,\bar y)(xˉ,yˉ​). The origin is not generally on either line. Medians are not used in least squares regression. This point is a useful check: substituting yˉ\bar yyˉ​ into the line of xxx on yyy must return xˉ\bar xxˉ.
5

Part 5 of 5: Predictions are reliable only inside the data range

A prediction is only as good as the data behind it. Predicting xxx for a yyy inside the range of the data is interpolation. Predicting outside that range is extrapolation.

Extrapolation is risky because the pattern may not continue. The data above has scores from 48 to 76. A prediction for y=70y=70y=70 is interpolation, but one for y=95y=95y=95 is extrapolation.

Scatter matters too. When points lie close to a line, predictions are more reliable. If the points lie exactly on a straight line, both regression lines are the same line.

Exam tip

State your prediction with units, and say whether it is interpolation or extrapolation.

Key terms · tap one for its definition

interpolation

Interpolation is predicting a value from a regression line for an input inside the range of the data.

extrapolation

Extrapolation is predicting a value from a regression line for an input outside the range of the data.

Note read

Check your recall[14 marks]

6 written questions. Answer each one in your head or on paper, then open the mark scheme.

  1. 1.Distinguish[3 marks]

    Distinguish between the regression line of y on x and the regression line of x on y.

    Show mark schemeHide mark scheme

    Model answer

    The line of yyy on xxx predicts yyy from xxx and minimises vertical distances. The line of xxx on yyy predicts xxx from yyy and minimises horizontal distances.

    • 1 mark for stating that y on x predicts y from x and x on y predicts x from y
    • 1 mark for stating that y on x minimises vertical distances
    • 1 mark for stating that x on y minimises horizontal distances
  2. 2.State[1 mark]

    State the point through which both regression lines pass.

    Show mark schemeHide mark scheme

    Model answer

    Both lines pass through the mean point (xˉ,yˉ)(\bar x,\bar y)(xˉ,yˉ​).

    • 1 mark for stating the mean point (xˉ,yˉ)(\bar x,\bar y)(xˉ,yˉ​)
  3. 3.Determine[3 marks]

    For some data, xˉ=12\bar x=12xˉ=12, yˉ=40\bar y=40yˉ​=40, sxy=30s_{xy}=30sxy​=30 and sy2=25s_y^2=25sy2​=25. Determine the equation of the regression line of xxx on yyy.

    Show mark schemeHide mark scheme

    Model answer

    The slope is 3025=1.2\frac{30}{25}=1.22530​=1.2. So x−12=1.2(y−40)x-12=1.2(y-40)x−12=1.2(y−40), which gives x=1.2y−36x=1.2y-36x=1.2y−36.

    • 1 mark for finding the slope sxysy2=1.2\frac{s_{xy}}{s_y^2}=1.2sy2​sxy​​=1.2
    • 1 mark for using the mean point (12,40)(12,40)(12,40)
    • 1 mark for obtaining x=1.2y−36x=1.2y-36x=1.2y−36
  4. 4.Calculate[2 marks]

    Use the line x=1.2y−36x=1.2y-36x=1.2y−36 to calculate the predicted value of xxx when y=45y=45y=45.

    Show mark schemeHide mark scheme

    Model answer

    x=1.2(45)−36=54−36=18x=1.2(45)-36=54-36=18x=1.2(45)−36=54−36=18.

    • 1 mark for substituting y=45y=45y=45
    • 1 mark for obtaining x=18x=18x=18
  5. 5.Describe[2 marks]

    Describe what the gradient 1.2 in the line x=1.2y−36x=1.2y-36x=1.2y−36 tells you about xxx and yyy.

    Show mark schemeHide mark scheme

    Model answer

    For each increase of 1 in yyy, the predicted value of xxx increases by 1.2. The relationship is positive.

    • 1 mark for stating that x increases by 1.2 for each unit increase in y
    • 1 mark for stating that the relationship is positive
  6. 6.Explain[3 marks]

    The data had yyy values between 20 and 60. Explain why a prediction of xxx for y=200y=200y=200 may be unreliable.

    Show mark schemeHide mark scheme

    Model answer

    A value of 200 lies outside the data range, so the prediction is extrapolation. The pattern may not continue that far. The result may even be impossible.

    • 1 mark for identifying the prediction as extrapolation
    • 1 mark for stating that the pattern may not continue outside the data range
    • 1 mark for stating that the result may be unrealistic

Practice this topic

10 quick-fire multiple-choice questions, easy to hard. Tap an answer to see if you're right and the worked explanation. (The written questions with mark schemes are under “Check your recall” above.)

0 right0 of 10 answered

Includes the 2 quick checks in the note above.

3.

Easy·State[1 mark]

A positive covariance between xxx and yyy means that, in general,
Show answer and explanation

Answer: D · Worked explanation

Positive covariance means that large values of xxx tend to occur with large values of yyy. Negative covariance gives the opposite pattern. Covariance says nothing about which variable is larger or where the line crosses an axis. Covariance is a signed quantity. Its sign shows the direction of the relationship, and the size of the data values affects its magnitude.
4.

Medium·Determine[2 marks]

xˉ=8\bar x=8xˉ=8, yˉ=20\bar y=20yˉ​=20, sxy=18s_{xy}=18sxy​=18 and sy2=9s_y^2=9sy2​=9. Determine the regression line of xxx on yyy.
Show answer and explanation

Answer: A · Worked explanation

The slope is 189=2\frac{18}{9}=2918​=2. Then x−8=2(y−20)x-8=2(y-20)x−8=2(y−20), so x=2y−32x=2y-32x=2y−32. The line x=2y−12x=2y-12x=2y−12 forgets to multiply 20 by the slope. The line x=0.5y−2x=0.5y-2x=0.5y−2 uses the slope upside down. Substituting the mean point gives a quick check: y=20y=20y=20 must return x=8x=8x=8, and 2(20)−32=82(20)-32=82(20)−32=8 confirms it.
5.

Medium·Calculate[2 marks]

A regression line of xxx on yyy is x=1.5y−10x=1.5y-10x=1.5y−10. Calculate the predicted xxx when y=24y=24y=24.
Show answer and explanation

Answer: B · Worked explanation

Substitute: x=1.5(24)−10=36−10=26x=1.5(24)-10=36-10=26x=1.5(24)−10=36−10=26. The value 36 leaves out the constant term. The value 6 comes from dividing 24 by 1.5 instead of multiplying. Always multiply by the slope first, then subtract the constant. Check that the answer is sensible for the context. Writing the substitution out line by line helps.
6.

Medium·Predict[2 marks]

Ice creams sold, xxx, and temperature in ∘C^{\circ}\mathrm{C}∘C, yyy, give the line x=12y−150x=12y-150x=12y−150. Identify the correct interpretation of the gradient 12.
Show answer and explanation

Answer: C · Worked explanation

In the line of xxx on yyy, the gradient is the change in xxx for a unit change in yyy. Here that is 12 more ice creams per degree. The reversed reading swaps the roles of xxx and yyy. Reading the gradient correctly means naming both variables and their units, as in ice creams per degree Celsius.
7.

Medium·Calculate[2 marks]

For data with xˉ=10\bar x=10xˉ=10 and yˉ=30\bar y=30yˉ​=30, ∑(y−yˉ)2=200\sum(y-\bar y)^2=200∑(y−yˉ​)2=200 and ∑(x−xˉ)(y−yˉ)=140\sum(x-\bar x)(y-\bar y)=140∑(x−xˉ)(y−yˉ​)=140. Calculate the predicted xxx when y=40y=40y=40.
Show answer and explanation

Answer: D · Worked explanation

The slope is 140200=0.7\frac{140}{200}=0.7200140​=0.7. Then x=10+0.7(40−30)=17x=10+0.7(40-30)=17x=10+0.7(40−30)=17. The value 28 is 0.7×400.7\times400.7×40, which ignores the mean point. The value 7 omits xˉ\bar xxˉ. The slope is a ratio of sums, so no division by nnn is needed. Check by confirming that the line returns x=10x=10x=10 at y=30y=30y=30.
8.

Hard·Predict[2 marks]

A line x=0.5y+3x=0.5y+3x=0.5y+3 was fitted to data with yyy between 20 and 60. It is used to predict xxx when y=100y=100y=100. Identify the correct judgement.
Show answer and explanation

Answer: A · Worked explanation

A value of 100 lies well outside the range 20 to 60, so this is extrapolation. The pattern may not continue there. Passing through the mean point shows the line fits the data, not that it holds outside the range.
9.

Hard·Determine[2 marks]

The line of yyy on xxx is y=2x+4y=2x+4y=2x+4 and the line of xxx on yyy is x=0.3y+1x=0.3y+1x=0.3y+1. Determine the mean point (xˉ,yˉ)(\bar x,\bar y)(xˉ,yˉ​).
Show answer and explanation

Answer: B · Worked explanation

Both lines pass through the mean point, so solve them together. Substituting y=2x+4y=2x+4y=2x+4 into the second gives x=0.3(2x+4)+1x=0.3(2x+4)+1x=0.3(2x+4)+1, so 0.4x=2.20.4x=2.20.4x=2.2 and x=5.5x=5.5x=5.5. Then y=15y=15y=15. The point (15,5.5)(15,5.5)(15,5.5) swaps the coordinates. If only one of the two lines is known, the mean point cannot be found. Two lines, one of each type, give two equations in two unknowns.
10.

Hard·Calculate[2 marks]

Data: x=1,2,3x=1,2,3x=1,2,3 and y=2,3,7y=2,3,7y=2,3,7. Calculate the predicted xxx when y=5y=5y=5 using the regression line of xxx on yyy.
Show answer and explanation

Answer: A · Worked explanation

Here xˉ=2\bar x=2xˉ=2, yˉ=4\bar y=4yˉ​=4, ∑(y−yˉ)2=14\sum(y-\bar y)^2=14∑(y−yˉ​)2=14 and ∑(x−xˉ)(y−yˉ)=5\sum(x-\bar x)(y-\bar y)=5∑(x−xˉ)(y−yˉ​)=5. So x=2+514(5−4)≈2.36x=2+\frac{5}{14}(5-4)\approx2.36x=2+145​(5−4)≈2.36. The value 2.40 comes from rearranging the line of yyy on xxx, which has slope 2.5. The matching line is built for exactly this prediction, so always check which variable is being predicted.

Keep going

Next topic4.11 Conditional probability and independencePrevious topic4.9 Normal distribution

More in Topic 4 · Statistics and probability

  1. 4.6Combined events and diagramsNotes · 10 questions
  2. 4.7Discrete random variablesNotes · 10 questions
  3. 4.8Binomial distributionNotes · 10 questions
  4. 4.9Normal distributionNotes · 10 questions
  5. 4.10Regression of x on yNotes · 10 questions
  6. 4.11Conditional probability and independenceNotes · 10 questions
  7. 4.12Standardizing normal variablesNotes · 10 questions
  8. 4.13Bayes' theoremNotes · 10 questions· HL only
  9. 4.14Continuous random variablesNotes · 10 questions· HL only

All IB Mathematics: Analysis and Approaches topics →

Draft: written by Scribe and checked automatically, not yet by a subject reviewer.

Practice questions are original, written by Scribe and checked automatically for correctness.

Topic codes follow the official numbering. Not endorsed by IB Diploma Programme or any exam board.

On this page

0/5 read

  1. 1The usual regression line predicts y from x
  2. 2The regression line of x on y minimises horizontal distances
  3. 3A worked calculation gives the equation of x on y
  4. 4The coefficients describe how x changes with y
  5. 5Predictions are reliable only inside the data range
  6. Check your recall
  7. Practice: 10 questions
All coursesScribeHow it worksPricingPrivacyTerms

Notes and questions are written by Scribe in our own words. Topic codes follow the official course numbering so you can find your place. Not produced or endorsed by the IB, College Board, AQA, OCR, Pearson Edexcel or any exam board.

© 2026 Scribe

Two regression lines

Test score, y (marks)012345630405060708090Hours studied, x (hours)
  • y on x
  • x on y
  • data
  • mean point