MathorynMathematical Formula Database

Statistics & Probability

Median

The median is the middle value of the data sorted in increasing order, or the mean of the two middle values when nn is even. Unlike the mean, it is robust to outliers. Use it to describe typical incomes or house prices, where a few extreme values would distort the mean.

median={x(n+12)n oddx(n2)+x(n2+1)2n even\text{median}=\begin{cases}x_{\left(\frac{n+1}{2}\right)} & n\text{ odd}\\[4pt] \dfrac{x_{\left(\frac{n}{2}\right)}+x_{\left(\frac{n}{2}+1\right)}}{2} & n\text{ even}\end{cases}
LaTeX\text{median}=\begin{cases}x_{\left(\frac{n+1}{2}\right)} & n\text{ odd}\\[4pt] \dfrac{x_{\left(\frac{n}{2}\right)}+x_{\left(\frac{n}{2}+1\right)}}{2} & n\text{ even}\end{cases}

Variables

x(k)x_{(k)}
the k-th smallest value
nn
number of values

Example

Find the median of 3,9,4,7,53,9,4,7,5 and of 3,9,4,7,5,103,9,4,7,5,10.

  1. Sorted: 3,4,5,7,93,4,5,7,9; the 3rd value is 55.
  2. Sorted: 3,4,5,7,9,103,4,5,7,9,10; 5+72=6\frac{5+7}{2}=6.

Answer: Medians 55 and 66.

Related formulas