Suppose that the observations in a set of numerical data are ranked in ascending order. Then the (sample) median is the middle observation if there are an odd number of observations; it is the average of the two middlemost observations if there are an even number.
The median of a continuous distribution with probability density function f is any number m such that
In this case the median need not be unique.