Flipping a Coin 10 Times and Getting a Sequence of Heads I toss a fair coin $10$ times resulting in a sequence of heads and tails. Let $X$ be the number of times that the sequence $HH$ appears. $HH$ appears thrice here.

Solution:
The example goes, say we flip a coin $10$ times and you get all heads then we have $HH$ appears $10$ times. (I would write it out, but my LateX Skills are not up to par.)
And we see $P(HH) = \frac{1}{4}$ because we have $.5$ for heads and tails for the two coins.
$X = HH$ appears.
This is where I don't understand what happens: $\sum_{n=0}^9P(X)\cdot X = \frac{9}{4}$.
When I thought of it, do you factor out $P(X)$ because it is always $\frac{1}{4}$, but I am wrong. Any help would be awesome!

$X$ follows a bionomial distribution with success probability $p=1/4$ and $n=9$ the number of trials. Too see this let $X$ be the number of $HH$ appeared in a flip coin of 10 tosses. Clearly, as you said to get $HH$ twice in a row has probability equal to $p=1/4$. So, you look at your problem from the point of view that $HH$ is your success outcome and the rest $\{HK,KH,KK\}$ consists of the failure outcomes. Now you look for how many possible ways you have in order to get $HH$ in $10$ tosses. There are $9$ ways, in order to figure this out you look at the positions where the first $H$ can appear in a sequence of $HH$. It can appear in any of the first $9$ positions. So, we end up that $X\sim Bionomial(9,1/4)$. And this has $E[X]=np=9/4$.
