Counting & Probability

Standard Deviation: How to Find It, Step by Step

Standard deviation is the square root of the average squared distance from the mean. For a sample, s=∑(xi−xˉ)2n−1s=\sqrt{\frac{\sum (x_i-\bar{x})^2}{n-1}}, and for a whole population you divide by NN instead and write σ\sigma.

σ=∑(xi−μ)2N\sigma = \sqrt{\frac{\sum (x_i - \mu)^2}{N}}

Try it with your numbers

Show every step

The arithmetic takes five small steps. What costs marks is choosing the right denominator and knowing what the answer means. If finding the mean still feels shaky, the lesson on mean, median, mode and range covers it first.

What does standard deviation measure?

The mean tells you where a data set is centered. Standard deviation tells you how tightly the values huddle around that center. Two classes can both average 75 on a test, but if one class scored between 70 and 80 and the other between 40 and 100, only the standard deviation shows the difference.

Technically it is the root mean square of the distances from the mean. That is why it is not quite the “average distance”. Squaring gives far-away values extra weight, so the standard deviation is always at least as large as the plain average distance. For the two values 00 and 1010, the mean is 55 and both values sit exactly 55 away, so the standard deviation is exactly 55.

Three facts are worth memorizing. Standard deviation is never negative. It equals zero only when every value is the same. And it is measured in the same units as the data: minutes stay minutes, dollars stay dollars. Its square, the variance, lives in squared units, which is why the square root step exists.

Quick check

Two sets both have mean 55: {4,5,6}\{4, 5, 6\} and {0,5,10}\{0, 5, 10\}. Which has the larger standard deviation?

How do you calculate standard deviation step by step?

The same five steps work every time:

  1. Find the mean.
  2. Subtract the mean from every value to get the deviations.
  3. Square each deviation.
  4. Add the squares and divide by NN (population) or n−1n-1 (sample). This is the variance.
  5. Take the square root.

Example 1. Find the population standard deviation of 2,4,4,4,5,5,7,92, 4, 4, 4, 5, 5, 7, 9.

μ=2+4+4+4+5+5+7+98=408=5\mu=\frac{2+4+4+4+5+5+7+9}{8}=\frac{40}{8}=5

The deviations are −3,−1,−1,−1,0,0,2,4-3,-1,-1,-1,0,0,2,4. The squares are 9,1,1,1,0,0,4,169,1,1,1,0,0,4,16, which add to 3232. Then

σ2=328=4,σ=4=2.\sigma^2=\frac{32}{8}=4,\qquad \sigma=\sqrt{4}=2.

Two checks catch most errors. The deviations must add to zero (here −3−1−1−1+0+0+2+4=0-3-1-1-1+0+0+2+4=0), which instantly verifies your mean. And the most common slip is stopping at step 4, which reports the variance 44 instead of the standard deviation 22. Here the two look similar, but with a variance like 2.52.5 they do not.

Try this: Find the population standard deviation of 33 and 99 by eye: each value sits 33 from the mean 66. Now find it for 3,9,3,9,3,93, 9, 3, 9, 3, 9. Why does repeating the pattern change nothing?

Why does sample standard deviation divide by n minus 1?

Use NN when your data is the entire group you care about, such as every score from the 28 students in one class when the class is all you are describing. Use n−1n-1 when your data is a sample meant to estimate a bigger group. Almost every real data set and most textbook problems that say “sample” fall into the second case.

Example 2. Find the sample standard deviation of 3,7,8,10,123, 7, 8, 10, 12.

The mean is 405=8\frac{40}{5}=8. The deviations are −5,−1,0,2,4-5,-1,0,2,4 and the squares are 25,1,0,4,1625,1,0,4,16, which add to 4646.

s2=465−1=11.5,s=11.5≈3.39s^2=\frac{46}{5-1}=11.5,\qquad s=\sqrt{11.5}\approx 3.39

Dividing by 55 instead would give 9.2≈3.03\sqrt{9.2}\approx 3.03, a noticeably smaller number.

