What is the expected number of times the bug will land on $0$ before it lands on $4$ for the first time? A bug is walking a number line such that all numbers are nonnegative. The bug starts at $1$. When it lands on $0$, it goes back to $1$, but from any other number on the number line, it goes left or right with equal probability. 
What is the expected number of times the bug will land on $0$ before it lands on $4$ for the first time?
 A: Shamelessly ripping off Adapting Mathmo123's method to answer the problem asked:
Let $\mu_k$ denote the expected number of visits to $0$ before the first visit to $4$
if we start at $k.$ Then
$$\begin{eqnarray}
\mu_4 &=& 0,\\
\mu_3 &=& \frac 12 \mu_2 + \frac 12 \mu_4,\\
\mu_2 &=& \frac 12 \mu_1 + \frac 12 \mu_3,\\
\mu_1 &=& \frac 12 \mu_0 + \frac 12 \mu_2, \ \mbox{and}\\
\mu_0 &=& 1 + \mu_1.\\
\end{eqnarray}$$
The first equation is due to the fact that we can't visit anything before visiting $4$ if we start at $4;$ the last is due to the fact that being at $0$ gives us one visit, and afterward we will certainly visit $1;$ every other case is based on the $\frac 12$ probability of visiting either of the adjacent numbers next.
Solve for $\mu_1.$
A slightly more interesting question is what is the expected number of visits to $0$ before the first visit to $N$ if the bug starts at $M.$  It turns out there is a nice simple answer to that question.  Apply that answer to the case $N = 4, M = 1.$
