Finding the probability generating function of $P(X=n)$ You toss a fair coin repeatedly until heads appears three times.
Suppose the third head appears on the $X$-th toss. Find the
probability distribution of $X$, that is find a formula for $F_{X}(n) =
P(X = n)$. Hence find a formula for the generating function
$P_{X}(s) = E(s^
X)$ of $X$. Using the generating function, or
otherwise, find $E(X), E(X^2
)$ and $Var(X)$.
I want to find the Probability Generating Function
I find that the probability $X = n$ is :
$$P(X=n) = \frac{1}{2^n}\binom{n-1}{2}$$
Following that : 
$$P_{X}(s) = \sum_{n=3}^\infty \frac{1}{2^n}\binom{n-1}{2}s^n =\frac{s^3}{2^3} \sum_{m = 0}^\infty \binom{m+2}{2}\frac{s^m}{2^m}$$
Where : $\,\,\,\,\,\,\,$ $ n = m+3$
So I would believe that this is a geometric progression where $a = 1\,\,\,r = \frac{s}{2}$
So I got $$= \frac{s^3}{2^3}(\frac{1}{1-\frac{s}{2}})$$
However the solution gives : 
$$= \frac{s^3}{2^3}(\frac{1}{(1-\frac{s}{2})^3})$$
Can someone explain why I am wrong and the general approach to this solution.

The problem is that the series is not geometric, but we could try to turn it into a geometric:
$$P_{X}(s) = \sum_{n=3}^\infty \frac{1}{2^n}\binom{n-1}{2}s^n =\frac{s^3}{2^3} \sum_{m = 0}^\infty \binom{m+2}{2}\frac{s^m}{2^m}$$
$$= a\sum_{m = 0}^\infty (m+2)(m+1)\frac{s^m}{2^m},\text{ where }a=\frac{s^3}{2^4}$$
Let $S_n=\sum_{m = 0}^n (m+2)(m+1)\frac{s^m}{2^m} $
$$X_n=S_{n}-\frac{s}{2}S_{n}=2-(n+2)(n+1)\frac{s ^{n+1}}{2^{n+1}}+2\sum_{m = 1}^{n} (m+1)\frac{s^{m}}{2^{m}} $$
$$Y_n=X_{n}-\frac{s}{2}X_n=(1-\frac{s}{2})^2S_n$$
$$=(1-\frac{s}{2})\bigg(2-(n+2)(n+1)\frac{s ^{n+1}}{2^{n+1}}\bigg)$$$$+2s-2(n+1)\frac{s^{n+1}}{2^{n+1}}+2\sum_{m=2}^{n}\frac{s^m }{2^m}$$
Now you get a geometric one, and you could solve it, and then solve back to $S_n$
Or, since now you only want the $n\rightarrow \infty$, take the limit on the above one, and you will get it. You could also see clearly why you have extra $(1-\frac{s}{2})^2$ in your denominator.
So to summarize the series $S_n$ you get is NOT geometric series, but the series of $(1-\frac{s}{2})^2S_n$ is a geometric series, and you could apply the geometric summation only to $(1-\frac{s}{2})^2S_n$
