Why divide by n - 1 for sample standard deviation?

By Jude Wallis · Published

You divide by n - 1 because the deviations are measured from the sample mean, which sits inside your own data and therefore closer to it than the true population mean does. That makes the squared deviations come out too small, and n - 1 corrects the bias in the variance.

AP Statistics: Unit 1 (topics 1.7 Summary Statistics for One Quantitative Variable). Standard deviation is Unit 1 topic 1.7, where the Fall 2026 CED gives the sample formula with the n - 1 divisor and calls s squared the sample variance; the definition of an unbiased estimator appears in Unit 3 topic 3.1.

The sample mean sits inside your own data

When you calculate a sample standard deviation you do not know the population mean μ\mu ("mu"), so you use the sample mean xˉ\bar{x} ("x-bar") in its place. Everything that follows comes from that one substitution.

The value of xˉ\bar{x} is computed from the same numbers whose spread you are about to measure, so it always lands in the middle of them. The true mean μ\mu sits wherever the population puts it, which for any particular sample is usually a little off to one side. Distances measured to a point inside your data are shorter than distances measured to a point off to the side.

So the sum of squares (xixˉ)2\sum (x_i - \bar{x})^2 comes out systematically smaller than (xiμ)2\sum (x_i - \mu)^2 would. Dividing that too-small total by nn would hand you a spread estimate that runs low on average, sample after sample. Dividing by n1n - 1 makes the result slightly larger and cancels the shortfall.

How much too small: a concrete look

Take a sample of five values: 4, 6, 8, 10, and 12. The sample mean is xˉ=40/5=8\bar{x} = 40/5 = 8. Measured from 8, the squared deviations are 16, 4, 0, 4, and 16, which total 40.

Now suppose you also knew that the population mean was μ=10\mu = 10. Measured from 10, the squared deviations are 36, 16, 4, 0, and 4, which total 60. Same five numbers, same squaring, but 40 against 60.

That gap is not an accident of these particular values. For any constant cc, the sum of squared deviations splits like this:

(xic)2=(xixˉ)2+n(xˉc)2\sum (x_i - c)^2 = \sum (x_i - \bar{x})^2 + n(\bar{x} - c)^2

The added term n(xˉc)2n(\bar{x} - c)^2 is never negative, so no center beats xˉ\bar{x}: the sum of squares around the sample mean is the smallest one available. Check it on the numbers above, with c=10c = 10: 40+5(810)2=40+20=6040 + 5(8 - 10)^2 = 40 + 20 = 60.

The same five values under both divisors

Nothing about the data changes when you switch divisors. Only the last two steps of the calculation change.

DivisorVarianceStandard deviation
n1=4n - 1 = 440/4=1040 / 4 = 10103.1623\sqrt{10} \approx 3.1623
n=5n = 540/5=840 / 5 = 882.8284\sqrt{8} \approx 2.8284

The n1n - 1 version is larger by a factor of 5/41.1180\sqrt{5/4} \approx 1.1180, about 11.8% here. That correction shrinks fast as samples grow, because the factor is n/(n1)\sqrt{n/(n-1)}: at n=50n = 50 it is about 1.0102, a difference of roughly 1%.

Neither number is wrong on its own. They answer different questions. The value 8\sqrt{8} is the spread of these five numbers treated as a complete population, and 10\sqrt{10} is an estimate of the spread of the larger population the five came from. The step-by-step calculation is identical until that divisor.

Degrees of freedom: only n - 1 deviations are free

Here is the same idea told through counting. Deviations from the sample mean always add to zero, and that is a constraint the data has to satisfy.

For 4, 6, 8, 10, 12 with mean 8, the deviations are -4, -2, 0, 2, and 4. Add them: 42+0+2+4=0-4 - 2 + 0 + 2 + 4 = 0. Now suppose you know only the first four, -4, -2, 0, and 2. The fifth is not free to be anything at all: it has to be 4, because the five are forced to sum to zero.

So five deviations carry only four independent pieces of information about spread. That count, n1n - 1, is the degrees of freedom of the sample standard deviation. Estimating one quantity from the data, the mean, uses up one of the nn pieces, and the divisor is set to what is left.

The two explanations are one fact seen from two sides. The constraint that makes the fifth deviation predictable is exactly the constraint that pulls xˉ\bar{x} into the middle of the data and shrinks the sum of squares.

