Variance of Geometric Distribution

Theorem
Let $$X$$ be a discrete random variable with the geometric distribution with parameter $p$.

Then the variance of $$X$$ is given by:
 * $$\operatorname{var} \left({X}\right) = \frac p {\left({1 - p}\right)^2}$$

Proof 1
From the definition of Variance as Expectation of Square minus Square of Expectation:
 * $$\operatorname{var} \left({X}\right) = E \left({X^2}\right) - \left({E \left({X}\right)}\right)^2$$

From Expectation of Function of Discrete Random Variable:
 * $$E \left({X^2}\right) = \sum_{x \in \Omega_X} x^2 \Pr \left({X = x}\right)$$

To simplify the algebra a bit, let $$q = 1 - p$$, so $$p+q = 1$$.

Thus:

$$ $$ $$

Then:

$$ $$ $$

Proof 2
From Variance of Discrete Random Variable from P.G.F., we have:
 * $$\operatorname{var} \left({X}\right) = \Pi''_X \left({1}\right) + \mu - \mu^2$$

where $$\mu = E \left({x}\right)$$ is the expectation of $$X$$.

From the Probability Generating Function of Geometric Distribution, we have:
 * $$\Pi_X \left({s}\right) = \frac {q} {1 - ps}$$

where $$q = 1 - p$$.

From Expectation of Geometric Distribution, we have:
 * $$\mu = \frac p q$$

From Derivatives of PGF of Geometric Distribution, we have:
 * $$\Pi''_X \left({s}\right) = \frac {2 q p^2} {\left({1 - ps}\right)^3}$$

Putting $$s = 1$$ using the formula $$\Pi''_X \left({1}\right) + \mu - \mu^2$$:
 * $$\operatorname{var} \left({X}\right) = \frac {2 q p^2} {\left({1-p}\right)^3} + \frac p q - \left({\frac p q}\right)^2$$

and hence the result, after some algebra.