Solution (source code)

= Solution

The <empirical distribution function> gives each observation mass $1/n$:
$$
\widehat F_n(x)=\frac1n\sum_{i=1}^n\mathbf1\{X_i\leq x\}.
$$
The <Glivenko-Cantelli theorem> asserts the uniform, <almost sure convergence>
$$
\boxed{\sup_{x\in\mathbb R}|\widehat F_n(x)-F(x)|\longrightarrow0\quad\text{almost surely}.}
$$
No <continuity> of the <distribution function> is required. Here is a proof that also handles its jumps. Let $U_i$ be independent <uniform random variables> on $(0,1)$, and write $X_i=F^{-1}(U_i)$, where $F^{-1}(u)=\inf\{x:F(x)\geq u\}$. The generalized inverse property gives $\mathbf1\{X_i\leq x\}=\mathbf1\{U_i\leq F(x)\}$, so, if $G_n$ is the <empirical distribution function> of the $U_i$, then $\widehat F_n(x)=G_n(F(x))$.

For a fixed <positive integer> $m$, the <strong law of large numbers> applied at each of the finitely many grid points $j/m$ shows that $\Delta_{n,m}=\max_{0\leq j\leq m}|G_n(j/m)-j/m|\to0$ <almost surely>. If $j/m\leq t\leq(j+1)/m$, <monotonicity> sandwiches $G_n(t)$ between its endpoint values, whence
$$
\sup_{0\leq t\leq1}|G_n(t)-t|\leq\Delta_{n,m}+\frac1m.
$$
Take the probability-one intersection of these events over all $m$. On that event the <limit superior> is at most $1/m$ for every $m$, hence is zero. Therefore $\sup_x|G_n(F(x))-F(x)|\to0$. The coupled sequence has the same joint law as any independent sample from $F$, which proves the asserted almost sure conclusion for the original sample.

For $0<p<1$, the <sample quantile> is
$$
\widehat F_n^{-1}(p)=\inf\{x:\widehat F_n(x)\geq p\}=X_{(\lceil np\rceil)},
$$
where $X_{(j)}$ denotes the $j$th <order statistic>, with repeated observations retained. Suppose the population <median> $m=F^{-1}(1/2)$ is unique and $F$ is <continuously differentiable> in a neighbourhood of $m$, with <probability density function> $f(m)>0$. Then
$$
\boxed{\sqrt n\bigl(\widehat F_n^{-1}(1/2)-m\bigr)\ \xrightarrow{d}\ N\!\left(0,\frac1{4f(m)^2}\right).}
$$
To see the <variance> directly, fix $t$ and count observations below $m+t/\sqrt n$. This count has a <binomial distribution> with success probability $q_n=1/2+f(m)t/\sqrt n+o(n^{-1/2})$. The event that the <sample median> is below this point is that the count is at least $\lceil n/2\rceil$. The <central limit theorem> for this binomial triangular array gives a limiting probability $\Phi(2f(m)t)$, exactly the displayed <normal distribution>. Centering is necessary for stating the limiting distribution; subtracting the deterministic population <median> has no effect on the <asymptotic variance> requested in the comparisons.