Standard Deviation: Ungrouped

Square the distances so they cannot cancel.

The differences from the mean

Take the three values 2, 4 and 6. Their mean is x̄ = (2 + 4 + 6) ÷ 3 = 12 ÷ 3 = 4. The differences from the mean, x − x̄, are 2 − 4 = −2, 4 − 4 = 0 and 6 − 4 = +2.

01234562464.0

The bar for 2 ends 2 below the mean line at 4, the bar for 4 ends on it, and the bar for 6 ends 2 above it.

Square them so they cannot cancel

Added as they are, the differences cancel: −2 + 0 + 2 = 0. They always do, because the mean is the balance point of the values.

Square each difference first: (−2)² = 4, 0² = 0 and 2² = 4. A square is never negative, so the squares cannot cancel. Their total, 4 + 0 + 4 = 8, could be 0 only if every value were equal to the mean.

01234246

The squared differences of 2, 4 and 6 from the mean: 4, 0 and 4. None of them is below 0.

Average the squares, then take the square root

Average the squares: 8 ÷ 3 = 8/3 ≈ 2.67. That is the variance. Then take its square root: √(8/3) ≈ 1.63. That is the standard deviation. The square root undoes the squaring and brings the answer back to the units of the data.

In symbols, σ = √(Σ(x − x̄)²/n). Laid out as a table, there is one row for each value, a column for x − x̄ and a column for (x − x̄)², and the total of the last column is divided by n.

x − 4(x − 4)²x²2−244400166+2436total0856

The squared differences total 8, so the variance is 8/3 and σ = √(8/3) ≈ 1.63. The last column, the squares of the values themselves, is used next.

A shorter formula

The definition needs the mean before any square can be worked out, and when the mean is not a whole number every difference is a decimal. Expanding the square gives a formula that avoids this.

Each squared difference expands like any bracket: (x − x̄)² = x² − 2x̄x + x̄². Add this up over all n values. The x² terms give Σx². The middle terms give 2x̄Σx, and since Σx = n x̄, that is 2n x̄². The last term, x̄², is added n times, which gives n x̄². So Σ(x − x̄)² = Σx² − 2n x̄² + n x̄² = Σx² − n x̄².

Dividing by n gives the variance as Σx²/n − x̄², the mean of the squares minus the square of the mean. So σ = √(Σx²/n − x̄²).

Check it on 2, 4 and 6. The squares of the values are 4, 16 and 36, so Σx² = 56. Then Σx²/n − x̄² = 56/3 − 4² = 56/3 − 48/3 = 8/3, the same variance as before, and σ = √(8/3) ≈ 1.63.

When the mean is not a whole number

A team scores 1, 2, 4 and 7 goals in four matches. The mean is 14 ÷ 4 = 3.5 goals. By the definition, the differences from 3.5 are −2.5, −1.5, 0.5 and 3.5, and their squares are 6.25, 2.25, 0.25 and 12.25, which total 21. The variance is 21 ÷ 4 = 5.25.

By the shorter formula, the squares of the values are 1, 4, 16 and 49, whole numbers that total 70. Then Σx²/n − x̄² = 70 / 4 − 3.5² = 17.5 − 12.25 = 5.25, the same variance. Either way, σ = √5.25 ≈ 2.29 goals.

The two methods always agree. The definition shows what the standard deviation measures; the shorter formula is usually quicker by hand, because it works with the values themselves until the last step.

x − 3.5(x − 3.5)²x²1−2.56.2512−1.52.2544+0.50.25167+3.512.2549total02170

By the definition, 21 ÷ 4 = 5.25. By the shorter formula, 70 / 4 − 3.5² = 17.5 − 12.25 = 5.25. The variance is the same.

Mistakes with the shorter formula

Σx² is the sum of the squares, not the square of the sum. For 1, 2, 4 and 7, Σx² = 1 + 4 + 16 + 49 = 70, while the square of the sum is 14² = 196.

Divide Σx² by n first, and then subtract the square of the mean: 70 ÷ 4 − 12.25, not (70 − 12.25) ÷ 4.

Use the exact mean. The two numbers being subtracted are often close together, so a rounded mean can change the answer a great deal. Rounding the mean 3.5 up to 4 gives 17.5 − 16 = 1.5 in place of 5.25.

Worked example: Two Bottle-Filling Machines with the Same Mean Weight and Different Standard Deviations

