# Consider the following gambling game. There are 5 stages to the game. In the first stage there is a fee to play of \$1. If you pay this fee, a fair…

4. Consider the following gambling game. There are 5 stages to the game. In the first stage there is a fee to play of \$1. If you pay this fee, a fair coin is flipped. If the flip yields a tails, the game stops with H =0 and you get 2H =20 =1. If it turns heads, H is incremented to H =1 and you have two options. You can either decide to stop at this point and take a winnings of 2H = 2 (where H = 1 is the number in your string of heads so far), or you can continue on to the next stage. If you continue to the next stage, the fee at the 2nd stage of the game rises to \$2. If you pay this, the coin is flipped again. If it is a tails, the game stops and you are paid 2H =\$2. If you get another heads, the game can continue and H is increased to H = 2. You can either decide to stop at this point and collect 2H =\$4, or continue to the third stage. At the third stage the fee for playing rises to \$3. If you get a tails, the game stops and you get 2H =\$4. If you get a heads, your cumulative head count increases to H = 3 and you can decide whether to stop and collect 2H = 8 or continue to the 4th stage, where the fee increases to \$4. If the flip yields a tails, you get 2H=\$8, and if it is a heads we increment H to H = 4 and you have the option to continue to the 5th and final stage. The fee to continue to the 5th stage is \$5. If you pay this and get a tails, the game ends and your payoff is 2H = 16, but if you get a heads your H is incremented to H = 5 and your payoff is 2H = 32 (not including the fees for playing each stage). Determine the optimal gambling strategy: under which conditions should you continue playing and when should you stop? Should you pay to play at the very first stage of the game? Assume that you are risk neutral and are trying to maximize the expected winnings from playing the game. Calculate the amount you would expect to win, net of costs of paying to play at each stage, from playing this game “optimally”. (Hint: use dynamic programming to solve the game by backward induction).