What n - 1 fixes, and what it does not

Be precise about the claim, because the loose version of it is false. Dividing by n1n - 1 makes the sample variance s2s^2 an unbiased estimator of the population variance σ2\sigma^2 ("sigma squared"). The AP course defines an unbiased estimator as one that on average neither underestimates nor overestimates the parameter. Averaged over every possible sample, s2s^2 lands on σ2\sigma^2 exactly.

It does not make ss an unbiased estimator of σ\sigma ("sigma"). Averaging and square-rooting do not commute: the average of the roots is not the root of the average. In practice ss runs a little below σ\sigma on average, and no fixed divisor repairs that for every distribution. The second worked example below shows both halves of this on a population small enough to check by hand.

This is why it is worth saying "unbiased variance" rather than "correct standard deviation". The n1n - 1 divisor fixes the quantity the algebra can fix, and that quantity is the variance.

When you divide by n instead

Divide by nn when your values are the entire population you care about rather than a sample from something larger. Then the mean you subtract really is μ\mu, no estimation happened, and there is no bias to correct.

  • The 12 monthly totals for one year, when the question is about that year only.
  • The scores of all 28 students in a class, when the class itself is the population.
  • Any set where you can honestly say nothing was left unmeasured.

Almost every data set in AP Statistics is a sample, so n1n - 1 is the default, and the n1n - 1 version is the formula printed on the exam formula sheet. Calculators report both: SxSx (or ss) divides by n1n - 1, and σx\sigma x divides by nn. Reading the wrong line is a common way to lose a point on an otherwise clean calculation.

Where n - 1 turns up again

Once you have ss, the same count follows you into inference. For a single sample mean, the tt procedures use a tt-distribution with n1n - 1 degrees of freedom, the same number for the same reason: one parameter, the mean, was estimated from the data.

The value of ss also feeds the standard error s/ns / \sqrt{n}, which measures how much a sample mean bounces around from sample to sample rather than how much individual values spread out. Those two ideas get swapped constantly, and the guide on standard error against standard deviation separates them.

To see both divisors on your own numbers, enter a data set in the standard deviation calculator and compare the ss and σ\sigma it reports. The gap between them is the correction this page is about.

Both divisors on the same five values

A sample of five values is 4, 6, 8, 10, and 12. Calculate the variance and standard deviation with the n1n - 1 divisor and with the nn divisor, and compare them.

  1. Find the mean: xˉ=4+6+8+10+125=405=8\bar{x} = \frac{4 + 6 + 8 + 10 + 12}{5} = \frac{40}{5} = 8.

  2. Find the deviations xixˉx_i - \bar{x}: 4-4, 2-2, 00, 22, and 44. As a check they sum to 42+0+2+4=0-4 - 2 + 0 + 2 + 4 = 0.

  3. Square them: 1616, 44, 00, 44, and 1616.

  4. Add the squares: 16+4+0+4+16=4016 + 4 + 0 + 4 + 16 = 40.

  5. Divide by n1=4n - 1 = 4: the sample variance is s2=40/4=10s^2 = 40/4 = 10, so s=103.1623s = \sqrt{10} \approx 3.1623.

  6. Divide by n=5n = 5: the population variance is σ2=40/5=8\sigma^2 = 40/5 = 8, so σ=82.8284\sigma = \sqrt{8} \approx 2.8284.

  7. Compare: 10/8=1.251.1180\sqrt{10} / \sqrt{8} = \sqrt{1.25} \approx 1.1180, so the n1n - 1 answer is about 11.8% larger.

With n1n - 1: s2=10s^2 = 10 and s3.1623s \approx 3.1623. With nn: σ2=8\sigma^2 = 8 and σ2.8284\sigma \approx 2.8284. The sample version is larger by the factor 5/41.1180\sqrt{5/4} \approx 1.1180, roughly 11.8%.

Averaging the variance over every possible sample