Question Two machines fill bottles that should hold 500 g. Five bottles are weighed from each machine. Machine A gave 497, 499, 500, 501 and 503 g. Machine B gave 494, 498, 500, 502 and 506 g. (a) Show that the two machines have the same mean weight, and find the standard deviation of each set of five bottles, dividing by the number of bottles. (b) A bottle is rejected when its weight differs from 500 g by more than 5 g. How many of the ten bottles are rejected, and which machine should be serviced?

  1. 1.Find each mean. Machine A: 497 + 499 + 500 + 501 + 503 = 2500, and 2500 ÷ 5 = 500 g. Machine B: 494 + 498 + 500 + 502 + 506 = 2500, and 2500 ÷ 5 = 500 g. Both machines average the target weight exactly.

    A, g(A − 500)2B, g(B − 500)249749449949850050050150250350625002500both machines total 2500 g2500 divided by 5 = 500 g each
    A, g(A − 500)2B, g(B − 500)249749449949850050050150250350625002500both machines total 2500 g2500 divided by 5 = 500 g each
    Both machines total 2500 g over 5 bottles, so both means are 500 g.
  2. 2.Machine A, distance from the mean and its square: −3 gives 9, −1 gives 1, 0 gives 0, 1 gives 1 and 3 gives 9. The squares total 9 + 1 + 0 + 1 + 9 = 20, so the variance is 20 ÷ 5 = 4 and the standard deviation is √4 = 2 g.

    A, g(A − 500)2B, g(B − 500)2497949449914985000500501150250395062500202500A: 20 divided by 5 = 4A: the square root of 4 is 2 g
    A, g(A − 500)2B, g(B − 500)2497949449914985000500501150250395062500202500A: 20 divided by 5 = 4A: the square root of 4 is 2 g
    Machine A, squared distances from 500 g: 9 + 1 + 0 + 1 + 9 = 20, so the variance is 4 and the standard deviation is √4 = 2 g.
  3. 3.Machine B, the same two columns: −6 gives 36, −2 gives 4, 0 gives 0, 2 gives 4 and 6 gives 36. The squares total 36 + 4 + 0 + 4 + 36 = 80, so the variance is 80 ÷ 5 = 16 and the standard deviation is √16 = 4 g.

    A, g(A − 500)2B, g(B − 500)2497949436499149845000500050115024503950636250020250080B: 80 divided by 5 = 16B: the square root of 16 is 4 g
    A, g(A − 500)2B, g(B − 500)2497949436499149845000500050115024503950636250020250080B: 80 divided by 5 = 16B: the square root of 16 is 4 g
    Machine B: 36 + 4 + 0 + 4 + 36 = 80, so the variance is 16 and the standard deviation is √16 = 4 g.
  4. 4.(a) Both means are 500 g. Machine A has a standard deviation of 2 g and machine B one of 4 g, so machine B's weights sit twice as far from the target on average.

    A, g(A − 500)2B, g(B − 500)2497949436499149845000500050115024503950636250020250080same mean, 500 gspread: 2 g against 4 g
    A, g(A − 500)2B, g(B − 500)2497949436499149845000500050115024503950636250020250080same mean, 500 gspread: 2 g against 4 g
    (a) The means are equal at 500 g, and the standard deviations are 2 g and 4 g.
  5. 5.(b) A bottle is kept when it weighs between 495 g and 505 g. Machine A's lightest bottle is 497 g and its heaviest is 503 g, so all five are kept. Machine B's 494 g and 506 g bottles are outside the limits, so 2 bottles are rejected, both from machine B, and machine B is the machine to service. Check: every rejected bottle is more than one standard deviation of machine B from the target, and machine A's whole range, 497 g to 503 g, sits inside the limits.

    A, g(A − 500)2B, g(B − 500)2497949436499149845000500050115024503950636250020250080495500505ABa bottle is kept from 495 to 505 gB loses 494 and 506: 2 bottles
    A, g(A − 500)2B, g(B − 500)2497949436499149845000500050115024503950636250020250080495500505ABa bottle is kept from 495 to 505 gB loses 494 and 506: 2 bottles
    (b) A bottle is kept between 495 g and 505 g. Machine A keeps all five; machine B loses 494 g and 506 g, so 2 bottles are rejected and machine B is the one to service.

Answer: (a) both machines have a mean of 500 g, and the standard deviations are 2 g for machine A and 4 g for machine B; (b) 2 bottles are rejected, both from machine B, so machine B should be serviced

Common mistakes

  • Adding the distances from the mean without squaring them. For machine A those distances are −3, −1, 0, 1 and 3, which add to 0, and the same happens for every data set: the distances below the mean cancel the distances above it exactly. Squaring is what stops the cancellation.
  • Forgetting the square root and calling 16 the standard deviation of machine B. The squares are in square grams, so 16 is the variance. The standard deviation is √16 = 4 g, and only that can be compared with a tolerance measured in grams.

More measuring data problems, worked step by step →

Practice Standard Deviation: Ungrouped in the app