S2.5StatisticsStretch

Coding

Coding simplifies awkward numbers by transforming the data with y=x−aby = \dfrac{x - a}{b}. You then find the mean and standard deviation of the easy coded values and reverse the coding to recover the originals.

25 min Measures of Location and Spread
Edexcel AS Level Maths: 2.5 Coding (Mean and Standard Deviation)Curated by Kepler, not produced by us. Watch it before the notes below.
Open on YouTube

What you'll be able to do

  • Apply a coding transformation
  • Find the mean of the original data from the coded mean
  • Find the standard deviation from the coded data
  • Understand which statistics shift vs scale
1

What coding does

Coding replaces each value xx with y=x−aby = \dfrac{x - a}{b} — subtracting aa then dividing by bb to get smaller, friendlier numbers to work with.

y=x−aby = \dfrac{x - a}{b}
Subtract aa, divide by bb.
2

Reversing for the mean

The mean codes exactly like a data value: find yˉ\bar{y}, then reverse the transformation to get xˉ\bar{x}.

xˉ=b yˉ+a\bar{x} = b\,\bar{y} + a
Undo the coding on the mean.
Example 1Coding y=x−10010y = \dfrac{x - 100}{10} gives yˉ=3\bar{y} = 3. Find xˉ\bar{x}.
1xˉ=10(3)+100\bar{x} = 10(3) + 100.
Answer130130
3

Reversing for standard deviation

Standard deviation is affected by the scaling\textbf{scaling} only, not the shift — subtracting aa doesn’t change spread, but dividing by bb does. So multiply the coded standard deviation by bb.

σx=b σy\sigma_x = b\,\sigma_y
Only the scale factor bb affects spread.

Tip — Adding/subtracting shifts data (mean changes, spread doesn’t); multiplying/dividing scales both.

Formula recap

y=x−aby = \dfrac{x - a}{b}
The coding transformation.
xˉ=byˉ+a\bar{x} = b\bar{y} + a
Reverse coding for the mean.
σx=bσy\sigma_x = b\sigma_y
Reverse coding for σ (scale only).

Common mistakes to avoid

Adding a back when reversing the standard deviation.
The shift a does not affect spread; only multiply σ by b.
Forgetting to reverse the coding at the end.
The coded mean/σ must be converted back to the original scale.

Key takeaways

  • Coding: y = (x − a)/b to simplify numbers.
  • Mean reverses fully: x̄ = b·ȳ + a.
  • Standard deviation reverses by scale only: σₓ = b·σᵧ.

Test yourself

Answer a few questions, then review anything you missed.

Next step

Keep practising

Start with the quiz above to check the key ideas. You can also choose another topic from the practice library.

Browse practice topics

Related lessons

All 5 lessons

Put the methods into practice: see how A-Level maths duels work. An account is required to play; the overview and sample are public.