Let $X$ be the discrete random variable defined to be the number of flips of a fair coin until we get two heads in a row.
I already know and understand that $E(X) = 6$. Simply solve $x = 0.5(1+x) + 0.25(2+x) + 0.25(2)$
I would like to find the standard deviation, $\sigma$, for this distribution.
Using $\sigma^2 = E(X^2) - \bigl( E(X) \bigr) ^2$
I tried to find $E(X^2)$ similarly to how I found $E(X)$. But I'm not sure if what I'm doing is "valid" or "appropriate".
$$E(X^2) = 0.5\bigl( 1 + E(X) \bigr)^2 +0.25\bigl( 2 + E(X) \bigr) ^2 + 0.25(2)^2 $$
If we plug in $E(X)$ we get that $E(X^2)=41.5$
However after going through the rest of the calculations, I end up with $\sigma = 2.345$ which definitely doesn't seem correct just from doing a few test runs of this experiment.
How can I correctly find $E(X^2)$? Or how can I better find $\sigma$?
Any help given is greatly appreciated.
The squares should be inside the expectations, not outside: $$ \begin{align} E(X^2) &=E(X^2|T)P(T)+E(X^2|HT)P(HT)+E(X^2|HH)P(HH)\\ &=E((X+1)^2)\cdot \tfrac12+E((X+2)^2)\cdot\tfrac14+2^2\cdot\tfrac14\\ &=\tfrac34E(X^2)+2E(X) + \tfrac{5}{2} \end{align} $$ I get $E(X^2)=58$, so $\sigma =\sqrt{58-36}\approx 4.69.$