The reason is that the sample mean xˉ\bar{x} is built from the same values you are measuring, so it sits closer to them than the true mean μ\mu does. In fact, for any data set, ∑(xi−μ)2=∑(xi−xˉ)2+n(xˉ−μ)2\sum(x_i-\mu)^2=\sum(x_i-\bar{x})^2+n(\bar{x}-\mu)^2. The extra term is never negative, so measuring from xˉ\bar{x} always comes up short. Dividing by n−1n-1 repairs that shortfall exactly for the variance. A second view: the deviations from xˉ\bar{x} must add to zero, so only n−1n-1 of them are free to vary.

Match the button to the formula

Calculators and spreadsheets label the two versions differently (SxS_x or STDEV.S for a sample, σx\sigma_x or STDEV.P for a population). Picking the wrong one scales your answer by nn−1\sqrt{\frac{n}{n-1}}, which is about 1.1181.118 for n=5n=5.

One more edge case: with a single value, n−1=0n-1=0, so a sample standard deviation does not exist. One point carries no information about spread.

Where does the standard deviation formula come from?

Start with the obvious idea: average the deviations. It fails because deviations from the mean always cancel to zero. You could use absolute values, and that gives a legitimate measure called the mean absolute deviation. Squaring wins because it leads to clean algebra.

Define f(c)=∑(xi−c)2f(c)=\sum(x_i-c)^2, the total squared miss if you summarize the data with the single number cc. Expanding gives f(c)=nc2−2c∑xi+∑xi2f(c)=nc^2-2c\sum x_i+\sum x_i^2, a parabola in cc whose vertex is at c=∑xinc=\frac{\sum x_i}{n}, the mean. So the mean is the best one-number summary under squared error, and the smallest possible value of ff is the sum of squared deviations. Finding a vertex is the same skill drilled in quadratic formula practice problems.

There is a second, less known view. If you compare every pair of values instead of comparing to the mean, you get

∑i<j(xi−xj)2=n∑i(xi−xˉ)2.\sum_{i<j}(x_i-x_j)^2=n\sum_{i}(x_i-\bar{x})^2.

Test it on 2,4,92, 4, 9: the pairs give 4+49+25=784+49+25=78, and n∑(xi−xˉ)2=3⋅26=78n\sum(x_i-\bar{x})^2=3\cdot 26=78. So standard deviation measures how far apart the values are from each other, and the number of pairs is (n2)\binom{n}{2}, a count from combinations. Geometrically, the sum of squared deviations is the squared distance from your data point (in nn dimensions) to the point where every coordinate is the mean.

Is there a faster way to find standard deviation by hand?

Yes. Expanding the squares gives the computational shortcut:

SS=∑xi2−(∑xi)2nSS=\sum x_i^2-\frac{\left(\sum x_i\right)^2}{n}

where SSSS is the sum of squared deviations. You never calculate a single deviation. Redo Example 1: ∑x=40\sum x=40 and ∑x2=4+16+16+16+25+25+49+81=232\sum x^2=4+16+16+16+25+25+49+81=232, so SS=232−16008=232−200=32SS=232-\frac{1600}{8}=232-200=32. It matches the 3232 found earlier.

The trap is size. When values are large and close together, such as 1002,1004,1005,10091002, 1004, 1005, 1009, the shortcut subtracts two huge numbers and rounding errors creep in. Instead, subtract a convenient constant from every value first. Standard deviation ignores shifts, so use 2,4,5,92, 4, 5, 9 with mean 55:

SS=9+1+0+16=26,s=263≈2.94.SS=9+1+0+16=26,\qquad s=\sqrt{\frac{26}{3}}\approx 2.94.

Before trusting any answer, run these quick sanity checks:

  • The deviations should add to zero.
  • A population standard deviation can never exceed half the range (Example 1: range 77, and 2≤3.52\le 3.5).
  • For roughly bell-shaped data with 20 to 30 values, the range divided by 44 is a decent estimate.

