Exercise
A gambler plays a game in which on each play he wins
one dollar with probability [math]p[/math] and loses one dollar with probability [math]q = 1 - p[/math]. The Gambler's Ruin problem is the problem of finding the probability [math]w_x[/math] of winning an amount [math]T[/math] before losing everything, starting with state [math]x[/math]. Show that this problem may be considered to be an absorbing Markov chain with states 0, 1, 2, \ldots, [math]T[/math] with 0 and [math]T[/math] absorbing states. Suppose that a gambler has probability [math]p = .48[/math] of winning on each play. Suppose, in addition, that the gambler starts with 50 dollars and that [math]T = 100[/math] dollars. Simulate this game 100 times and see how often the gambler is ruined. This estimates [math]w_{50}[/math].