# Median

### 2008/9 Schools Wikipedia Selection. Related subjects: Mathematics

In Probability theory">probability theory and statistics, a **median** is described as the number separating the higher half of a sample, a population, or a probability distribution, from the lower half. The *median* of a finite list of numbers can be found by arranging all the observations from lowest value to highest value and picking the middle one. If there is an even number of observations, the median is not unique, so one often takes the mean of the two middle values.

Example: X,Y,Z median= Y Example: W,X,Y,Z median = mean(X, Y) = (X+Y)/2

At most half the population have values less than the *median* and at most half have values greater than the median. If both groups contain less than half the population, then some of the population is exactly equal to the median.

## Popular explanation

The difference between the median and the mean is illustrated in this simple example:

Suppose 19 paupers and 1 billionaire are in a room. Everyone removes all the money from their pockets and puts it on a table. Each pauper puts $5 on the table; the billionaire puts $1 billion (i.e. $10^{9}) there. The total is then $1,000,000,095. If that money is divided equally among the 20 people, each gets $50,000,004.75. That amount is the *mean* amount of money that the 20 people brought into the room. But the *median* amount is $5, since one may divide the group into two groups of 10 people each, and say that everyone in the first group brought in no more than $5, and each person in the second group brought in no less than $5. In a sense, the median is the amount that the *typical* person brought in. By contrast, the mean is not at all typical, since nobody in the room brought in an amount approximating $50,000,004.75.

## Measures of statistical dispersion

When the *median* is used as a location parameter in descriptive statistics, there are several choices for a measure of variability: the range, the interquartile range, the mean absolute deviation, and the median absolute deviation. Since the median is the same as the *second quartile*, its calculation is illustrated in the article on quartiles.

Working with computers, a population of integers should have an integer median. Thus, for an integer population with an even number of elements, there are two medians known as *lower median* and *upper median*. For floating point population, the median lies somewhere between the two middle elements, depending on the distribution. Median is the middle most value after arranging data by any order

## Theoretical properties

### An optimality property

The median is also the central point which minimizes the average of the absolute deviations; in the example above this would be (1 + 0 + 0 + 0 + 1 + 7) / 6 = 1.5 using the median, while it would be 1.944 using the mean. In the language of probability theory, the value of *c* that minimizes

is the median of the probability distribution of the random variable *X*. Note, however, that c is not always unique, and therefore not well defined in general.

## Efficient computation

Even though sorting *n* items takes in general O(*n* log *n*) operations, by using a "divide and conquer" algorithm the median of *n* items can be computed with only O(*n*) operations (in fact, you can always find the *k*-th element of a list of values with this method; this is called the selection problem).

## Easy explanation (Statistics)

As an example, we will calculate the median of the following population of numbers: 1, 5, 2, 8, 7.

Start by sorting the numbers: 1, 2, 5, 7, 8.

In this case, 5 is the median, because when the numbers are sorted, it is the middle number. If there is an even amount of numbers, the median is the arithmetic mean of the two middle numbers.