Consider a gambler who starts with an initial fortune of $ and then on each successive gamble either wins 1$ or loses 1$ independent of the past with probabilities and respectively. The gambler's objective is to reach a total fortune of N$, without first getting ruined (running out of money).

Let be the probability that the gambler wins when starting with $, we have

Finally,

Note that, is the probability of ruin.

**Another type of this question**{:.tbrown}: Consider an ant walking along the positive integers. At position , the ant moves to with probabilities and to with probabilities . If the ant reach , it stops walking. Starting from , what is the probability that the ant reaches before reaching ?

Sometimes, we consider above problem as a random walk problem. This post is copied from this and we have a backup version here.