If a set of numerical data has n elements and is arranged in order so that either
then the median is if n is odd, and if n is even.
For example, the time intervals (in minutes, to the nearest minute) between the eruptions of Old Faithful on 1 August 1978 were![median](Images/oree/doc/10.1093/acref/9780199679188.001.0001/acref-9780199679188-math-0404-full.gif)
Arranging these thirteen values in order, we get
to give a median of 75 minutes. For 4 August 1978, there were fourteen inter-eruption times, which arranged in order were
so that the median is (73+75)=74.
Alternatively, an approximate value for the median can be read from a cumulative frequency graph as the value of the variable corresponding to a cumulative relative frequency of 50%.
For a continuous random variable X, the median m of the distribution is such that P(X≤m)=. For a discrete random variable taking values x1<x2<…, the median is xi if P(X<xi)< and P(X>xi)<, and it is (xi+xi+1) if P(X≤xi)= and P(X≥xi+1)=. See also percentile; quartile.