Large deviations of a scaled geometric random variable (source code)

= Large deviations of a scaled geometric random variable
{title2=$I(x)=x\log(1-p)^{-1}\ (x\geq0)$}

Let $X$ have the positive-support <geometric distribution> $\mathbb P(X=k)=p(1-p)^{k-1}$ with $0<p<1$. As $L\to\infty$, $X/L$ satisfies a <large deviation principle> of speed $L$ and <good rate function>
$$
I(x)=\begin{cases}ax,&x\geq0,\\+\infty,&x<0,\end{cases}\qquad a=-\log(1-p)>0.
$$
For every real threshold $x$, the exact upper-tail formula is
$$
\mathbb P(X/L\geq x)=(1-p)^{\max\{\lceil Lx\rceil-1,0\}}.
$$
The maximum with zero matters at $x=0$ and at thresholds below the first lattice point; the uncapped exponent would otherwise give a <Probability> greater than one.

For positive $x$, dividing the <logarithm> by $L$ gives the limit $-ax$. These tails bound <closed sets> through their leftmost nonnegative point. For an open neighborhood of a positive $x$, choose <integers> $k_L$ with $k_L/L\to x$; their individual masses have the same logarithmic limit. Neighborhoods of zero have <Probability> tending to one, supplying rate zero there. Negative-only sets have <Probability> zero, and the rate sublevel sets are compact <intervals>.

For example, with $p=1/2$, $L=100$ and $x=1/5$, the <event> is $X\geq20$ and has <Probability> $2^{-19}$. Meanwhile $X/L$ converges in <Probability> to zero. The nontrivial rate describes the rare excursions away from that degenerate weak limit.