126 and 01239
👉 The sets 1, 2, 6 and 0, 1, 2, 3, 9 are fun because their arithmetic mean is an integer. And 01239 is slightly more fun: both median and mean are inside the set.
📖 A well known fact: if you look for a point that minimizes the total distance Σ |xᵢ − a|you end up with the median. The explanation is also intuitive. Imagine these numbers are coordinates of houses, and you want to place a transformer station. You want to minimize the total length of wires. (I like a transformer station more than the legendary postman: a postman who can carry only one package at a time feels… suspicious.) If there are more houses on the right, it’s profitable to move the station to the right; if more on the left — move left. Equilibrium happens when the counts on both sides are equal. That’s the median.
But the “sum of squares” story always felt less obvious to me: Σ (xᵢ − b)²
🦴 Straight physical system is a net of springs which connect a nail (what?!!) with all houses. In this case physics is quite trivial — this mythic nail would be placed in the position where all forces are in an equilibrium and, by definition of forces through potential energy, sum of squared distances is minimized.
⚛️ This model looks totally awkward to me now. When I was young this analogy looked great. But now it stopped clicking. Springs have finite length and it's hard imagine nail connected with houses by springs. Probabilities are totally different thing. We all want to live in an universe with high probability. It's a respectable place in the middle of multiverse. So, if x1, ..., xn are samples and you want a single “most representative” number, you can assume the source distribution is Gaussian. Then maximizing likelihood is the same as minimizing the sum of squared errors — and the answer becomes the mean. Much more natural than a city-wide spring spiderweb.
