# Derivation of E(X) for a geometric distribution

I'm having trouble following the derivation of the expected value for the geometric distribution.

I've reached:

$$\sum_{k=1}^{\infty} p \cdot k(1-p)^{k-1} = p(1 + 2(1-p) + 3(1-p)^2 + ...)$$

The next step rewrites $$k$$ as an infinite sum of ascending values, that is:

$$=p( \sum_{k=1}^{\infty}\ (1-p)^{k-1} + \sum_{k=2}^{\infty}\ (1-p)^{k-1} + \sum_{k=3}^{\infty}\ (1-p)^{k-1} + ...)$$

Why exactly is it that we can represent $$k$$ as this infinite sum?

## 2 Answers

Consider the following double infinite sum:

$$\begin{array}{cccccc} p & +p(1-p) & +p(1-p)^2 & + p(1-p)^3 & + p(1-p)^4 & + \cdots \\ & +p(1-p) & +p(1-p)^2 & + p(1-p)^3 & + p(1-p)^4 & + \cdots \\ & & +p(1-p)^2 & + p(1-p)^3 & + p(1-p)^4 & + \cdots \\ & & & + p(1-p)^3 & + p(1-p)^4 & + \cdots \\ & & & & + p(1-p)^4 & + \cdots \\ & & & & & + \cdots \\ \end{array}$$ If we first sum the columns, then the $$k^{\text{th}}$$ column sums to $$k p(1-p)^{k-1}$$, and we get the sum you're starting with.

If we first sum the rows, then the $$j^{\text{th}}$$ row sums to $$p \displaystyle\sum_{k=j}^{\infty} (1-p)^{k-1}$$, and we get the second sum.

Another way to see this: in the expression $$p\left( \sum_{k=1}^{\infty}\ (1-p)^{k-1} + \sum_{k=2}^{\infty}\ (1-p)^{k-1} + \sum_{k=3}^{\infty}\ (1-p)^{k-1} + \dots\right),$$ the term $$p(1-p)^{j-1}$$ appears in exactly $$j$$ different sums.

We have : $$\begin{array}{lcl} \displaystyle \sum_{k=1}^{+\infty} p k (1 - p)^{k - 1} & = & \displaystyle \sum_{k=1}^{+\infty} p \left(\sum_{i = 1}^k 1\right) (1 - p)^{k - 1} \\[3mm] & = & \displaystyle \sum_{k=1}^{+\infty} \sum_{i = 1}^k p (1 - p)^{k - 1} \\[3mm] & = & \displaystyle \sum_{i = 1}^{+\infty} p \sum_{k=i}^{+\infty} (1 - p)^{k - 1} \\[3mm] & = & \displaystyle p \sum_{k=1}^{+\infty} (1 - p)^{k - 1} + p \sum_{k=2}^{+\infty} (1 - p)^{k - 1} + p \sum_{k=3}^{+\infty} (1 - p)^{k - 1} + \cdots \end{array}$$