# Expectation of the geometric distribution

This page is a stub, so it contains little or minimal information and is on a to-do list for being expanded.The message provided is:
Finish in morning
[ilmath]\newcommand{\P}[2][]{\mathbb{P}#1{\left[{#2}\right]} } \newcommand{\Pcond}[3][]{\mathbb{P}#1{\left[{#2}\!\ \middle\vert\!\ {#3}\right]} } \newcommand{\Plcond}[3][]{\Pcond[#1]{#2}{#3} } \newcommand{\Prcond}[3][]{\Pcond[#1]{#2}{#3} }[/ilmath]
[ilmath]\newcommand{\E}[1]{ {\mathbb{E}{\left[{#1}\right]} } } [/ilmath][ilmath]\newcommand{\Mdm}[1]{\text{Mdm}{\left({#1}\right) } } [/ilmath][ilmath]\newcommand{\Var}[1]{\text{Var}{\left({#1}\right) } } [/ilmath][ilmath]\newcommand{\ncr}[2]{ \vphantom{C}^{#1}\!C_{#2} } [/ilmath][ilmath]\newcommand{\d}[0]{\mathrm{d} } [/ilmath]

## Statement

Let [ilmath]X\sim[/ilmath][ilmath]\text{Geo} [/ilmath][ilmath](p)[/ilmath] where [ilmath]p[/ilmath] is the probability of any trial being a success, and each trial is i.i.d as [ilmath]X_i\sim[/ilmath][ilmath]\text{Borv} [/ilmath][ilmath](p)[/ilmath], from this we have:

• For [ilmath]k\in\mathbb{N}_{\ge 1} [/ilmath] that [ilmath]\P{X\eq k}\eq p(1-p)^{k-1} [/ilmath]

We now define [ilmath]q:\eq 1-p[/ilmath] as this will simplify calculations further on, meaning that now:

• For [ilmath]k\in\mathbb{N}_{\ge 1} [/ilmath] that [ilmath]\P{X\eq k}\eq pq^{k-1} [/ilmath]
• The expectation of [ilmath]X[/ilmath] is:
• $\sum^\infty_{k\eq 1}k\P{X\eq k}$ which of course is actually a limit of a series, $\lim_{n\rightarrow\infty}\left(\sum^n_{k\eq 1}k\P{X\eq k}\right)$
We claim that that [ilmath]\E{X}\eq\frac{1}{p} [/ilmath] for [ilmath]p\in[/ilmath][ilmath](0,1][/ilmath][ilmath]\subseteq\mathbb{R} [/ilmath] and undefined for [ilmath]p\eq 0[/ilmath]

To do so we will consider the 3 cases, [ilmath]p\eq 0[/ilmath], [ilmath]p\in (0,1)\subseteq\mathbb{R} [/ilmath] and [ilmath]p\eq 1[/ilmath] separately and in reverse of this order.

## Proof

We introduce the following for short.

1. $S'_n:\eq\sum^n_{k\eq 1}kpq^{k-1}$ - this forms the sequence used in the limit - which is a series.
• Thus $\E{X}\eq\lim_{n\rightarrow\infty}\Big(S'_n\Big)$
2. $S_n:\eq\sum^n_{k\eq 1}kq^{k-1}$
• This comes from the sequence inside the limit, $\sum^n_{k\eq 1}k\P{X\eq k}\eq\sum^n_{k\eq 1}kpq^{k-1}\eq p\sum^n_{k\eq 1} kq^{k-1} \eq pS_n$, so:
• $\E{X}\eq\lim_{n\rightarrow\infty}\left(\sum^n_{k\eq 1}k\P{X\eq k}\right)\eq\lim_{n\rightarrow\infty}\Big(pS_n\Big)$

Notice that [ilmath]S'_n\eq pS_n[/ilmath] - introduced purely to save typing.

### Case 1: [ilmath]p\eq 1[/ilmath]

Notice that in this case, [ilmath]q\eq 1-p\eq 0[/ilmath].

We now consider the [ilmath]S'_n[/ilmath] terms:

• $S'_n\eq pS_n\eq p\left(\sum^n_{k\eq 1}kq^{k-1}\right)$ - [ilmath]0^0[/ilmath] comes up here

### Case 2: [ilmath]p\in (0,1)\subseteq\mathbb{R} [/ilmath] - TODO: EXTENSION

TODO: This case can be extended to [ilmath]p\in (0,1][/ilmath] and should be
as there's no reason we can't cope with the [ilmath]q\eq 0[/ilmath] case -
TODO: SORT THIS OUT
1. $\frac{\mathrm{d} }{\mathrm{d}q}\Big[q^k\Big]\Bigg\vert_q\eq kq^{k-1}$ which is the first result covered in differentiation[Note 1]
2. $\sum^n_{k\eq 1}r^{k-1}\eq \frac{1-r^n}{1-r}$ (from the result on the geometric series page), and,
• Note that $\sum_{k\eq 1}^nr^k\eq r\sum^n_{k\eq 1}r^{k-1}$ so we will really use:
• $\sum^n_{k\eq 1}r^k\eq r\frac{1-r^n}{1-r}$

Proof:

• Let [ilmath]p\in[/ilmath][ilmath](0,1)[/ilmath][ilmath]\subseteq[/ilmath][ilmath]\mathbb{R} [/ilmath] be given, and let [ilmath]X\sim[/ilmath][ilmath]\text{Geo} [/ilmath][ilmath](p)[/ilmath] so [ilmath]\P{X\eq k}:\eq (1-p)^{k-1}p[/ilmath] for [ilmath]k\in\mathbb{N}_{\ge 1} [/ilmath], now:
• $\E{X}:\eq\sum^\infty_{k\eq 1}k\cdot\P{X\eq k}\eq \sum^\infty_{k\eq 1}k(1-p)^{k-1}p\eq p\sum^\infty_{k\eq 1}kq^{k-1}$ where we have substituted [ilmath]q^{k-1} [/ilmath] for [ilmath](1-p)^{k-1} [/ilmath] at the end there.
• We use the first lemma described above to observe that $kq^{k-1}\eq\frac{\d }{\d q}\Big[q^k\Big]\Big\vert_q$, thus:
• $\E{X}\eq p\sum^\infty_{k\eq 1}\frac{\d}{\d q}\Big[q^k\Big]\Big\vert_q$
$\eq p\cdot\left(\frac{\d}{\d q}\left[\sum^\infty_{k\eq 1}q^k\middle]\right\vert_q\right)$[Note 2]
• We now work on the expression: $\sum^\infty_{k\eq 1}q^k$, taking it as $\lim_{n\rightarrow\infty}\left(\sum^n_{k\eq 1}q^k\right)$ and operate on the $\sum^n_{k\eq 1}q^k$ first
• By the second lemma above:
• $\sum^n_{k\eq 1}q^k\eq q\frac{1-q^n}{1-q}$
$\eq \frac{q}{1-q}\cdot(1-q^n)$
• Now we consider $\lim_{n\rightarrow\infty}\left(\sum^n_{k\eq 1}q^k\right)$,
• $\lim_{n\rightarrow\infty}\left(\sum^n_{k\eq 1}q^k\right) \eq \lim_{n\rightarrow\infty}\left(\frac{q}{1-q}\cdot(1-q^n) \right)$
$\eq\frac{q}{1-q}\cdot\lim_{n\rightarrow\infty}\Big((1-q^n)\Big)$
• Let us operate on the $\lim_{n\rightarrow\infty}\Big((1-q^n)\Big)$ now
• We have three cases, [ilmath]q\eq 0[/ilmath], [ilmath]q\in(0,1)[/ilmath] and [ilmath]q\eq 1[/ilmath] - But as we are explicitly in the [ilmath]q\in(0,1)[/ilmath] case we don't need to consider them really, we do so for demonstration purposes only
All of these are applications of limit of integer powers of a real value
1. [ilmath]q\eq 0[/ilmath] then obviously [ilmath]0^n[/ilmath] for [ilmath]n\in\mathbb{N}_{\ge 1} [/ilmath] is always [ilmath]0[/ilmath] (with [ilmath]0^0[/ilmath] "disputed" but not relevant here) so
• [ilmath]\lim_{n\rightarrow\infty}(1-q^n)\eq 1-0\eq 1[/ilmath]
2. [ilmath]q\in(0,1)[/ilmath] then [ilmath]q^n[/ilmath] gets smaller as [ilmath]n[/ilmath] increases so [ilmath]q^n\rightarrow 0[/ilmath] so [ilmath]1-q^n\rightarrow 1[/ilmath], thus
• [ilmath]\lim_{n\rightarrow\infty}(1-q^n)\eq 1-0\eq 1[/ilmath] also
3. [ilmath]q\eq 1[/ilmath] then [ilmath]q^n\eq 1[/ilmath] always so
• [ilmath]\lim_{n\rightarrow\infty}(1-q^n)\eq 1-1\eq 0[/ilmath]
• So we see that [ilmath]q\in [0,1) [/ilmath][Note 3] means that [ilmath]\lim_{n\rightarrow\infty}(1-q^n)\eq 1[/ilmath]
• Substituting our findings we see for the relevant range of this case that:
• $\frac{q}{1-q}\cdot\lim_{n\rightarrow\infty}\Big((1-q^n)\Big) \eq \frac{q}{1-q}$
• Thus:
• $\sum^\infty_{k\eq 1}q^k:\eq \lim_{n\rightarrow\infty}\left(\sum^n_{k\eq 1}q^k\right) \eq \frac{q}{1-q}$
• We combine this into our expression for [ilmath]\E{X} [/ilmath]:
• $\E{X}\eq p\cdot\left(\frac{\d}{\d q}\left[\sum^\infty_{k\eq 1}q^k\middle]\right\vert_q\right)$
$\eq p\cdot\frac{\d}{\d q}\left[\frac{q}{1-q}\middle]\right\vert_q$
• We now operate on [ilmath]\frac{\d}{\d q}\big[q\cdot (1-q)^{-1}\big]\big\vert_q [/ilmath] and - as writing it this way implies - will use the product rule:
• $\frac{\d}{\d q}\Big[q\cdot (1-q)^{-1}\Big]\Big\vert_q \eq q\frac{\d}{\d q}\left[(1-q)^{-1}\middle]\right\vert_q+\frac{1}{1-q}\frac{\d}{\d q}\left[q\right]\Big\vert_q$
$\eq\frac{-q}{(1-q)^2}\cdot\frac{\d}{\d q}\Big[(1-q)\Big]\Big\vert_q +\frac{1}{1-q}$ - notice the chain ruling being applied here
$\eq\frac{-q}{(1-q)^2}(-1) +\frac{1}{1-q}$
$\eq \frac{1}{1-q}\left(1+\frac{q}{1-q}\right)$
$\eq \frac{1}{1-q}\left(\frac{1-q}{1-q}+\frac{q}{1-q}\right)$
$\eq \frac{1}{1-q}\left(\frac{1}{1-q}\right)$
$\eq\frac{1}{(1-q)^2}$ or [ilmath]\eq (1-q)^{-2} [/ilmath]
• Finally: $\frac{\d}{\d q}\big[q\cdot (1-q)^{-1}\big]\big\vert_q \eq \frac{1}{(1-q)^2}$
• So now we have: $\E{X} \eq p\cdot\frac{\d}{\d q}\left[\frac{q}{1-q}\middle]\right\vert_q\eq p\frac{1}{(1-q)^2}$
• Lastly we operate on $\E{X}\eq p\frac{1}{(1-q)^2}$
• Recall that [ilmath]q:\eq 1-p[/ilmath] so [ilmath]1-q\eq 1-(1-p)\eq 1-1+p\eq p[/ilmath] - we have [ilmath]1-q\eq p[/ilmath] now, substitute this in and we see:
• $\E{X}\eq p\frac{1}{p^2}$
$\eq \frac{1}{p}$
• So we have $\E{X}\eq \frac{1}{p}$ given our value of [ilmath]p[/ilmath]
• Since our choice of [ilmath]p\in(0,1)[/ilmath] was arbitrary we have shown:
• $\forall p\in(0,1)\left[\E{\text{Geo}(p)}\eq\frac{1}{p}\right]$ - as required

## Notes

1. I'd really like to link to something here so
TODO: Link to the actual result!
2. Remember $\sum^\infty_{k\eq 1}a_k$ is just short hand for $\lim_{n\rightarrow\infty}\left(\sum^n_{k\eq 1}a_k\right)$ - see limits and limit of a series - and remember that $\frac{\d}{\d x}\Big[f(x)\Big]\Big\vert_x+\frac{\d}{\d x}\Big[g(x)\Big]\Big\vert_x\eq\frac{\d}{\d x}\Big[f(x)+g(x)\Big]\Big\vert_x$ - as per linearity of the derivative.