Finding the probability of winning an interrupted game.

conditional probabilityprobability

I came across this question in James Stewart's Probability and Statistics (page 80, question 3).

The Question:

A game between two players consists of tossing a coin. Player A gets a point if the coin shows heads, and Player B gets a point if it shows tails. The first player to get six points wins an $8000 jackpot. As it happens, the police raid the place when player A has five points and B has three points. After everyone has calmed down, how should the jackpot be divided between the two players? In other words, what is the probability of A winning if the game were to continue?
The French mathematicians Pascal and Fermat corresponded about this problem, and both
came to the same correct conclusion (though by very different reasonings). Their friend
Roberval disagreed with both of them. He argued that Player A has probability of winning,
because the game can end in the four ways H, TH, TTH, TTT, and in three of these, A wins.
Roberval’s reasoning was wrong.

My Attempt:

My reasoning to solve this question is similar to that of Roberval's. Since the game can end in 4 ways, out of which 3 ways are favorable for A, the winning probability of A should be 3/4. But, then I tried to stimulate the playing conditions using a C++ program below:

#include <iostream>
#include <stdlib.h>

using namespace std;

void play();
void aScores();

long int a = 5, b = 3, i;
int r;
float aWins = 0.0, bWins = 0.0, n = 10000.0;

/* 
 n is the number of times the program simulates the situation.
 a denotes Player A. According to initial conditions A has 5 points.
 b denotes Player B. According to initial conditions B has 3 points.
 r stores the random number.
 A scores a point if the random number is even.
 B scores a point if the random number is odd.
 The first player to score 6 points wins.
 aWins and bWins count the number of wins Player A and Player B gets respectively.
*/

int main()
{
    for (i = 0; i < n; i++)
    {
        cout << "\nNEW RUN-----------------------------------------\n";
        play();
        if (a == 6)
            aScores();
        else
        { //b=4
            cout << " B socres a point. \n    A = " << a << "\n    B = " << b << endl;
            play();
            if (a == 6)
                aScores();
            else
            { //b=5
                cout << " B socres a point. \n    A = " << a << "\n    B = " << b << endl;
                play();
                if (a == 6)
                    aScores();
                else
                { //b=6
                    cout << " B socres a point. \n    A = " << a << "\n    B = " << b << endl;
                    bWins++;
                    cout << " B wins.\n";
                    a = 5;
                    b = 3;
                }
            }
        }
    }
    float aPer, bPer; // stores the percentage of winnings of both players.
    aPer = (aWins / n) * 100;
    bPer = (bWins / n) * 100;
    cout << "\nA wins " << aWins << " times. (" << aPer << ")\%" << endl;
    cout << "B wins " << bWins << " times. (" << bPer << ")\%" << endl;
    return 0;
}

void play()
{
    r = rand();
    cout << " Random no:" << r << endl;
    if (r % 2 == 0) //denotes head, A scores
        a++;
    else //denotes tail, B scores
        b++;
}

void aScores()
{
    cout << " A socres a point. \n    A = " << a << "\n    B = " << b << endl;
    aWins++;
    cout << " A wins.\n";
    a = 5;
    b = 3;
}

On running the program for few values of n I got the following results:

|    Values of n |        A wins |        B wins | Winning Percentage of A |
| -------------: | ------------: | ------------: | :---------------------: |
|          1,000 |           887 |           113 |         88.700          |
|         10,000 |         8,754 |         1,246 |         87.540          |
|        100,000 |        87,445 |        12,555 |         87.440          |
|      1,000,000 |       874,772 |       125,228 |         87.477          |
|  1,000,000,000 |   874,995,405 |   125,004,595 |         87.499          |
| 10,000,000,000 | 8,749,967,956 | 1,250,032,044 |         87.499          |

The probability of A winning the game is more than my expected 0.75.

Please elaborate how to calculate the probability of Player A winning the game correctly.

Best Answer

Your mistake is assuming all four cases you list are equally probable. The chance of $H$ is $\frac 12$. The only way $B$ wins is for the first three tosses to all be tails, which has a chance of $(\frac 12)^3=\frac 18=0.125$. So, probability of A wining the game is 0.875, which is in good agreement with your simulation. $A$ wins with $H, TH,$ or $TTH$, with probabilities $\frac 12, \frac 14$, and $\frac 18$ respectively.

Related Question