# Conditional variance formula and Geometric RV

I'm stumped on the following problem:

"Use the conditional variance formula to determine the variance of a geometric random variable $X$ having parameter $p$."

My original idea was to have a variable $Y$ where $Y = 1$ if the first trial is a success and $Y = 0$ if not, and then to condition $X$ on $Y$:

$$\mathrm{Var}(X) = E\big[ \mathrm{Var}(X|Y) \big] + \mathrm{Var}\big( E[X|Y] \big)$$

So I begin to calculate: $$\mathrm{Var}(X|Y = y) = E\big[ (X - E[X|Y = y])^2 | Y = y \big]$$

At which point I'm kind of lost, as I'm not sure how to calculate the conditional probabilities such as E[X | Y=y]. Am I heading in the right direction? If so, how do I calculate these conditional probabilities?

You are heading in the right direction. If $Y$ is as you've defined, then $E(X\mid Y)$ and $\operatorname{Var}(X\mid Y)$ are both variables that take two possible values. To determine these values, think about the two cases:

• $Y=1$, which occurs with probability $p$. Then the first toss is a success so conditional on $Y=1$ we know that $X=1$, i.e. we hit the success on the first trial. Therefore $E(X \mid Y=1)=1$ and $\operatorname{Var}(X\mid Y=1)=0$.

• $Y=0$, which occurs with probability $1-p$. Then the first toss was a failure, so we need to keep tossing. We can write $X=1+X'$ where $X'$, the remaining tosses required to see success, has the same distribution as $X$ but is independent of the first toss. Therefore $E(X\mid Y=0)=1+E(X)=1+\frac1p$ and $\operatorname{Var}(X\mid Y=0)=\operatorname{Var}(X)$.

Now apply the following fact, which you can easily verify:

Fact: If $W$ is a variable taking value $a$ with probability $p$ and $b$ with probability $1-p$, then $E(W)=(a-b)p$ and $\operatorname{Var}(W)=(a-b)^2p(1-p)$.

Using this fact, and plugging into the conditional variance formula, we obtain:

$$\operatorname{Var}(X)= (1-p)\operatorname{Var}(X) + (\textstyle\frac1p)^2p(1-p).$$

Now solve for $\operatorname{Var}(X)$.

The key is that if the first trial fails you are at the same place you began plus one failure. However, if the trial succeeds you are done.

\begin{align}\mathsf E(\mathsf {Var}(X\mid Y)) ~=~& \mathsf E(\mathsf E(X^2\mid Y)-\mathsf E(X\mid Y)^2)) \\ =~ & \mathsf P(Y{=}0)(\mathsf E(X^2\mid Y{=}0)-\mathsf E(X\mid Y{=}0)^2)+\mathsf P(Y{=}1)(\mathsf E(X^2\mid Y{=}1)-\mathsf E(X\mid Y{=}1)^2) \\ =~ & \mathsf P(Y{=}0)\big(\mathsf E((X+1)^2)-\mathsf E(X+1)^2\big)+\mathsf P(Y{=}1)(0) \\ =~ & (1-p)\big(\mathsf E(X^2)+2\mathsf E(X)+1-\mathsf E(X)^2-2\mathsf E(X)-1)\big) \\ =~ & (1-p)\big(\mathsf E(X^2)-\mathsf E(X)^2)\big) \\ =~ & (1-p)\mathsf {Var}(X) \end{align}

Can you continue?