Quick check

Five values have ∑x=30\sum x = 30 and ∑x2=200\sum x^2 = 200. Find the population standard deviation.

What happens to standard deviation when you add or multiply data?

Right triangle with sides 3, 4, 5 showing independent standard deviations combine by Pythagoras, not addition
Variances add, so independent standard deviations of 3 and 4 combine to 5, the hypotenuse, not 7.

Adding the same amount to every value slides the whole data set along the number line without changing the spread. Multiplying every value stretches the spread by that factor. Any rescaling y=ax+by=ax+b follows the pattern, and it is the same shape as a line in slope-intercept form: bb shifts, aa stretches.

Change New mean New standard deviation
Add cc to every value xˉ+c\bar{x}+c ss (unchanged)
Multiply by kk kxˉk\bar{x} ∣k∣ s\lvert k\rvert\, s
Both: y=ax+by=ax+b axˉ+ba\bar{x}+b ∣a∣ s\lvert a\rvert\, s

A city has a mean temperature of 20∘C20^\circ\text{C} with standard deviation 5∘C5^\circ\text{C}. Converting with F=1.8C+32F=1.8C+32 gives a mean of 1.8(20)+32=68∘F1.8(20)+32=68^\circ\text{F} and a standard deviation of 1.8(5)=9∘F1.8(5)=9^\circ\text{F}. The most common error is adding the 3232 to the standard deviation too. Variance, being squared, scales by a2a^2 instead.

A related rule: for independent quantities, variances add, but standard deviations do not. Two independent measurements with standard deviations 33 and 44 combine to 32+42=5\sqrt{3^2+4^2}=5, not 77. It is the Pythagorean theorem in disguise.

How do you find standard deviation from a table or probabilities?

A frequency table lists each value once with a count. Treat the counts as weights: multiply each squared deviation by its frequency, add, and divide by the total count. The mean itself is a weighted average of the values. For a sample, divide by ∑f−1\sum f-1.

For a probability distribution, swap each frequency share for a probability. Use μ=∑xP(x)\mu=\sum xP(x) and

σ=∑(x−μ)2 P(x).\sigma=\sqrt{\sum (x-\mu)^2\,P(x)}.

This connects directly to basic probability, where the same idea is called the expected value and the spread of a random variable.

Example 3. Find the standard deviation of one roll of a fair die. Each of 11 through 66 has probability 16\frac{1}{6}, and μ=3.5\mu=3.5. The deviations are −2.5,−1.5,−0.5,0.5,1.5,2.5-2.5,-1.5,-0.5,0.5,1.5,2.5, with squares 6.25,2.25,0.25,0.25,2.25,6.256.25,2.25,0.25,0.25,2.25,6.25 that add to 17.517.5.

σ2=17.56=3512≈2.917,σ≈1.71\sigma^2=\frac{17.5}{6}=\frac{35}{12}\approx 2.917,\qquad \sigma\approx 1.71

For the consecutive integers 11 to nn, there is a closed form, σ2=n2−112\sigma^2=\frac{n^2-1}{12}, and n=6n=6 gives 3512\frac{35}{12} again. It comes from the sums of consecutive integers, which the arithmetic series formula lesson explains.

Frequencies go inside the sum

In a frequency table, each squared deviation is multiplied by its frequency before you add. Squaring the frequency, or forgetting to multiply, is the usual slip.

What do z-scores and the 68-95-99.7 rule tell you?

A standard deviation becomes a ruler once you use it to measure distance from the mean. The z-score counts how many standard deviations a value sits above (positive) or below (negative) the mean:

z=x−μσz=\frac{x-\mu}{\sigma}

This lets you compare across different scales, as in Practice Problem 4, where a lower raw score can be the stronger result.

For bell-shaped data, about 68%68\% of values fall within 11 standard deviation of the mean, about 95%95\% within 22, and about 99.7%99.7\% within 33. If adult heights in a group average 6666 in with a standard deviation of 33 in, about 68%68\% fall between 6363 and 6969 in. A height of 7272 in has z=2z=2, which is taller than roughly 97.5%97.5\% of the group.

