Why Measure Distance From a Center?
A center is one number used to represent a collection of observations. One way to judge a proposed center is to add up how far each observation lies from it. If distance is measured by absolute difference, this total is smallest when the proposed center is a median. This fact gives a precise reason for using the median as a summary of location, especially when an unusually distant observation could pull a center away from much of the data.
The question here is not how to find a median from scratch. It is why the median has this minimizing property. The key idea is to order the observations and pair values from opposite ends: moving a proposed center toward one observation in a pair moves it away from the other. The balance of these changes determines where the total distance is smallest.
The observations are treated as fixed, and each contributes once to the sum. There is no probability model or sampling assumption needed for this result. Also, minimizing the sum \(D(a)\) is equivalent to minimizing the average absolute deviation \(D(a)/n\): division by the fixed positive number \(n\) does not change which values of \(a\) give the minimum.
How a Pair of Observations Constrains the Center
Consider two ordered observations \(y\le z\). Their combined contribution to the total is \(|y-a|+|z-a|\). If \(a\) lies between them, one distance gets shorter by exactly as much as the other gets longer, so the sum stays equal to \(z-y\). If \(a\) lies outside their interval, both distances together exceed \(z-y\).
This result follows directly by considering where \(a\) lies. Between \(y\) and \(z\), the sum is \((a-y)+(z-a)=z-y\). If \(a<y\), the sum is \((y-a)+(z-a)=z-y+2(y-a)\), which is larger than \(z-y\). If \(a>z\), it is \((a-y)+(a-z)=z-y+2(a-z)\), also larger. The paired observations therefore have a flat range of best centers, and the ordered middle observations determine which ranges overlap.
Worked Examples
Worked Example: An Odd Number of Observations
Suppose five hypothetical commute times, in minutes, are \(2,4,5,9,12\). Find the total absolute deviation at the median and compare it with the total at another proposed center.
The values are already ordered, and the middle observation is \(5\) minutes. At \(a=5\), $$ D(5)=|2-5|+|4-5|+|5-5|+|9-5|+|12-5| =3+1+0+4+7=15\text{ minutes}. $$
At the alternative center \(a=6\) minutes, $$ D(6)=|2-6|+|4-6|+|5-6|+|9-6|+|12-6| =4+2+1+3+6=16\text{ minutes}. $$
The median gives a smaller total: 15 rather than 16 minutes. Pairing the outside values makes the reason visible. The pair \(2,12\) has a minimum combined distance of \(10\) minutes for any center from 2 to 12; the pair \(4,9\) has a minimum of 5 minutes for any center from 4 to 9. The remaining middle value, 5, contributes \(|5-a|\), which is smallest at \(a=5\). Since both pairs include 5 in their minimizing ranges, the total is minimized at 5.
Worked Example: More Than One Minimizer
Consider the hypothetical ordered measurements \(1,3,7,10\), in centimeters. The two middle values are 3 and 7, so the conventional median is their midpoint, 5 centimeters. Check the total absolute deviation at the lower middle value, at the conventional median, and at the upper middle value.
At \(a=3\) centimeters, $$ D(3)=|1-3|+|3-3|+|7-3|+|10-3| =2+0+4+7=13\text{ centimeters}. $$ At \(a=5\) centimeters, $$ D(5)=|1-5|+|3-5|+|7-5|+|10-5| =4+2+2+5=13\text{ centimeters}. $$ At \(a=7\) centimeters, $$ D(7)=|1-7|+|3-7|+|7-7|+|10-7| =6+4+0+3=13\text{ centimeters}. $$
In fact, every center from 3 to 7 centimeters gives this same total. Pair \(1\) with \(10\), and pair \(3\) with \(7\). The first pair's minimum total is \(10-1=9\) centimeters whenever \(a\) is between 1 and 10; the second pair's minimum is \(7-3=4\) centimeters whenever \(a\) is between 3 and 7. Any \(a\) in the shared interval from 3 to 7 minimizes both pairs, giving \(9+4=13\) centimeters. A center outside that interval makes the pair \(3,7\) contribute more than 4, so it cannot give a smaller overall total.
The midpoint, 5 centimeters, is the usual reported median for an even number of observations, but it is not the only minimizer of total absolute deviation. Every point between the two middle observations has the same minimum total.
The General Result and Its Justification
For an odd number of observations, the middle value is the unique minimizer. For an even number, the full interval between the two middle values consists of minimizers. The pairing argument proves both statements, including why no center outside the stated value or interval can do better.
- If \(n=2k+1\), the single value \(x_{(k+1)}\).
- If \(n=2k\), every value \(a\) in the interval \([x_{(k)},x_{(k+1)}]\).
Pair \(x_{(1)}\) with \(x_{(n)}\), \(x_{(2)}\) with \(x_{(n-1)}\), and continue inward. Each pair contributes a sum of two absolute distances.
For a pair \(y\le z\), its contribution is at least \(z-y\), with equality whenever \(a\in[y,z]\). The center must lie within a pair's interval to minimize that pair.
When \(n=2k\), every end-pair interval contains \([x_{(k)},x_{(k+1)}]\). All pairs reach their minimum throughout that interval. Outside it, the middle pair \(x_{(k)},x_{(k+1)}\) has a strictly larger contribution, while no other pair can contribute less than its own minimum.
When \(n=2k+1\), pair the outside observations inward, leaving \(x_{(k+1)}\) unpaired. Every pair's interval contains this middle value, so all pairs are minimized there. The unpaired contribution \(|x_{(k+1)}-a|\) is minimized only at \(a=x_{(k+1)}\). Moving away cannot reduce a pair below its minimum, and it increases this remaining contribution.
This is a complete justification: it establishes both that the stated center or centers attain a minimum and that no other proposed center can produce a smaller total. Ties among the observations cause no problem. If the two middle values are equal in an even-sized set, the minimizing interval has just one point; otherwise it contains multiple minimizing centers.
Worked Example: Repeated Middle Values and an Extreme Observation
Suppose six hypothetical package weights, in grams, are \(2,2,4,9,9,20\). The two middle observations are 4 and 9, so every center from 4 to 9 grams should minimize the total absolute deviation. Verify the result at \(a=6\) grams and compare with a center outside the interval.
At \(a=6\) grams, $$ D(6)=|2-6|+|2-6|+|4-6|+|9-6|+|9-6|+|20-6| =4+4+2+3+3+14=30\text{ grams}. $$
Pair the observations as \((2,20)\), \((2,9)\), and \((4,9)\). Their minimum contributions are \(18\), \(7\), and \(5\) grams, respectively, for a total of \(18+7+5=30\) grams. Each pair reaches its minimum for every center between its two values. Their intervals overlap from 4 to 9 grams, so all three pairs reach their minimum for any center in that range.
At \(a=10\) grams, which lies above the interval, $$ D(10)=8+8+6+1+1+10=34\text{ grams}. $$ The pair \((4,9)\) now contributes \(6+1=7\) grams, which is greater than its minimum of \(5\) grams. The other pairs cannot fall below their own minima, so the total is greater than 30 grams. The large observation of 20 grams affects the numerical minimum total, but it does not shift the interval of minimizing centers beyond the two middle observations.
What the Result Does—and Does Not—Say
The theorem concerns one particular objective: the sum of absolute distances from the observations to a proposed center. The median is optimal for that objective. It does not say that the median is the only reasonable summary in every situation, or that all ways of measuring distance select the same center. The choice of summary depends on what a data description needs to emphasize, as discussed in choosing between mean and median summaries.
The units also help keep the calculation clear. If observations are measured in centimeters, each absolute deviation and their sum are measured in centimeters. The sum grows with the number of observations, so its size is best understood for the fixed data set being analyzed. Dividing by \(n\) gives the average absolute distance, which has the same units and the same minimizing center or centers.
Common Mistakes
- Assuming the midpoint is the only best center for even \(n\). The midpoint is the conventional median, but all values from \(x_{(k)}\) to \(x_{(k+1)}\) minimize the total.
- Comparing only a few candidate centers and treating that as a proof. Several calculations can illustrate the result, but the pairing argument is what establishes the minimum for every possible real center.
- Using signed differences instead of absolute distances. The sum \(\sum(x_i-a)\) allows positive and negative differences to cancel. Total absolute deviation uses \(\sum|x_i-a|\), so every observation contributes a nonnegative distance.
- Claiming an extreme observation has no effect. An extreme value contributes to the total distance and can change its minimum value. The theorem says the minimizing center is determined by the middle observation or observations, not that extremes are irrelevant to every calculation.
Check Your Understanding
For each question, focus on the total absolute deviation and the location of its minimizer.
- For the ordered values \(1,4,8\), calculate the total absolute deviation at the median. What happens to the total if the proposed center moves one unit to the right?
- For the ordered values \(2,5,11,14\), state the full interval of minimizing centers. What is the conventional median?
- Explain why, for two observations \(y\le z\), any center between them minimizes their combined absolute distance.
- If the two middle observations in an even-sized set are equal, how many distinct minimizing centers are there?
- A learner says, “I checked the total at the median and at one other center, so I have proved the median is best.” What is missing from this reasoning?