I am having trouble with the following.
Let $X$ equal the number of flips of a fair coin that are required to observe heads-tails on consecutive flips.
a) Find the pmf of $X$. Hint: Draw a tree diagram.
b) Show that the mgf of $X$ is $\displaystyle M(t) = \frac{e^{2t}}{(e^t - 2)^2}$
I know that the pmf is $\displaystyle \Pr[X = x] = \frac{x-1}{2^x}$, for $x=2,3,4,5 \ldots$.
so the mgf is $$M(t) = e^{2t}\left(\frac{1}{4} + e^t \cdot \frac{2}{6} + e^{2t} \cdot \frac{3}{8}+ \ldots \right)$$
Can someone show me how this infinite sum is equal to $(e^t-2)^2$?
I believe it is some manipulation of the geometric series but I am not sure.
Thanks
So, you say that $P(X = x) = \frac{x-1}{2^x}$. We thus have that: \begin{align*} f(t) & = E[e^{tX}] = \sum_{x = 2}^\infty e^{tx}\frac{x-1}{2^x} \\ & = \sum_{x = 2}^\infty x\frac{e^{tx}}{2^x}-\sum_{x = 2}^\infty \frac{e^{tx}}{2^x} \\ & = \sum_{x = 2}^\infty \frac{\partial}{\partial t}\left(\frac{e^{tx}}{2^x}\right)-\sum_{x = 2}^\infty \left(\frac{e^t}{2}\right)^x \\ & = \frac{\partial}{\partial t}\sum_{x = 2}^\infty \left(\frac{e^t}{2}\right)^x-\sum_{x = 2}^\infty \left(\frac{e^t}{2}\right)^x \end{align*} Here, I "interchanged" differentiation and summation. We really should be careful about convergence (as it is NOT true in general), but this usually isn't as big of a concern in probability.
Now, note that: $$\sum_{x = 2}^\infty \left(\frac{e^t}{2}\right)^x$$ is a geometric sum. We can thus evaluate it as: $$\sum_{x = 2}^\infty\left(\frac{e^t}{2}\right)^x = \frac{e^{2t}}{4}\frac{1}{1-e^{t}/2} = \frac{e^{2t}}{4-2e^t}$$ Now, we can take the $t$ derivative of this to get that: $$\frac{\partial}{\partial t} \sum_{x = 2}^\infty \left(\frac{e^t}{2}\right)^x = \frac{(4-2e^t)2e^{2t}+2e^{2t}e^t}{(4-2e^t)^2} = \frac{8e^{2t}-2e^{3t}}{(4-2e^t)^2} = \frac{2e^{2t}(4-2e^t)}{(4-2e^t)^2} = \frac{e^{2t}}{2-e^t}$$ Now, we can preform the subtraction to get that: $$f(t) = \frac{e^{2t}}{2-e^t}-\frac{1}{2}\frac{e^{2t}}{2-e^t} = \frac{1}{2}\frac{e^{2t}}{2-e^t}$$
It appears I've made some mistake somewhere, but the important concepts here are: