The mean minimises squared distance to all points, so a single far-away point exerts enormous pull — squared error punishes distance quadratically.
The median minimises absolute distance; an outlier counts as just one more vote, not a louder one.
Variance uses n−1 (Bessel's correction) on samples because the sample mean already 'used up' one degree of freedom.
Report mean ± std for symmetric data; switch to median + IQR the moment the histogram has a long tail (income, house prices, delivery times).
In the Test Kitchen below: add one banquet platter and watch the ±1 std bracket explode while the median holds.
Don't just read the recipe — taste it. Drag, click and break things below.
Each dot is a thali on the scale. Click the paper to add plates, click a plate to remove it. Then add one absurd 950g banquet platter: the mean (purple) chases the outlier, the median(teal) holds its ground, and the standard-deviation bracket blows wide open. Robustness is a choice.
FIG L.3: CENTRAL TENDENCY — THE MEAN FOLLOWS OUTLIERS, THE MEDIAN RESISTS (BESSEL n−1 STD)
import numpy as np plates = np.array([180, 220, 240, 260, 280, 300, 320, 360]) print(plates.mean(), np.median(plates)) # 270.0 270.0 — they agree plates = np.append(plates, 950) # one banquet platter print(plates.mean()) # 345.6 — mean got dragged print(np.median(plates)) # 280.0 — median barely moved print(plates.std(ddof=1)) # Bessel's n-1: sample std