Probability in coin toss Suppose that you have a fair coin. You start with $\$0$. You win $\$1$ each time you get a head and loose $\$1$ each time you get tails. Calculate the probability of getting $\$2$ without getting below $\$0$ at any time.

Consider $P_i$ the probability to obtain $\$2$ when you have $\$i$, then we look for $P_0$. So a recurrence can be
$$P_{i}=\frac{1}{2}P_{i-1} + \frac{1}{2}P_{i+1}$$
with $P_2=1$ and $P_{-1}=0$ because we do not allow a score below of $\$0$. Now
$$P_0=\frac{1}{2}P_{-1} + \frac{1}{2}P_{1}=\frac{1}{2}P_{1},$$
$$P_1=\frac{1}{2}P_{0} + \frac{1}{2}P_{2}=\frac{1}{2}P_{0} + \frac{1}{2}$$
therefore
$$P_0=\frac{1}{2}P_{1}=\frac{1}{2}\left(\frac{1}{2}P_{0} + \frac{1}{2}\right)$$
and $P_0=\frac{1}{3}$.