A population has just three members: 2, 4, and 6. Draw a sample of size 2 at random with replacement, so all 9 ordered pairs are equally likely. Averaged over those 9 samples, does the n1n - 1 variance or the nn variance hit the true population variance?

  1. Find the population values. The population mean is μ=(2+4+6)/3=4\mu = (2 + 4 + 6)/3 = 4. The population variance divides by N=3N = 3: σ2=(24)2+(44)2+(64)23=4+0+43=832.6667\sigma^2 = \frac{(2-4)^2 + (4-4)^2 + (6-4)^2}{3} = \frac{4 + 0 + 4}{3} = \frac{8}{3} \approx 2.6667, so σ=8/31.6330\sigma = \sqrt{8/3} \approx 1.6330.

  2. List the 9 equally likely samples: (2,2), (2,4), (2,6), (4,2), (4,4), (4,6), (6,2), (6,4), and (6,6).

  3. For a sample of size 2 the sum of squared deviations is easy: the two deviations are each half the difference, so the sum of squares is (x1x2)2/2(x_1 - x_2)^2 / 2. For (2,6): the mean is 4, the deviations are 2-2 and 22, and the squares add to 4+4=84 + 4 = 8, matching (26)2/2=16/2=8(2-6)^2/2 = 16/2 = 8.

  4. Sums of squares for the 9 samples, in the order listed: 0, 2, 8, 2, 0, 2, 8, 2, 0.

  5. Divide each by n1=1n - 1 = 1, so the nine values of s2s^2 are 0, 2, 8, 2, 0, 2, 8, 2, 0. Their average is 0+2+8+2+0+2+8+2+09=249=832.6667\frac{0 + 2 + 8 + 2 + 0 + 2 + 8 + 2 + 0}{9} = \frac{24}{9} = \frac{8}{3} \approx 2.6667, which is exactly σ2\sigma^2.

  6. Divide each by n=2n = 2 instead: 0, 1, 4, 1, 0, 1, 4, 1, 0. Their average is 129=431.3333\frac{12}{9} = \frac{4}{3} \approx 1.3333, exactly half of σ2\sigma^2. Too small, on average, by a factor of 2.

  7. Now take square roots of the n1n - 1 variances: 0, 21.4142\sqrt{2} \approx 1.4142, 82.8284\sqrt{8} \approx 2.8284, and so on. Four samples give 2\sqrt{2}, two give 8\sqrt{8}, and three give 0, so the average of ss is 4(1.4142)+2(2.8284)9=11.313791.2571\frac{4(1.4142) + 2(2.8284)}{9} = \frac{11.3137}{9} \approx 1.2571.

  8. Compare that with σ1.6330\sigma \approx 1.6330. Even with the n1n - 1 divisor, ss falls short of σ\sigma on average.

The n1n - 1 variance averages 8/32.66678/3 \approx 2.6667, exactly the population variance σ2\sigma^2, so s2s^2 is unbiased. The nn version averages 4/31.33334/3 \approx 1.3333, only half as large. The standard deviation is a different story: the average of ss is about 1.2571 while σ1.6330\sigma \approx 1.6330, so n1n - 1 removes the bias in the variance, not in the standard deviation.

Frequently asked questions

Does dividing by n - 1 make the standard deviation unbiased?

No. It makes the sample variance s2s^2 unbiased for the population variance σ2\sigma^2, which is the precise claim. The standard deviation ss is the square root of an unbiased estimator, and square roots do not preserve averages, so ss still tends to land a little below σ\sigma. In the tiny-population worked example the average of ss is about 1.2571 while σ1.6330\sigma \approx 1.6330.

Why n - 1 and not n - 2?

Because exactly one quantity was estimated from the data: the mean. Each quantity you estimate costs one degree of freedom. When two are estimated, as with the slope and intercept of a least-squares regression line, the matching divisor is n2n - 2. Inference for regression slopes was removed from the AP exam in the Fall 2026 redesign, so that version is college content rather than exam content.

Does the choice still matter for a large sample?

Less and less. The variance changes by a factor of n/(n1)n/(n-1), so at n=100n = 100 that is 100/991.0101100/99 \approx 1.0101 and the standard deviation changes by 1.01011.0050\sqrt{1.0101} \approx 1.0050, about half a percent. At n=5n = 5 the same factor is 1.251.1180\sqrt{1.25} \approx 1.1180, closer to 12%. Small samples are where the divisor earns its keep.

Which version does my calculator report?

Both. One-variable statistics output lists SxSx (or ss), which divides by n1n - 1, and σx\sigma x, which divides by nn. Use SxSx for sample data, and note that it is the version printed on the AP formula sheet.