# Proving variance of geometric distribution

Of course my textbook leaves it as an exercise.... can someone help walk me through the derivation of the variance of a geometric distribution? Using the book (and lecture) we went through the derivation of the mean as:

$$E(Y)=\sum_{y=0}^n yP(y)=\sum_{y=0}^n ypq^{y-1}$$ $$=p\sum_{y=0}^n (-1)(1-p)^y =-p\sum_{y=0}^n(\frac{d}{dp}(1-p)^y -1)$$ By some theorem that's apparently outside the scope of our class: $$=-p\frac{d}{dp}(\sum_{y=0}^n (1-p)^y -1)=-p\frac{d}{dp}(\frac{1}{1-(1-p)}-1)$$ $$=-p\frac{d}{dp}(\frac{1}{p}-1)=-p(-\frac{1}{p^2})$$ $$\therefore E(Y)=\frac{1}{p}$$ From there we were given a hint that double derivatives will be needed for the variance. (my sigma notation might need correcting...)

• I'm struggling to make out what's going on for some reason, I guess because it's vague what exactly is is in the derivative operation and what isn't. That aside, regarding "(my sigma notation might need correcting...)" -- I think, based on the equalities in the first line of the second set of equations, your sum is not finite but goes to infinity. – Eevee Trainer Oct 18 '19 at 4:30
• I'm also trying to figure out where the $y$ went and where the $(-1)$ came in when you move from the first to the second line. – Eevee Trainer Oct 18 '19 at 4:32

Here's a derivation of the variance of a geometric random variable, from the book A First Course in Probability / Sheldon Ross - 8th ed. It makes use of the mean, which you've just derived.

To determine Var$$(X)$$, let us first compute $$E[X^2]$$. With $$q = 1 − p$$, we have \begin{align} E[X^2] & = \sum_{i=1}^\infty i^2q^{i-1}p \\ & = \sum_{i=1}^\infty (i-1+1)^2q^{i-1}p \\ & = \sum_{i=1}^\infty (i-1)^2q^{i-1}p + \sum_{i=1}^\infty 2(i-1)q^{i-1}p + \sum_{i=1}^\infty q^{i-1}p\\ & = \sum_{j=0}^\infty j^2q^jp + 2\sum_{j=1}^\infty jq^jp + 1 \\ & = qE[X^2] + 2qE[X] + 1 \\ \end{align} Using $$E[X] = 1/p$$, the equation for $$E[X^2]$$ yields $$pE[X^2] = \frac{2q}{p} + 1$$ Hence, $$E[X^2] = \frac{2q+p}{p^2} = \frac{q+1}{p^2}$$ giving the result $$Var(X) = \frac{q+1}{p^2} - \frac{1}{p^2} = \frac{q}{p^2} = \frac{1-p}{p^2}$$

• I'm a litte confused on the last line of the $E(X^2)$ proof; how did we substitute $E(X^2)$ if that's what we're trying to show? Similarly I was expecting to make use of a known fact $E(X)=\frac{1}{p}$ but it doesn't seemed like that came into play when making $2qE(X)$..maybe I'm too sleep deprived here.... – Five9 Oct 19 '19 at 1:14
• Ok nevermind, I figured it out. THanks – Five9 Oct 19 '19 at 3:38

Oh, yeah... That was misscopied.   Here is how it should go.

\begin{align} \tag 1\mathsf E(Y) &= \sum_{y} y~\mathsf P_Y(y)&&\raise{1ex}{\text{definition of expectation for }\\\quad\text{a discrete random variable}} \\[1ex]\tag 2 &= \sum_{y=1}^\infty y~p(1-p)^{y-1}&&\text{since }Y\sim\mathcal{Geo}_1(p) \\[1ex]\tag 3 &= p\sum_{z=0}^\infty (z+1)(1-p)^z &&\text{change of variables }z\gets y-1 \\[1ex]\tag 4 &= p\sum_{z=0}^\infty\dfrac{\mathrm d~~}{\mathrm d p}(-(1-p)^{z+1})&&\text{derivation} \\[1ex]\tag 5 &=p~\dfrac{\mathrm d~~}{\mathrm d p}\sum_{z=0}^\infty\left(-(1-p)^{z+1}\right)&&\text{Fubini's Theorem} \\[1ex]\tag 6 &=p~\dfrac{\mathrm d~~}{\mathrm d p}\left(-(1-p)\sum_{z=0}^\infty(1-p)^{z}\right)&&\text{algebra} \\[1ex]\tag 7 &=p~\dfrac{\mathrm d~~}{\mathrm d p}\left(\dfrac{-(1-p)}{1-(1-p)}\right)&&\text{Geometric Series} \\[1ex]\tag 8 &=p~\dfrac{\mathrm d~~}{\mathrm d p}\left(1-p^{-1}\right)&&\text{algebra} \\[1ex]\tag 9 &=p~\cdot~p^{-2}&&\text{derivation} \\[1ex]\tag {10} &=\dfrac 1{p}&&\text{algebra} \end{align}

Also, this is the mean, not the variance.

• Haha thanks for the edits. Re: mean sorry I edited my question: the mean was given as a hint for the variance, and I provided it to show what level our class is on so that any answers could potentially take that into consideration. – Five9 Oct 18 '19 at 5:58