Spread and standard deviation
The "Mama John's" chain has grown to two locations. The average salary at both is exactly 35k: at pizzeria A everyone earns roughly the same, at pizzeria B some earn much less, some much more. Same mean β completely different teams. To catch that difference you need a second characteristic: how far the values scatter around the center.
Two pizzerias, both with an average salary of exactly 35k β the dashed line sits in the same spot in both rows. But the points of Pizzeria B are scattered noticeably wider than A's. To the right of each row is its Ο ("sigma"), the measure of spread this whole lesson is about.
Back to our two pizzerias. Both have the same average salary β 35k β but Ο is about 6 at Pizzeria A and about 14 at Pizzeria B. The center coincides, yet life inside is completely different: at Pizzeria A salaries are predictable and stay close together, at Pizzeria B the gap between people is huge.
Hence the main takeaway of the lesson: the center is almost never looked at alone. "Mean plus spread" is the minimal honest pair that describes data: where it concentrates and how widely it diverges around that center.
Spread is everywhere that not only the magnitude but also the stability matters. Two couriers deliver in 30 minutes on average, but one stays within 25β35 while the other jumps from 10 to 60: same mean, different reliability β and Ο shows it at once.
The same underlies the volatility of stocks (that is the Ο of returns: the larger, the riskier) and quality control in manufacturing, where "beyond 3Ο" is treated as a defect (why exactly 3 β we'll see in the normal distribution lesson).
Next we'll look at what shapes data takes at all. There the mean and Ο come into their own together: for a bell-shaped, "normal" distribution they almost fully define it.
Definitions
Standard deviation relies on the mean, so it inherits its weakness: one strong outlier inflates Ο so much that the "typical spread" stops describing typical data. For skewed quantities (incomes, response times) it is more honest to look at spread through percentiles.
Deep dive: the math and the mechanism (optional)
Working through the derivation below isn't required. For practice, one fact is enough to remember: if you're computing variance or Ο on a sample (which is almost always the case), the denominator should be nβ1, not n.
The formula in the definition above is for the whole population, where the mean is known in advance and doesn't depend on the data itself. In practice, though, we compute the mean from the very same sample we're measuring spread on, and that quietly fits the data to its own mean. Because of this, the sum of squared deviations comes out a bit smaller than it honestly should be, and the /N formula systematically underestimates the population's spread.
To remove this bias, sample variance uses nβ1 in the denominator instead of n. One way to see why: once you've fixed the mean from n values, only nβ1 of them are free to vary β the last one is already determined, since you can always back it out from the rest plus the mean. Hence the name: degrees of freedom.
This is exactly why the same numbers sometimes give a different Ο in different tools. Excel and pandas divide by nβ1 by default (the sample calculation), while numpy divides by n by default, and you have to explicitly ask for nβ1. It's not a bug or a discrepancy β it's two different questions: how spread out is THIS data (n), or what does this data say about spread in the whole population (nβ1). In analytics you almost always need the second answer.