The rule fails for skewed data such as incomes. For any shape of data, Chebyshev’s inequality still guarantees that at least 1−1k21-\frac{1}{k^2} of values lie within kk standard deviations: at least 75%75\% for k=2k=2 and about 89%89\% for k=3k=3. Do not confuse standard deviation with standard error, sn\frac{s}{\sqrt{n}}. Standard deviation describes the spread of the data, while standard error describes how uncertain the sample mean is.

When does standard deviation give a misleading answer?

Squaring makes standard deviation sensitive to outliers. Take 10,10,10,10,10010, 10, 10, 10, 100. The mean is 2828, the four small values sit 1818 below it, and the single outlier sits 7272 above it. The squares are 324×4+5184=6480324\times 4+5184=6480, so

σ=64805=1296=36.\sigma=\sqrt{\frac{6480}{5}}=\sqrt{1296}=36.

The outlier alone supplies 51845184 of the 64806480, or 80%80\%, of the total. A standard deviation of 3636 describes none of those values well. For skewed data, report the median and the interquartile range alongside it.

For data that grows by multiplication, such as populations or prices, take logarithms first. Ratios become differences, and the spread becomes meaningful. The logarithm rules show why: log⁡(ab)=log⁡a+log⁡b\log(ab)=\log a+\log b turns multiplying into adding.

Finally, standard deviation cannot compare variability across different scales. Use the coefficient of variation, sxˉ\frac{s}{\bar{x}}. A group with mean 2020 and standard deviation 44 has 20%20\% relative spread, while a group with mean 200200 and standard deviation 2020 has only 10%10\%, even though its raw standard deviation is five times larger.

Quick check

Group A has mean 2020 and standard deviation 44. Group B has mean 200200 and standard deviation 2020. Which group has more spread relative to its mean?

Practice problems

0 of 5 solved

  1. Find the population standard deviation of 4,6,8,10,124, 6, 8, 10, 12.

  2. Find the sample standard deviation of 2,4,92, 4, 9.

  3. A data set has mean 5050 and standard deviation 88. Every value is multiplied by 33, then 1010 is subtracted. Find the new mean and standard deviation.

  4. Mariam scored 8383 on a test with mean 7171 and standard deviation 44. Jon scored 8888 on a test with mean 7676 and standard deviation 66. Who did better compared with their own class?

  5. A population has the values 1,3,51, 3, 5 with frequencies 2,3,52, 3, 5. Find the population standard deviation.

Common questions

What is the formula for standard deviation?

For a whole population, σ=∑(xi−μ)2N\sigma=\sqrt{\frac{\sum (x_i-\mu)^2}{N}}. For a sample, s=∑(xi−xˉ)2n−1s=\sqrt{\frac{\sum (x_i-\bar{x})^2}{n-1}}. Both take the square root of the average squared distance from the mean.

Why do you divide by n minus 1 for a sample?

The sample mean is calculated from the same data, so the values sit closer to it than to the true population mean. Dividing by n−1n-1 instead of nn corrects that shortfall, so the sample variance is not too small on average.

Can standard deviation be negative?

No. It is a square root of an average of squares, so it is zero or positive. It equals zero only when every value in the data set is identical.

What is the difference between variance and standard deviation?

Variance is the average squared distance from the mean, and standard deviation is its square root. Variance is in squared units (dollars squared), while standard deviation is in the original units (dollars), which makes it easier to interpret.

What counts as a high or low standard deviation?

There is no universal cutoff. Compare the standard deviation with the mean and with the scale of the data. A standard deviation of 5 is huge for test scores out of 10 and tiny for house prices in dollars.

How do you find standard deviation on a calculator or in Excel?

On most graphing calculators, enter the data in a list and read SxS_x for a sample or σx\sigma_x for a population. In Excel and Google Sheets, use STDEV.S for a sample and STDEV.P for a population.

Up next