Expected value of ${X \choose 2}$ where $X$ is geometrically distributed I'm trying to find $E[{X \choose 2}]$ where $X$ is geometrically distributed with parameter $p$, but I'm not sure how to finish my solution.
My first thought was to use the standard definition of expected value:
$$E[g(X)]=\sum_x g(x)P(X=x)$$
Since $P(X=x)=p(1-p)^{x-1}$, this gives me:
$$E[{X \choose 2}]=\sum_x {x \choose 2}p(1-p)^{x-1}$$
I couldn't see a clear way to simplify this sum, so I figured I would try another method instead, using the law of total expectation. If I let $A_1$ be the event $X=1$ and $A_2$ be the event $X>1$, then I get this:
$$E[{X \choose 2}]=E[{X \choose 2}|A_1]P(A_1)+E[{X \choose 2}|A_2]P(A_2)$$
This is what I know:
$$E[{X \choose 2}|A_1]=0$$
$$P(A_1)=p$$
$$P(A_2)=1-p$$
That just leaves $E[{X \choose 2}|A_2]$ for what I'm unsure about. My guess is that it equals $E[{X+1 \choose 2}]$, but if that is the case, then I wouldn't know how to solve the result:
$$E[{X \choose 2}]=0p+E[{X+1 \choose 2}](1-p)=E[{X+1 \choose 2}](1-p)$$
So this is where I'm now stuck and I would appreciate some guidance on how to proceed. Thanks!
 A: Let $x' = x-1$. Then 
$\sum\limits_{x=1}^{\infty}\dfrac{x(x-1)}{2}p(1-p)^{x-1}$
$= \sum\limits_{x = 2}^{\infty}\dfrac{x(x-1)}{2}p(1-p)^{x-1}$
$=\sum\limits_{x'=1}^{\infty}\dfrac{(x'+1)x'}{2}p(1-p)^{x'}$
$= (1-p)\sum\limits_{x'=1}^{\infty}\dfrac{x'^2 + x'}{2}p(1-p)^{x'-1}$
$= (1-p)\sum\limits_{x'=1}^{\infty}(\dfrac{x'^2-x'}{2} + x')p(1-p)^{x'-1}$
$= (1-p)\sum\limits_{x'=1}^{\infty}\dfrac{x'^2-x'}{2}p(1-p)^{x'-1} + (1-p)\sum\limits_{x'=1}^\infty x'p(1-p)^{x'-1}$ 
$= (1-p)\sum\limits_{x'=1}^{\infty}\dfrac{x'(x'-1)}{2}p(1-p)^{x'-1} + (1-p)\sum\limits_{x'=1}^\infty x'p(1-p)^{x'-1}$ 
Thus, $E[\binom{X}{2}] = (1-p)E[\binom{X}{2}] + (1-p)E[X]$
Note that by definition, $\binom{n}{k} = 0$ for $n<k$, so you can use $x(x-1)/2$ instead of $\binom{x}{2}$.
A: More generally, let $k \ge 0$ and consider the function $$f_k(z) = \sum_{n=k}^\infty \binom{n}{k} z^n.$$  Clearly, $f_0(z) = (1-z)^{-1}$.  We also recall that $$\binom{n}{k} = \binom{n-1}{k-1} + \binom{n-1}{k},$$ a direct consequence of Pascal's triangle (and is easily proven).  Therefore $$\begin{align*} f_k(z) &= z \sum_{n=k}^\infty \binom{n-1}{k-1} z^{n-1} + \sum_{n=k}^\infty \binom{n-1}{k} z^n \\ &= z f_{k-1}(z) + \left( \binom{k-1}{k} z^k + \sum_{n=k+1}^\infty \binom{n-1}{k} z^n \right) \\ &= zf_{k-1}(z) + \sum_{n=k}^\infty \binom{n}{k}z^{n+1} \\ &= zf_{k-1}(z) + zf_k(z). \end{align*}$$  It follows that $$f_k(z) = \frac{z}{1-z} f_{k-1}(z).$$  This recurrence, along with the initial condition for $f_0(z)$, gives us the explicit formula $$f_k(z) = \frac{z^k}{(1-z)^{k+1}}.$$  Now the desired sum to be evaluated is $$\operatorname{E}\left[\binom{X}{2}\right] = \sum_{x=2}^\infty \binom{x}{2} p(1-p)^{x-1},$$ which is simply $$\frac{pf_2(1-p)}{1-p} = \frac{p(1-p)^2}{(1-p)(1-(1-p))^3} = \frac{1-p}{p^2}.$$  Moreover, it is now trivial to compute $$\operatorname{E}\left[\binom{X}{k}\right]$$ for any nonnegative integer $k$ and such geometrically distributed $X$.
