- A linear transformation changes every value in the same way: \(y = a + bx\). Unit conversions, pay rises and exam coding are all linear transformations.
- Adding a constant \(a\) shifts the centre (mean, median, quartiles) by \(a\) but leaves the spread (standard deviation, IQR, range, variance) unchanged.
- Multiplying by a constant \(b\) multiplies the centre by \(b\) and the standard deviation, IQR and range by \(|b|\). The variance is multiplied by \(b^2\).
- Cambridge “coded data” questions give you \(\Sigma(x-a)\) and \(\Sigma(x-a)^2\). Find the mean and standard deviation of the coded values, then add \(a\) back to the mean only.
- The shape of the distribution does not change when \(b > 0\), and neither do z-scores. That is why converting units never changes how unusual a value is.
The problem: the same week, two different numbers
A school weather club records the midday temperature for 15 days, in degrees Celsius. A partner school in the United States wants the summary in degrees Fahrenheit. The club secretary has the mean (19.7 °C) and the standard deviation (3.27 °C). Does she have to convert all 15 readings and start again?
No. Converting Celsius to Fahrenheit uses the rule \(F = 1.8C + 32\). Every reading is multiplied by 1.8 and then has 32 added. Because every value is treated in exactly the same way, the summary statistics change in a predictable way too. Once you know the rules, you can convert a whole summary in a few seconds.
The same idea appears when a teacher adds 5 marks to every script, a firm gives a 3% pay rise, or an exam question “codes” data by subtracting 150 from every mass. This guide gives the rules, shows why they work and works through three examples, including a Cambridge-style coded data question.
What is a linear transformation?
A graph of \(y\) against \(x\) is a straight line, hence “linear”. Common examples:
| Situation | Rule | \(a\) (shift) | \(b\) (scale) |
|---|---|---|---|
| Celsius to Fahrenheit | \(F = 32 + 1.8C\) | 32 | 1.8 |
| Fahrenheit to Celsius | \(C = \tfrac{5}{9}(F – 32)\) | \(-\tfrac{160}{9}\) | \(\tfrac{5}{9}\) |
| Centimetres to inches | \(y = x \div 2.54\) | 0 | \(\tfrac{1}{2.54}\) |
| Add 5 marks to every test | \(y = x + 5\) | 5 | 1 |
| A 4% pay rise | \(y = 1.04x\) | 0 | 1.04 |
| Cambridge coding | \(y = x – 150\) | \(-150\) | 1 |
Logs, squares and rounding are not linear, so the rules below do not apply to them.
The rules for centre and spread
Suppose the original data have mean \(\bar{x}\), median \(M_x\), standard deviation \(s_x\), interquartile range \(\text{IQR}_x\) and variance \(s_x^2\). After the transformation \(y = a + bx\):
In words: measures of centre and position follow the full rule (multiply, then add). Measures of spread ignore the added constant and are multiplied by the size of \(b\). The variance is a squared quantity, so it is multiplied by \(b^2\).
Why adding a constant does not change the spread
Imagine five friends standing in a line, a few metres apart. They all take one step forward. The whole group has moved, so the position of its middle has moved. But the gaps between the friends are exactly the same. Spread is about gaps, and adding a constant does not change any gap.
In symbols, each deviation becomes \((x_i + a) – (\bar{x} + a) = x_i – \bar{x}\). Nothing changes, so neither does the standard deviation.
Why multiplying changes everything
Now the friends stand twice as far apart. Every gap doubles, so the range, IQR and standard deviation double, and the mean doubles too. Each squared deviation becomes four times as big, which is why the variance is multiplied by \(b^2\), not \(b\).
What about a negative multiplier?
If \(b\) is negative, the data are flipped. Record “marks lost” on a test out of 50, \(y = 50 – x\), so \(b = -1\). The mean is \(50 – \bar{x}\) and the SD is \(|-1| \times s_x = s_x\), because spread is never negative. The quartiles swap: \(Q_{1,y} = 50 – Q_{3,x}\). Left skew becomes right skew.
What does not change at all
When \(b > 0\), the shape of the distribution is unchanged. A histogram of Fahrenheit temperatures looks exactly like a histogram of Celsius temperatures, with new numbers on the axis. Skewness, the number of peaks and the presence of outliers all stay the same. The z-score of each value is also unchanged:
A hot day is equally unusual in Celsius or Fahrenheit. For a refresher, see our guide to z-scores and the normal distribution.
| Statistic | Add \(a\) | Multiply by \(b\) | Both: \(y = a + bx\) |
|---|---|---|---|
| Mean, median, mode | \(+a\) | \(\times b\) | \(a + b(\ldots)\) |
| Quartiles, percentiles, min, max | \(+a\) | \(\times b\) | \(a + b(\ldots)\) |
| Standard deviation, IQR, range | no change | \(\times |b|\) | \(\times |b|\) |
| Variance | no change | \(\times b^2\) | \(\times b^2\) |
| Shape, z-scores (for \(b > 0\)) | no change | no change | no change |
Worked examples
1. Celsius to Fahrenheit. The weather club’s 15 midday temperatures (°C) are: 14, 16, 17, 17, 18, 19, 19, 19, 20, 20, 21, 22, 22, 24, 27. Find the mean, median, standard deviation, IQR and variance in °C, then in °F, using \(F = 1.8C + 32\). (The figures are illustrative.)
The +32 moved the centre only. The ×1.8 stretched the spread.
Figure 1 shows both dot plots on one number line. The Fahrenheit dots sit further right and cover a wider stretch of the axis, but the pattern is identical.
2. Two kinds of pay rise. A small firm has seven workers whose monthly pay (in dollars) is 2,400, 2,600, 2,800, 3,000, 3,200, 3,400 and 4,300. The mean is $3,100, the median is $3,000 and the standard deviation is $629.81. The owner offers either (A) $200 more for everyone or (B) a 5% rise for everyone. Compare the mean, median and SD under each option. Then find the effect of (C) a 3% rise plus $100. (The figures are illustrative.)
A flat rise keeps the dollar spread the same; a percentage rise scales it.
Coded data: the Cambridge 9709 S1 version
The Cambridge International AS & A Level Mathematics syllabus (9709) asks students to calculate the mean and standard deviation from given totals, including coded totals of the form \(\Sigma(x-a)\) and \(\Sigma(x-a)^2\) [3]. These questions are just linear transformations in disguise. The code is \(y = x – a\), so \(b = 1\): the mean shifts by \(a\) and the standard deviation does not change.
Cambridge uses the population form of the variance, dividing by \(n\). With \(y = x – a\):
Notice that the variance formula has no \(a\) left in it at the end. That is the “adding a constant does not change the spread” rule at work.
If the code also divides by a constant, \(y = \dfrac{x-a}{b}\), then \(x = a + by\), so \(\bar{x} = a + b\bar{y}\) and \(\sigma_x = b\,\sigma_y\).
Sometimes you need the raw totals \(\Sigma x\) and \(\Sigma x^2\), for example to combine two data sets. Expand the brackets:
3. A coded data question. The masses, \(x\) grams, of 20 apples are summarised by \(\Sigma(x-150) = -34\) and \(\Sigma(x-150)^2 = 1286\). (a) Find the mean and standard deviation of the masses. (b) Find \(\Sigma x\) and \(\Sigma x^2\). (The figures are illustrative.)
Mean 148.3 g, standard deviation 7.84 g (3 s.f.). The Step 5 check catches most slips.
How linear transformations appear in exams
The idea turns up in several syllabuses, in slightly different clothes.
- AP Statistics. Describing and comparing one-variable data is a core part of the course [4]. Questions give a summary in one unit and ask for it in another. The same rules reappear later for random variables: if \(Y = a + bX\), then \(\mu_Y = a + b\mu_X\) and \(\sigma_Y = |b|\sigma_X\). Standard AP texts such as Starnes and Tabor treat the two ideas together [2]. For the random-variable version, see combining random variables.
- Cambridge 9709 Probability & Statistics 1. Expect coded totals, often with a second part that combines two groups. The syllabus lists using totals for problems involving up to two data sets [3].
- IB Mathematics and first-year university. Expect “each value is multiplied by 3 and then 2 is subtracted” questions, and routine unit changes in data work. Introductory texts such as OpenStax Introductory Statistics cover the measures of centre and spread these rules act on [1].
Want the full chapter on describing data, with every calculation shown? The Statistics Made Simple textbook covers centre, spread, transformations and z-scores, and the Statistics Made Simple Practice Questions book gives you drills and exam-style questions with fully worked answers.
Practice questions
EasyQ1. A class test has mean 62 and standard deviation 8. The teacher adds 5 marks to every script. Find the new mean and standard deviation. Show worked answer
New mean \(= 62 + 5 = 67\).
New standard deviation \(= 8\) (adding a constant does not change spread).
EasyQ2. Book prices in pounds have mean £40, median £38, standard deviation £6 and IQR £9. They are converted to dollars at $1.27 per pound. Find the four statistics in dollars, and the new variance. (The exchange rate is illustrative.) Show worked answer
Mean \(= 1.27 \times 40 = \$50.80\). Median \(= 1.27 \times 38 = \$48.26\).
SD \(= 1.27 \times 6 = \$7.62\). IQR \(= 1.27 \times 9 = \$11.43\).
Variance \(= 1.27^2 \times 36 = 1.6129 \times 36 = 58.06\) (dollars squared).
MediumQ3. Daily maximum temperatures in a city have mean 77 °F and standard deviation 9 °F. Find the mean and standard deviation in °C, using \(C = \tfrac{5}{9}(F – 32)\). Show worked answer
Step 2, multiply by \(\tfrac{5}{9}\): mean \(= \tfrac{5}{9} \times 45 = 25\) °C; SD \(= \tfrac{5}{9} \times 9 = 5\) °C.
MediumQ4. Ten values of \(x\) are coded using \(y = \dfrac{x – 200}{10}\). The coded totals are \(\Sigma y = 12\) and \(\Sigma y^2 = 86\). Find the mean and standard deviation of \(x\). Show worked answer
\(\sigma_y^2 = 86 \div 10 – 1.2^2 = 8.6 – 1.44 = 7.16\), so \(\sigma_y = 2.676\).
Decode with \(x = 200 + 10y\): \(\bar{x} = 200 + 10 \times 1.2 = 212\).
\(\sigma_x = 10 \times 2.676 = 26.8\) (3 s.f.). The 200 does not affect the SD; the 10 does.
ExamQ5. The times, \(x\) minutes, taken by two groups of runners are summarised below. Group A: \(n = 12\), \(\Sigma(x-30) = 18\), \(\Sigma(x-30)^2 = 240\). Group B: \(n = 8\), \(\Sigma(x-30) = -6\), \(\Sigma(x-30)^2 = 150\). (a) Find the mean and standard deviation of Group A. [3] (b) Find the mean and standard deviation of all 20 times. [4] Show worked answer
\(\sigma_A^2 = 240 \div 12 – 1.5^2 = 20 – 2.25 = 17.75\), so \(\sigma_A = 4.21\) minutes. A1
(b) Combine the coded totals (same \(a = 30\)): \(\Sigma(x-30) = 18 + (-6) = 12\) and \(\Sigma(x-30)^2 = 240 + 150 = 390\). M1
Mean \(= 30 + 12 \div 20 = 30.6\) minutes. A1
\(\sigma^2 = 390 \div 20 – 0.6^2 = 19.5 – 0.36 = 19.14\). M1
\(\sigma = \sqrt{19.14} = 4.37\) minutes. A1
Note: you can add the coded totals directly only because both groups use the same code, \(x – 30\). (The figures are illustrative.)
Frequently asked questions
Does adding a constant change the variance?
No. Adding (or subtracting) a constant moves every value and the mean by the same amount, so every deviation from the mean is unchanged. The variance, standard deviation, IQR and range all stay the same.
Why is the variance multiplied by b squared?
The variance is the average of squared deviations. Multiplying every value by \(b\) multiplies every deviation by \(b\), so every squared deviation is multiplied by \(b^2\). The standard deviation is the square root of the variance, so it is multiplied by \(|b|\).
Do the rules work for the sample and population standard deviation?
Yes. The rules come from the deviations, not from whether you divide by \(n\) or \(n – 1\). Either way, the SD is multiplied by \(|b|\) and is unaffected by \(a\).
Does a linear transformation change the shape of a histogram?
Not when \(b > 0\). The bars keep the same relative heights and the same pattern; only the axis labels change. If \(b < 0\) the histogram is mirrored, so a right-skewed distribution becomes left-skewed. See our guide to histograms and the shape of a distribution for more on shape.
References
- Illowsky, B. and Dean, S. (2023). Introductory Statistics 2e. Houston, TX: OpenStax, Rice University. Chapter 2, Descriptive Statistics. https://openstax.org/details/books/introductory-statistics-2e
- Starnes, D. S. and Tabor, J. (2024). The Practice of Statistics for the AP Course, 7th edition. BFW High School Publishers (Macmillan Learning). ISBN 9781319409340. https://store.bfwpub.com/hs/us/product/The-Practice-of-Statistics-for-the-AP-Course-7th-Edition/p/1319409342
- Cambridge University Press & Assessment (2023). Cambridge International AS & A Level Mathematics 9709: Syllabus for examination in 2026 and 2027, Version 5. Section 5.1, Representation of data. https://www.cambridgeinternational.org/Images/697427-2026-2027-syllabus.pdf
- College Board (2026). AP Statistics Course and Exam Description, effective fall 2026. New York: College Board. https://apcentral.collegeboard.org/media/pdf/ap-statistics-course-and-exam-description-effective-fall-2026.pdf

