Link to Problem: HERE

A gambler plays a game in which on each play he wins one dollar with probability \(p\) and loses one dollar with probability \(q=1-p\). The Gambler’s Ruin problem is the problem of finding the probability \(w_x\) of winning an amount \(T\) before losing everything, starting with state \(x\). Show that this problem may be considered to be an absorbing Markov chain with states \(0, 1, 2, . . . , T\) with \(0\) and \(T\) absorbing states.

By definition a problem can be modeled as an absorbing Markov chain if the probability of an event happening is state dependent, there exists at least one state from which it is impossible to leave, and that from any given state it is possible to get to the absorbing state. This problem matches all these criteria.

The absorbing states are having \(0\) dollars and having \(T\) dollars. Once you have \(0\) dollars there is nothing left to gamble with and thus you are stuck at \(0\) dollars. Conversly, as long as you keep your promise to stop, having \(T\) dollars is also a state that is impossible to leave.

These absorbing states can be reached from any other financial state by winning or losing enough games.

The probability of an event happening in this example is state dependent, but the probability of each event happens to be the the same. (That is, the probability of winning or losing the bet isn’t dependent on how much money one has left). At least until an absorbing state is reached.

Suppose that a gambler has probability \(p=.48\) of winning on each play. Suppose, in addition, that the gambler starts with \(50\) dollars and that \(T=100\) dollars. Simulate this game 100 times and see how often the gambler is ruined. This estimates \(w_{50}\).

Gamblers.Ruin <- function(starting, ending, prob.win, repititions){
  won = 0
  for(i in 1:repititions){
    s = starting
    while(s != 0 && s != ending){
      if(runif(1) <= prob.win){
        s <- s + 1
      }else{
        s <- s - 1
      }
    }
    if(s == ending){
      won <- won + 1
    }
  }
  print(won)
  print(won / repititions)
}

The gamblers wins about \(\sim 1\%\) of the time and loses about \(\sim 99\%\) of the time. This is interesting because the odds of \(48\%\) aren’t terrible. In fact, increasing the odds to exactly \(50\%\) results in winning about half of the time (as expected). In order to win half the time at \(48\%\) odds, you would need to start with about \(91\) dollars. The law of large number is amazing!

set.seed(123)
Gamblers.Ruin(50, 100, .48, 100)
## [1] 1
## [1] 0.01
Gamblers.Ruin(50, 100, .50, 100)
## [1] 48
## [1] 0.48
Gamblers.Ruin(91, 100, .48, 100)
## [1] 44
## [1] 0.44