# Inverse Cumulative Distribution Function (Quantile Function) In this post we discuss some properties of the inverse cumulative distribution function (cdf) of a real-valued random variable. Let $X:(\Omega, \Sigma, \mathbb{P})\to \mathbb{R}$ be a random variable. Its cdf $F:\mathbb{R}\to [0,1]$ is defined by $$ F_X(x):=\mathbb{P}(X\leq x). $$ It is standard that $F$ is non-decreasing, right continuous, and satisfies $$\lim_{x\to -\infty}F_X(x)=0 \hspace{2pt} , \hspace{5pt} \lim_{x\to \infty}F_X(x)=1.$$ The inverse cdf or the quantile function $F^{-1}_X:(0,1)\to\mathbb{R}$ of $X$ is defined by $$F^{-1}_X(t):=\inf\hspace{2pt} \{x\in\mathbb{R} : F_X(x)\geq t\} = \sup\hspace{2pt} \{x\in\mathbb{R} : F_X(x)<t\},$$ and we use the convention that $\inf \varnothing=\infty$ and $\sup\varnothing=-\infty$ to define $F^{-1}(0)$ and $F^{-1}(1)$ when necessary (note that $F_X$ is not invertible in general). When there is no risk of confusion we drop the subscript and write $F$ and $F^{-1}$. ## Basic properties of quantile function Let $X$ be a random variable with cdf $F$. Then 1. $F^{-1}$ is non-decreasing. 2. $F^{-1}(F(x))\leq x$ for all $x\in\mathbb{R}$. 3. $F(F^{-1}(t))\geq t$ for all $t\in[0,1]$. 4. $F^{-1}(t)\leq x$ if and only if $t\leq F(x)$. 5. For any uniform random variable $U$ on $(0,1)$ we have $F_{F^{-1}(U)}=F$. (This gives a way to construct a random variable with a given distribution.) 6. $F^{-1}$ is left-continuous. Note that by 3. the infimum in the definition is attained, i.e. $\{s\in\mathbb{R}: F(s)\geq t\} = [ F^{-1}(t), \infty)$. ### Proof 1. Let $0\leq t_1 \leq t_2\leq 1$. Since $\{x:F(x)\geq t_2\} \subseteq \{x:F(x)\geq t_1\}$, and by the definition of $F^{-1}$ we have $F^{-1}(t_1)\leq F^{-1}(t_2)$. 2. Note that $x\in \{s\in\mathbb{R}: F(s)\geq F(x)\}=:A$ and hence $x\geq \inf A = F^{-1}(F(x))$. 3. Let $B:=\{x\in\mathbb{R}: F(x)\geq t\}$. Since $F^{-1}(t)=\inf B$ there exists a non-increasing sequence $x_n\in B$ converging to $F^{-1}(t)$. Thus $F(x_n)\geq t$ for all $n\in\mathbb{N}$, so by 1. and the right continuity of $F$ we have $$F(F^{-1}(t))= \lim_{n\to\infty} F(x_n)\geq t.$$ 4. If $F^{-1}(t)\leq x$ then by 3. we have $t\leq F(F^{-1}(t))\leq F(x)$. If $t\leq F(x)$ then by 1. and 2. we have $F^{-1}(t)\leq F^{-1}(F(x))\leq x$. 5. By 4. we have $F_{F^{-1}(U)}(x)=\mathbb{P}(F^{-1}(U)\leq x)=\mathbb{P}(U\leq F(x)) = F(x)$ for $x\in\mathbb{R}$. 6. Fix $t\in (0,1)$. For any $\epsilon>0$ and $y<t$, since $F^{-1}(y)$ is an infimum, there exists $s\in \mathbb{R}$ with $F(s)\geq t$ (i.e. $s\geq F^{-1}(t)$) such that $F^{-1}(y)\leq s < F^{-1}(y)+\epsilon$. Note that $y<t\Rightarrow F^{-1}(y)\leq F^{-1}(t)$ and therefore $$F^{-1}(y) \leq F^{-1}(t)\leq s < F^{-1}(y)+\epsilon.$$ Letting $y\nearrow t$ and noting that $\epsilon$ is arbitrary, the claim is proved. ## Integral of quantile function is expectation Let $X:(\Omega, \Sigma, \mathbb{P})\to \mathbb{R}$ be Borel measurable. If $X\geq 0$ almost surely or $X\in L^1(\mathbb{P})$, then $$\mathbb{E}[X] = \int_0^1 F^{-1}(t)dt.$$ In fact, for measurable $g$ such that $g(X)\in L^1(\lambda)$ we have $$\mathbb{E}[g(X)]=\int_0^1 g(F^{-1}(t))dt.$$ In particular, if $X\in L^p(\Omega, \Sigma, \mathbb{P})$ then $F^{-1}\in L^p((0,1), \mathcal{B}((0,1)), \lambda\vert_{(0,1)})$ for $p\geq 1$. ### Proof By property 5. above, $X$ has the same distribution as $F^{-1}(U)$ where $U\sim\text{Unif}(0,1)$, and therefore $$\mathbb{E}[g(X)] = \mathbb{E}[g(F^{-1}(U))] = \int_0^1 g(F^{-1}(t)) dt.$$ ### Another Perspective Assume $X\geq 0$ almost surely. On the one hand, by Tonelli's theorem, $$\mathbb{E}[X] = \mathbb{E} \int_0^\infty \chi_{\{t<X\}}(t)dt = \int_0^\infty \mathbb{E} \chi_{\{t<X\}}(t)dt = \int_0^\infty \mathbb{P}(X>t)dt = \int_0^\infty 1-F(t) dt. $$ On the other hand, for $t\in (0,1]$ we have $$F^{-1}(t) = \sup \hspace{2pt} \{x\in\mathbb{R}: F(x)>t\} = \int_0^\infty \chi_{\{F(x)<t\}} (x) dx, $$ so again by Tonelli's theorem, $$\int_0^1 F^{-1}(t)dt = \int_0^\infty\int_0^1 \chi_{\{F(x)<t\}} (x) dt dx = \int_0^\infty\int_{F(x)}^1 dt dx =\int_0^\infty 1-F(x) dx, $$ from which the first formula follows. One can easily extend this formula to the case $X\geq -N$ a.s. for some $N>0$, since $X+N\geq 0$ a.s. and $F^{-1}_{X+N} = F^{-1}_X + N$. Finally, for $X\in L^1(\mathbb{P})$, let $X_n=\chi_{[-n,\infty)}X$. By the dominated convergence theorem, $$\mathbb{E}[X]=\lim_{n\to\infty} \mathbb{E}[X_n] = \lim_{n\to\infty} \int_0^1 F^{-1}_{X_n}(t)dt.$$ Recall that almost sure convergence implies convergence in distribution, which is equivalent to $F_{X_n}\to F_X$ on $\mathbb{R}\setminus D_1$ where $D_1$ is the set of discontinuities of $F_X$. It can be shown that this condition implies that $F^{-1}_{X_n}$ converges to $F^{-1}_X$ on $\mathbb{R}\setminus D_2$ where $D_2$ is the set of discontinuities of $F^{-1}_X$ (see below). (Note that $D_1$ and $D_2$ are countable because $F_X$ and $F^{-1}_X$ are monotone). Finally, apply dominated convergence theorem to conclude that $$\mathbb{E}[X]=\lim_{n\to\infty} \int_0^1 F^{-1}_{X_n}(t)dt=\int_0^1 F^{-1}_{X}(t)dt,$$ where we used the fact that the qunatile functions in the integrals are in $L^1((0,1))$ (which follows from the first proof; if one can prove this independently, this would offer an alterative proof for the formula). ## Convergence in distribution implies convergence of quantile function on points of continuity Denote by $F_n$ and $F$ the cdf of $X_n$ and $X$ respectively, with quantile functions $F^{-1}_n$ and $F^{-1}$. Denote the points of discontinuities of $F$ and $F^{-1}$ by $D_1$ and $D_2$ respectively. It is standard that $X_n$ $(n\in\mathbb{N})$ converges to $X$ in distribution iff $F_n$ converges to $F$ on $\mathbb{R}\setminus D_1$. We show that if $X_n$ $(n\in\mathbb{N})$ converges to $X$ in distribution then $F^{-1}_n$ converges to $F^{-1}$ on $(0,1)\setminus D_2$. ### Proof It suffices to show that for $t\in (0,1)\setminus D_2$ we have $$F^{-1}(t) \leq \liminf_{n\to\infty} F^{-1}_n(t) \text{ and } \limsup_{n\to\infty} F^{-1}_n(t) \leq F^{-1}(t).$$ First, let $y<F^{-1}(t)$ (i.e. $F(y)<t$) such that $y\notin D_1$. Since $F_n(y)\to F(y)$, we have $F_n(y)<t$ (i.e. $y<F_n^{-1}(t)$) for $n$ sufficiently large. Thus $$\liminf_{n\to\infty} F^{-1}_n(t)\leq y$$ and the first inequality follows by taking $y\nearrow F^{-1}(t)$ in $\mathbb{R}\setminus D_1$. Next, for $\epsilon>0$ by the assumption $t\notin D_2$ there exists $\delta>0$ such that for $t'\in (t, t+\delta)$ we have $F^{-1}(t)\leq F^{-1}(t')<F^{-1}(t)+\epsilon$ . For any $z\notin D_1$ with $F^{-1}(t')<z<F^{-1}(t)+\epsilon$ we have $$t <t' \leq F(F^{-1}(t')) \leq F(z),$$ and since $F_n(z)\to F(z)$ we have $F_n(z)> t \implies z\geq F^{-1}_n(t)$ for n sufficiently large. Thus $$\limsup_{n\to\infty} F^{-1}_n(t)\leq z$$ and letting $z\searrow F^{-1}(t')$ in $\mathbb{R}\setminus D_1$ we have $$\limsup_{n\to\infty} F^{-1}_n(t)\leq F^{-1}(t')<F^{-1}(t)+\epsilon. $$ Since $\epsilon$ is arbitrary the second inequality follows.