<s>[INST] Third Moment of Geometric Series? $\sum_{x=1}^{\infty}x(1-p)^{x-1} = \frac{1}{p^2}$
$\sum_{x=1}^{\infty}x^2(1-p)^{x-1} = \frac{2-p}{p^3}$
$\sum_{x=1}^{\infty}x^3(1-p)^{x-1} =$ ... ?
The textbook gives the first 2 moments, but not the third one. I could not find the forumla on Google as well. I think it'll be useful in case I need to find $E(X^3)$ where $X$ is a geometric distribution.
 [/INST] First, note that 
$$\sum_{k=0}^\infty k(1-p)^{k-1} = \sum_{k=1}^\infty k(1-p)^{k-1}$$
This allows us to perform a little trick to calculate the moments. For the first moment, we have:
\begin{align}
\sum_{k=1}^\infty k(1-p)^{k-1} &= \sum_{k=0}^\infty k(1-p)^{k-1}\\
&=\sum_{k=1}^\infty (k-1)(1-p)^{k-2} \\
&=\sum_{k=1}^\infty k(1-p)^{k-2} - \sum_{k=1}^\infty(1-p)^{k-2}\\
&= \frac{1}{1-p}\sum_{k=1}^\infty k(1-p)^{k-1}-\frac{1}{p(1-p)}
\end{align}
Rearranging, we obtain:
$$-\frac{p}{1-p}\sum_{k=1}^\infty k(1-p)^{k-1} = -\frac{1}{p(1-p)}$$
$$\sum_{k=1}^\infty k(1-p)^{k-1}=\frac{1}{p^2}$$
We can use the same trick to calculate the third moment:
\begin{align}
\sum_{k=1}^\infty k^3(1-p)^{k-1} &= \sum_{k=0}^\infty k^3(1-p)^{k-1}\\
&= \sum_{k=1}^\infty (k-1)^3(1-p)^{k-2}\\
&= \sum_{k=1}^\infty k^3 (1-p)^{k-2} - 3\sum_{k=1}^\infty k^2(1-p)^{k-2} + 3\sum_{k=1}^\infty k(1-p)^{k-2} - \sum_{k=1}^\infty(1-p)^{k-2}\\
&=\frac{1}{1-p}\sum_{k=1}^\infty k^3(1-p)^{k-1} - \frac{3(2-p)}{p^3(1-p)}+\frac{3}{p^2(1-p)}-\frac{1}{p(1-p)}
\end{align}
Rearranging, we have:
$$-\frac{p}{1-p}\sum_{k=1}^\infty k^3(1-p)^{k-1} = -\frac{p^2-6p+6}{p^3(1-p)}$$
$$\boxed{\sum_{k=1}^\infty k^3(1-p)^{k-1} = \frac{p^2-6p+6}{p^4}}$$
</s>