Standard Deviation Formula: Population, Sample, and Examples
Calculate population or sample standard deviation from raw values and tables. Use six examples to check units, denominators, and interpretation.
TL;DR
Standard deviation is the square root of variance. Sum squared distances from the mean, divide by for a full population or for the usual sample estimate, then take the square root.
Key Points
- The mean and the standard deviation answer different questions about centre and spread.
- Square deviations before adding them so opposite signs do not cancel.
- Match the denominator to the population or sample calculation.
- Take the square root to restore the original measurement unit.
- A grouped-data estimate uses interval midpoints in place of unknown values.
What are the population and sample standard deviation formulas?
A population standard deviation summarises every member of a known population. If there are values and their mean is , its formula is
For a sample of values with sample mean , the usual sample standard deviation is
The amount under either radical is the respective variance. If the observations are in metres, the variance has square metres as its unit and the standard deviation has metres. A dataset with standard deviation zero has no variation because every value equals its mean.
| Situation | Method | Denominator |
|---|---|---|
| You have every value in the group being described | Population calculation with | |
| You estimate spread from a sample with its own estimated mean | Usual sample calculation with | |
| One value makes up the whole population | Population calculation yields zero | 1 |
| You have a sample of just one value | The usual sample calculation is undefined |
Why do the deviations get squared and why does the sample use ?
The signed deviations sum to zero. Squaring prevents values on opposite sides of the mean from cancelling. Averaging the squares gives greater weight to observations far from the mean. Taking the square root brings the result back to the original unit.
A sample's deviations from its own mean have one constraint. Once you know the first , the last is set by the zero-sum condition. Under independent, identically distributed sampling with finite variance, dividing by makes the sample variance unbiased for the population variance. Taking its square root does not in general make the resulting sample standard deviation unbiased. OpenStax and NIST explain the two calculations in their spread references.
How do you calculate standard deviation from tables and technology?
For individual values, calculate the mean, subtract it from each value, square each result, and add. Then choose the denominator and take the square root. A table with counts can speed up the same computation. If a value occurs times, include in the sum and use the full observation count .
If the table is grouped by intervals, the raw observations may be unknown. Replace them with class midpoints, find a frequency-weighted mean, and then use the midpoint deviations in the formula. This produces an approximation and can hide spread within a class. The mean, median and mode guide works through grouped means and cumulative counts.
Many calculators show a sample setting and a population setting. NumPy's standard deviation uses division by by default for a supplied array. Set the degrees-of-freedom adjustment to 1 for division by . Check how your calculator or software handles missing values and which axis its result summarises.
How does the assumed-mean shortcut work?
For hand arithmetic, choose a convenient reference value and calculate . Let be the number of observations. The sum of squared deviations from the actual mean is
The correction subtracts the effect of choosing instead of the actual mean. For 2, 4, 4 and 6, choosing gives deviations . Their squares sum to 12 and their sum is 4, so the corrected sum is . Use the same population or sample divisor after this step. If the values are large and close together, calculate from centred differences or use a numerically stable statistics function to avoid rounding errors.
How do you interpret the result?
A larger standard deviation indicates greater squared spread around the mean, given comparable units and observations. It is sensitive to extremes because it uses squared deviations. If a few values dominate, report the range and interquartile range comparison as well.
For approximately normal data, about 68% of values lie within one standard deviation of the mean and about 95% lie within two. Those percentages depend on the distribution's shape. A standard deviation alone does not determine how many observations fall in an interval. Use the normal distribution guide for when those percentages apply.
Worked Standard Deviation Examples
Example 1
Treat 2, 4, 4, and 6 as the whole population. Find its standard deviation.
- The mean is .
- The squared deviations are 4, 0, 0 and 4 for a total of 8.
- Divide by 4 and take the square root. The result is .
Example 2
Treat those same values as a sample. What changes?
- The mean and sum of squared deviations stay at 4 and 8.
- The denominator is .
- The result is .
Example 3
A full set of recorded values has 3 once, 7 twice, and 11 once. Find the standard deviation from the counts.
- The weighted sum is . Divide by the count of 4 to get 7.
- The total squared deviation is .
- Use the population divisor of 4. The standard deviation is .
Example 4
Four sampled times fall into three intervals, with one in , two in , and one in . Estimate the sample standard deviation.
- Use the midpoints 5, 15, and 25. The weighted mean is 15.
- The estimated squared-deviation sum is .
- Divide by 3 and take the root to get time units. The true value depends on the unknown observations.
Example 5
A dataset has standard deviation 3. Every value is doubled and then increased by 10. What is the new standard deviation?
- The mean also doubles and increases by 10.
- Subtracting the new mean removes the added 10 from every deviation. The remaining deviations are twice their old size.
- The variance increases by a factor of four. The standard deviation doubles to 6.
Example 6
A score is 78, and its reference distribution has mean 70 and standard deviation 4. How far above the mean is that score?
- The raw difference is points.
- Divide by 4 to get the standard score .
- The score is two standard deviations above the mean. A percentile would need an assumed distribution or empirical rankings.
Mistakes That Change Standard Deviation
Mistake 1: Squaring the sum of deviations
Square each difference first. Squaring their combined signed sum gives zero regardless of genuine spread.
Mistake 2: Choosing the wrong divisor
Use the sample formula when the question asks for the standard sample estimate. If every member of the target group is present and you are describing that group, use the population formula. The population and sample guide explains how the two contexts differ.
Mistake 3: Forgetting the final square root
The quantity after division is variance. For measured lengths, that result is in squared lengths. Take its square root to report standard deviation.
Try It Yourself
- Find the population standard deviation of 6, 6, and 6.
- Find the sample standard deviation of 8, 10, and 12.
- If you change a set of measurements from metres to centimetres, how does its standard deviation change?
Answers and Reasoning
- Every deviation is zero, so the population standard deviation is zero.
- The mean is 10 and the squared deviations sum to 8. Divide by and take the square root to get 2.
- Every deviation is 100 times as large in the new unit. The numerical standard deviation is multiplied by 100 and expressed in centimetres.
Questions About Standard Deviation
Is standard deviation the mean of the distances from the mean?
It uses squared distances and takes a square root after averaging or applying the sample divisor. The mean of the absolute deviations is a different measure, with less weight on the largest distances.
Can two sets have the same mean and different standard deviations?
Yes. Both 5, 5, 5 and 1, 5, 9 have mean 5. The first has zero spread, and the second has positive spread.
Conclusion
- Centre the observations around their mean and add their squared deviations.
- Use the divisor that matches the calculation.
- Take the square root and report the original unit.