Can You Calculate Variance Without Finding Every Deviation First?
Working out a deviation for every single value before you can even start on the variance gets tedious with larger data sets. There is a shortcut: a rearranged version of the same formula that needs only two running totals. It gives exactly the same answer, as long as you do not round too early.
The Shortcut Formula
The usual definition of the sum of squares is Σ(x − x̄)². Expanding the square and simplifying gives an equivalent form:
Sum of squares = Σx² − (Σx)² / n
Here Σx² means “square each value, then add”, and (Σx)² means “add the values, then square the total”. Once you have the sum of squares, divide by n for the population variance or by n − 1 for the sample variance, exactly as usual.
Worked Example
Take the data set 2, 4, 4, 5, 7, 8.
| Value x | x² |
|---|---|
| 2 | 4 |
| 4 | 16 |
| 4 | 16 |
| 5 | 25 |
| 7 | 49 |
| 8 | 64 |
| Σx = 30 | Σx² = 174 |
- n = 6, Σx = 30, Σx² = 174.
- (Σx)² / n = 30² / 6 = 900 / 6 = 150.
- Sum of squares = 174 − 150 = 24.
- Population variance σ² = 24 / 6 = 4.
- Sample variance s² = 24 / 5 = 4.8.
To check it, use the deviation method. The mean is 30 / 6 = 5, the deviations are −3, −1, −1, 0, 2, 3, and their squares are 9, 1, 1, 0, 4, 9. Those add up to 24, the same sum of squares.
Why It Saves Work
The deviation method needs the mean before you can start, then one subtraction and one squaring per value. The shortcut needs only two running totals, Σx and Σx², which you can build up as you go, even before you know how many values there will be. That is why it was popular for hand and calculator work, and why it suits frequency tables (multiply each value and each square by its frequency before adding).
When Not to Use It
The shortcut subtracts two numbers that can be very large and very close together. On paper with exact arithmetic that is fine. With rounding, or in computer floating-point arithmetic with large values (say, measurements around 1,000,000 that differ only in the last few digits), most of the significant digits cancel and the answer can be badly wrong, even negative. Statistical software therefore uses more stable methods. For hand calculations:
- keep full precision in Σx and Σx² and round only the final answer;
- if your values are large but close together, subtract a convenient constant from every value first (for example, use 2, 4, 4, 5, 7, 8 instead of 1002, 1004, 1004, 1005, 1007, 1008). Shifting every value by the same amount does not change the variance.
Which Method to Learn First
The deviation method shows what variance actually measures: the distance of each value from the mean. Learn that first. Use the shortcut once you understand the idea and want speed, and check a few results both ways to build confidence.
Summary
The shortcut formula, Σx² − (Σx)² / n, gives the sum of squares from two totals instead of n separate deviations. It is exact and quick for small hand calculations, but sensitive to rounding when the values are large compared with their spread. The variance calculator shows the deviation method step by step, so you can compare it with your shortcut result.