On this page
When calculating variance for large grouped data, the numbers often become unwieldy. The step-deviation (or coding) method solves this by creating a new, simpler variable: u = (x − a) / h.
But while finding the mean only requires reversing those two steps (mean of x = a + h × mean of u), calculating the variance requires multiplying the variance of u by h². Here is why that happens, how to prove it, and a worked example to show it in action.
Why use the step-deviation method?
If your class mid-points (x) and frequencies (f) are large numbers, calculating x² and multiplying it by f quickly leads to arithmetic errors. The step-deviation method transforms the data to make the numbers small and manageable.
You choose an assumed mean a (usually the middle value of your x column) and identify the class width h. You then calculate the coded data: u = (x − a) / h
Subtracting a is a "change of origin" (it shifts the data without changing its spread). Dividing by h is a "change of scale" (it shrinks the spread).
Why does the variance of coded data multiply by h²?
Variance measures how far data points spread out from their mean. It is defined as the average of the squared differences from the mean.
Let the original data be x with mean M_x, and the coded data be u with mean M_u. From the coding formula, we can express x as: x = a + h × u
The mean of the original data follows the exact same relationship: M_x = a + h × M_u
Now, find the deviation of any point from the mean: x − M_x = (a + h × u) − (a + h × M_u) x − M_x = h × (u − M_u)
Notice that the assumed mean a cancels out entirely. Shifting data left or right does not change its spread. However, the h remains.
To find the variance, we square these deviations: (x − M_x)² = h² × (u − M_u)²
Finally, we multiply by the frequency f, sum them up, and divide by the total frequency N: Variance of x = (1/N) × Sum of [f × (x − M_x)²] Variance of x = (1/N) × Sum of [f × h² × (u − M_u)²]
Because h² is a constant, we can pull it outside the summation: Variance of x = h² × [ (1/N) × Sum of f × (u − M_u)² ]
The expression in the brackets is exactly the variance of u. Therefore: Var(x) = h² × Var(u)
Because variance involves squaring the distances from the mean, any scaling factor h applied to the data becomes h² in the variance. Standard deviation, which is the square root of variance, simply scales by h.
A worked example: calculating variance step by step
Let us calculate the variance for a simple distribution where the class width is h = 10. The class mid-points (x) are 15, 25, 35, 45 and 55. The corresponding frequencies (f) are 2, 3, 8, 4 and 3. The total frequency N is 20.
We choose the assumed mean a = 35. The formula for u is (x − 35) / 10.
First, calculate the u values for each row:
For x = 15: u = −2. The product fu = 2 × −2 = −4, and fu² = 2 × 4 = 8.
For x = 25: u = −1. The product fu = 3 × −1 = −3, and fu² = 3 × 1 = 3.
For x = 35: u = 0. The product fu = 0, and fu² = 0.
For x = 45: u = 1. The product fu = 4 × 1 = 4, and fu² = 4 × 1 = 4.
For x = 55: u = 2. The product fu = 3 × 2 = 6, and fu² = 3 × 4 = 12.
Next, sum the columns:
The sum of fu is −4 − 3 + 0 + 4 + 6 = 3.
The sum of fu² is 8 + 3 + 0 + 4 + 12 = 27.
Now, calculate the variance of the coded data, Var(u). The formula is the average of the squares minus the square of the average: Var(u) = (Sum of fu² / N) − (Sum of fu / N)² Var(u) = (27 / 20) − (3 / 20)² Var(u) = 1.35 − (0.15)² Var(u) = 1.35 − 0.0225 = 1.3275
Finally, recover the variance of the original data by multiplying by h²: Var(x) = h² × Var(u) Var(x) = 100 × 1.3275 = 132.75
Using the step-deviation method, we found the variance without ever squaring numbers like 45 or 55.
How to practice variance without getting stuck
Mastering statistics requires working through problems until the formulas become second nature. If you are reviewing for exams, you can explore related concepts like How adding to or scaling data changes the mean and variance and the Variance of two combined groups.
When you get stuck on a calculation, it helps to see exactly where your arithmetic went off track. The Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer. If you need to revise the underlying theory, the Fermi Concept Library contains every concept in mathematics mapped out. Fermi's AI tutor can look at your attempt, work out what you already know, and build a plan for the session, so you can correct your method and move forward with confidence.



