In probability theory and statistics, a median is a number dividing the higher half of a sample, a population, or a probability distribution from the lower half. 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.
To find the median of a finite list of numbers, arrange all the observations from lowest value to highest value and pick the middle one. If there are an even number of observations, one often takes the mean of the two middle values.
Suppose 19 paupers and one billionaire are in a room. Everyone removes all money from their pockets and puts it on a table. Each pauper puts $5 on the table; the billionaire puts $1 billion (that is, $109) there. The total is then $1,000,000,095. If that money is divided equally among the 20 persons, each gets $50,000,004.75. That amount is the mean (or "average") amount of money that the 20 persons brought into the room. But the median amount is $5, since one may divide the group into two groups of 10 persons 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 (or "average") is not at all typical, since no one present—pauper or billionaire—brought in an amount approximating $50,000,004.75.
There may be more than one median: for example if there are an even number of cases then there is no unique middle value. Notice, however, that at least half the numbers in the list are less than or equal to either of the two middle values, and at least half are greater than or equal to either of the two values, and the same is true of any number between the two middle values. Thus either of the two middle values and all numbers between them are medians in that case.
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, and the absolute deviation. Since the median is the same as the second quartile, its calculation is illustrated in the article on quartiles. To obtain the median of an even number of numbers, find the average of the two middle terms.
When there is an odd number of numbers, the median is simply the middle number. For example, the median of 2, 4, and 7 is 4.
When there is an even number of numbers, the median is the mean of the two middle numbers. Thus, the median of the numbers 2, 4, 7, 12 is (4+7)/2 = 5.5.