10176

# Monte Carlo Simulation of Markov Prisoner

This Demonstration is based on a homework problem that has been in numerous editions of [1] and [2]: A prisoner is in a dungeon with three doors. One door leads to freedom, one door leads to a long tunnel, and a third door leads to a short tunnel. The two tunnels return the prisoner to the dungeon. If the prisoner returns to the dungeon, he attempts to gain his freedom again, but his past experiences do not help him in selecting the door that leads to freedom, that is, we assume a Markov prisoner. The prisoner’s probability of selecting the doors are: 20% to freedom, 50% to the short tunnel, and 30% to the long tunnel. Assuming the travel times through the long and short tunnels are 3 and 2 hours, respectively, our goal is to determine the expected number of hours until the thief selects the door which leads to freedom.
Mathematically, you can solve this problem using expected values. This Demonstration showcases solving it using Monte Carlo simulation. The simulation lets you see the number of hours until freedom is reached for the specified number of simulation trials. The red dot on the histogram indicates the average number of hours. As the number of trials increases, the mean of the simulation results converges to the theoretical value (9.5 for the probabilities defined in the problem). You can also explore the option of the doors having equal probability and changing the number of hours for each tunnel.

### DETAILS

Which book?
[1] S. Ross, Introduction to Probability Models, ed., Burlington, MA: Academic Press, 2007.
[2] S. Ross, A First Course in Probability, Englewood Cliffs, NJ: Prentice Hall, 2010.

### PERMANENT CITATION

Contributed by: Paul Savory (University of Nebraska-Lincoln)
 Share: Embed Interactive Demonstration New! Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details » Download Demonstration as CDF » Download Author Code »(preview ») Files require Wolfram CDF Player or Mathematica.

#### Related Topics

 RELATED RESOURCES
 The #1 tool for creating Demonstrations and anything technical. Explore anything with the first computational knowledge engine. The web's most extensive mathematics resource. An app for every course—right in the palm of your hand. Read our views on math,science, and technology. The format that makes Demonstrations (and any information) easy to share and interact with. Programs & resources for educators, schools & students. Join the initiative for modernizing math education. Walk through homework problems one step at a time, with hints to help along the way. Unlimited random practice problems and answers with built-in Step-by-step solutions. Practice online or make a printable study sheet. Knowledge-based programming for everyone.