Expected value and state diagrams I have two questions:
I have a coin that is slightly unbalanced. The odds of getting heads are 60%. What are the odds that if I flip it endlessly, at some point during my flipping I have a total of three more tails than heads?
5 people stand in a line facing one direction. In every round, the person at the front moves randomly to any position in the line, including the front or the end. Suppose that $\frac{m}{n}$ is the expected number of rounds needed for the last person of the initial line to appear at the front of the line, where m and n are relatively prime positive integers. What is $m+n$?
I tried using state diagrams and infinite geometric sequences, but it got extremely complicated. Is there any way to solve the first question?
I also do not know where to start with the second problem. Any ideas?
Thanks!
 A: Problem $2$)
Let $E$ be the required expected value.
Then $E = \displaystyle\sum_{n=5}^{\infty} n\times P(\text{last to first in }n\text{ moves})$
To calculate $P(\text{last to first in }n\text{ moves})$, you can note that a person needs to get inserted into the last position exactly $5$ times, the last time being in the last round.
So this boils down to counting strings of length $n$ made of an alphabet of size $5$ (denoting the $5$ positions in which the first person may get inserted) whose last letter is $L$, and the remaining $n-1$ letters contain exactly $4$ $L$'s. The number of such strings is ${n-1\choose 4}4^{n-5}$.
So $P(\text{last to first in }n\text{ moves}) = \dfrac{{n-1\choose 4}4^{n-5}}{5^n}\implies E = \displaystyle\sum_{n=5}^{\infty}\left(\dfrac{{n-1\choose 4}4^{n-5}}{5^n}\right) = 25$.
You can evaluate the last series by differentiating the geometric series $\sum x^n$ 4 times, multiplying appropriate constants and plugging in $x=4/5$.
$25$ as the answer makes sense because you'd expect $5$ rounds to get the first person to go into the last position, then $5$ more for that to happen again and so on 5 times.

Problem $1$)
Im not so sure if my crack at this is right but here goes -
Let $E_t$ be the event that at toss $t$, we obtain $3$ more heads than tails for the first time in our sequence. Such a $t$ has to be odd and greater than or equal to $3$, because $\#\text{Heads}+\#\text{Heads}-3$ is always odd.
Our required probability then is $P = P\left(\bigcup\limits_{i=k}^{\infty}E_{2k+1}\right)=\displaystyle\sum_{k=1}^{\infty}P(E_{2k+1})$ since $E_i$ are independent.
Also, $P(E_{2k+1}) = \frac{3}{5}P(\text{exactly 2 more heads than tails in } 2k \text{ tosses})$.
Also, $P(\text{exactly 2 more heads than tails in } 2k \text{ tosses}) = \dfrac{2k\choose k+1}{2^{2k}}$.
So our final expression then is $P = \displaystyle\sum_{k=1}^{\infty}\left(\frac{3}{5}\cdot\dfrac{2k\choose k+1}{2^{2k}}\right)$
This series happens to diverge, so either Ive made a blunder or this is happening because our required set of sequences is dense in thr set of all $HT$ sequences.
