# Conditions for uniqueness of the median

A median of a random variable is defined as any $m \in \mathbb{R}$ such that

$P(X \le m) \ge 1/2$ and $P(X \ge m) \ge 1/2$.

Alternatively, in terms of the CDF $F$ of $X$ defined by $F(x) := P(X \le x)$, we need

$F(m) \ge 1/2$ and $F(m^-) \le 1/2$, where the latter is the left limit of $F$ at $m$.

Under what conditions is the median unique? It seems that either

• there should be a point $m$ with $F(m) = 1/2$ such that the CDF is continuous and inceasing in a neighborhood of $m$,
• or there should be a point $m$ where $F(m-) < 1/2$ and $F(m) = 1/2$ and $F$ is increasing on $[m,m+\epsilon)$ for some small $\epsilon > 0$,
• or there should be a point $m$ where $F(m-) < 1/2$ and $F(m) > 1/2$.

Are these all the possibilities?

• you don't need to say that CDF is increasing, it's part of its definition (or its properties) Jan 14, 2015 at 21:50
• He probably means "strictly increasing." Jan 14, 2015 at 22:03
• Yes, I mean strictly increasing. Jan 15, 2015 at 0:03
• If it is strictly increasing at $m$, why does it have to be continuous? Jan 28, 2015 at 18:14
• @Henry: It is just one way to state a set of necessary and sufficient conditions. $F$ is either continuous or not at a potential median $m$. In the first case it has to be strictly increasing for unqiueness (it seems). Otherwise, one imposes other conditions, e.g. like the ones I mentioned. Jan 28, 2015 at 22:01

$\lambda(F_X^{-1}(0.5))=0 \iff X\text { is unique }$, where $\lambda()$ is the lebesgue measure and $F^{-1}()$ is the inverse image of the CDF. This condition implies that $\lambda[ \{x:P(X\leq x)\geq 1/2\}\cap\{x: P(X\geq x)\geq 1/2\}]=0$

• The condition at the end doesn't seem to be necessary. (For the earlier one, how do you define $F^{-1}$? Is it the inverse image, the quantile function, ?) For example, consider a distribution that put 1/3 mass at each of the distinct points $\{a,b,c\}$ and assume $a < b < c$. Then, $b$ is the unique median. The CDF is not strictly increasing here. Jan 28, 2015 at 0:57
• @passerby51 I've modified my last sentence, as it simply implies the first condition.
– user76844
Jan 28, 2015 at 13:27
• @passerby51 I also tightened my first line, since $\epsilon\geq 0$ by necessity of $m$ being a median.
– user76844
Jan 28, 2015 at 13:31
• Regarding my example, am I missing something? I agree that $F$ is right-continuous. But from the definition, for $m$ to be median we need $F(m) \ge 1/2$ which holds for $m \in [b,c)$ and we need $F(m^{-}) \le 1/2$ which only holds for $b$. ($F(b^-) = 1/3$ while $F(x^-) = 2/3$ for $x \in (b,c)$.) Jan 28, 2015 at 16:30
• @passerby51 ah, yes...you are correct, and indeed there is not a neighborhood around $b$ that also satisfies the median, per my condition. Ill remove my comments.
– user76844
Jan 28, 2015 at 17:21

For absolutely continuous radom variables you always have a unique median. Indeed, let $F$ denote the distribution function of a continuous random variable $X$, and $f$ its density function. We have $$F(x) = \int_{-\infty}^x f(y)dy.$$ The median is given by the value $x^\ast$ such that $$F(x^\ast)=1/2.$$

Definte the function $G(x) := F(x) - 1/2$. We have (by the Properties of distribution functions) $$\lim_{x\to -\infty} G(x) = -1/2, \, \mbox{and} \, \lim_{x\to \infty}G(x) = 1/2$$ hence by Bolzano's theorem (aka Intermediate value theorem) there is a value $x^\ast \in (-\infty,\infty)$ such that $G(x^\ast)=0$, hence $x^\ast$ is a median. It is unique since $$G'(x) = F'(x) = f(x)\geq 0.$$

• Thanks. That is fine, but I want all the cases where it is unique. A set of necessary and sufficient conditions. For example, it is enough for it to be continuous and strictly increasing around $F(x) = 1/2$. Jan 24, 2015 at 18:30
• if $f(x)=0$ in an interval containing $x^*$ then the median may not be unique Jan 31, 2018 at 15:26
• "It is unique since $G'(x) = F'(x) = f(x) \geq 0$" doesn't work, you need $f(x^*) > 0$. Sep 11 at 21:47

