# Definition:Median (Statistics)

This page is about Median in the context of Statistics. For other uses, see Median.

## Definition

Let $S$ be a set of quantitative data.

Let $S$ be arranged in order of size.

The median is the element of $S$ that is in the middle of that ordered set.

Suppose there are an odd number of elements of $S$ such that $S$ has cardinality $2 n - 1$.

The median of $S$ in that case is the $n$th element of $S$.

Suppose there are an even number of elements of $S$ such that $S$ has cardinality $2 n$.

Then the middle of $S$ is not well-defined, and so the median of $S$ in that case is the arithmetic mean of the $n$th and $n + 1$th elements of $S$.

### Continuous Random Variable

Let $X$ be a continuous random variable on a probability space $\struct {\Omega, \Sigma, \Pr}$.

Let $X$ have probability density function $f_X$.

A median of $X$ is defined as a real number $m_X$ such that:

$\ds \map \Pr {X < m_X} = \int_{-\infty}^{m_X} \map {f_X} x \rd x = \frac 1 2$

That is, $m_X$ is the first $2$-quantile of $X$.

## Examples

### Arbitrary Example $1$

Let $S = \set {1, 7, 31}$ be a set of raw data.

The median of $S$ is $7$.

### Arbitrary Example $2$

Let $S = \set {2, 5, 9, 16}$ be a set of raw data.

The median of $S$ is $\dfrac {5 + 9} 2 = 7$.

## Also see

• Results about medians can be found here.