I would have thought you need a point $m$ such that $$\left(\tfrac12-F(m-\delta)\right)\left(F(m+\delta)-\tfrac12\right)\gt 0 \text{ for all } \delta \gt 0$$

You could split this into either of

1. $F(m)=\tfrac12$ and $F(x)$ is strictly increasing at $x=m$
2. $F(m) \gt \tfrac12$ and $F(x)\lt \tfrac12$ for all $x \lt m$

perhaps splitting (2) into

1. $F(m) \gt \tfrac12$ and $\displaystyle \lim_{x\nearrow \,m-} F(x)\lt \tfrac12$
2. $F(m) \gt \tfrac12$ and $\displaystyle \lim_{x\nearrow \,m-} F(x)= \tfrac12$ and $F(x)\lt \tfrac12$ for all $x \lt m$
• Thanks. Your first condition isn't necessary, at least with strict inequality. We could have a median for which $F$ is identically equal to $1/2$ in its neighborhood. For example, uniform distribution on $\{-1,1\}$ has all the points in $[-1,1]$ as its median, but for all the points $(-1,1)$ the CDF is $1/2$ in a neighborhood of the median. Jan 28, 2015 at 16:42
• @passerby: If your example has all the points in $[−1,1]$ as its median then I would have thought the median would not be unique. Perhaps I have misunderstood what you are saying. Jan 28, 2015 at 18:12
• Yes, based on the definition of the median I mentioned, which is the standard one in probability theory, that is the set of medians for a probability distribution with 1/2 mass at each of -1 and +1. Jan 28, 2015 at 22:00
• @passerby51: OK, but that example fails all my tests, as I would expect if the median is not unique. Jan 28, 2015 at 22:02
• I think my first line is both necessary and sufficient for a unique median Jan 28, 2015 at 22:09

The following conditions guarantee the exsitence of a unique median

$1.$ CDF of the random variable $X$ is continuous.

$2.$ CDF of the random variable $X$ is strictly increasing.

Let $$a(m)=\int_{-\infty}^{m}f_X(x)\mathrm{d}x,\quad \mathcal{A}=\{m:a(m)\geq 1/2\}$$ and $$b(m)=\int_{m}^{\infty}f_X(x)\mathrm{d}x,\quad \mathcal{B}=\{m:b(m)\geq 1/2\}$$

If $a(m^*)=1/2$ for some $m^*$ then, $a(m)\geq 1/2$ for $m\geq m^*$ because $a$ is an increasing function.

Simlarly, if $b(m^{**})=1/2$ for some $m^{**}$ then, $b(m^{**})\geq 1/2$ for $m\leq m^{**}$ because $b$ is a decreasing function.

Hence, $$m^{**}\geq m\geq m^*\quad\quad (1)$$

We also know what $b(m)=1-a(m)\forall m$. Assume $m=m^{**}$. Then $$1/2=b(m^{**})=1-a(m^{**})=1-a(m^{*})$$ which implies $$a(m^{*})=b(m^{**})=1/2$$ Since both $a$ and $b$ are continuos. They intersect only at a single point at the co-domain of the CDF (even if the functions are non-increasing, non-decreasing type). If $a$ and $b$ are strictly increasing (decreasing resp.) functions, then the domain of intersection is also a single point, which is $m^*=m^{**}$. With this result Equation $1$ is also a single point and we are done.

• Can you find an example where the CDF is strictly increasing in an open neighbourhood of a median $m$ but not continuous at $m$, where $m$ is not the unique median? In other words, why do you need (left-)continuity? Jan 31, 2018 at 15:24

From the definitions

$$P(X \le m) \ge \frac12 \land P(X \ge m) \ge \frac12,$$ $$F(x) := P(X \le x),$$ we infer $$F(m)\ge \frac12\land 1-F(m)+P(X=m)\ge\frac12,$$ hence $$\frac12\le F(m)\le\frac12+P(X=m).$$ The solution set is $m\in F^{-1}([\frac12,\frac12+P(X=m)])$.

For continuous distributions, $F^{-1}(\frac12)$. $F$ must be injective for the image $\frac12$.

• Thanks. I believe, the interval should be closed $[1/2,1/2+P(X=m)]$. Jan 30, 2015 at 2:30
• @passerby51: right, I am fixing that (and adding a missing parenthesis !).
– user65203
Jan 30, 2015 at 7:42