4
$\begingroup$

You and I decide to play a game where we take turns flipping a coin. The first player to flip 10 heads wins the game. Naturally, there is an argument about who should go first.

Simulations of this game show that the player to flips first wins 2% more than the player who flips second. I'd like to make this more precise but have run into some problems.

This isn't a binomial random variable, as there are no fixed number of trials (flip until someone gets 10 heads). How can I model this?

  • 1
    Not sure the rules are clear. Does each player only count their own tosses or do they count each others as well. That is to say, if the first ten tosses are all $H$ (five from each player) does that mean the second player has won or do they each just have a separate running score of $5$?2017-01-20
  • 2
    @lulu The way I have come to understand is that each player is counting their own occurrence of heads. So the game continues if you and I each have flipped 5 heads in the first 10 rounds. The game ends when one player flips their tenth head.2017-01-20
  • 2
    Ok. Well, then what I'd do is to set up a Markov chain. States just keep track of whose turn it is and what the running strings of heads are. Thus they look like $S(i,m,n)$ where $i=1,2$ according to who tosses next and $0≤m,n<10$ according to how many heads each player has in their running string. Thus we start in $S(1,0,0)$. We note that $S(1,m,n)$ goes to $S(2,m+1,n)$ or $S(2,0,n)$ with equal probability. Should be easy to automate...perhaps a bit tedious to do on paper.2017-01-20
  • 0
    $2\%$ ? are you sure? I'm getting much less.2017-01-20
  • 0
    @JorgeFernándezHidalgo between 2 and 3, yes. Player one should have an advantage because in instances where there is a tie, if player 1 flips a heads, player 1 wins.2017-01-20
  • 0
    All of the sufficiently large monte carlo approximations I have run give me a probability really close to $50\%$.2017-01-20
  • 0
    @JorgeFernándezHidalgo I got numbers commensurate with yours. Didn't debug my code thoroughly but it's simple enough.2017-01-20

4 Answers 4

2

(Answer assuming that number of heads obtained need not be consecutive, and the first person obtaining 10 heads wins)

We can solve it using Markov chain, where the transition matrix in case of winning with 2 heads (e.g.) is

$ \left(\begin{array}{l|rrrrrrrrrr} & \textbf{A00} & \textbf{A01} & \textbf{A10} & \textbf{A11} & \textbf{B00} & \textbf{B01} & \textbf{B10} & \textbf{B11} & \textbf{x2} & \textbf{2x} \\ \hline \textbf{A00} & 0 & 0 & 0 & 0 & \frac{1}{2} & 0 & \frac{1}{2} & 0 & 0 & 0 \\ \textbf{A01} & 0 & 0 & 0 & 0 & 0 & \frac{1}{2} & 0 & \frac{1}{2} & 0 & 0 \\ \textbf{A10} & 0 & 0 & 0 & 0 & 0 & 0 & \frac{1}{2} & 0 & 0 & \frac{1}{2} \\ \textbf{A11} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \frac{1}{2} & 0 & \frac{1}{2} \\ \textbf{B00} & \frac{1}{2} & \frac{1}{2} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ \textbf{B01} & 0 & \frac{1}{2} & 0 & 0 & 0 & 0 & 0 & 0 & \frac{1}{2} & 0 \\ \textbf{B10} & 0 & 0 & \frac{1}{2} & \frac{1}{2} & 0 & 0 & 0 & 0 & 0 & 0 \\ \textbf{B11} & 0 & 0 & 0 & \frac{1}{2} & 0 & 0 & 0 & 0 & \frac{1}{2} & 0 \\ \textbf{x2} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \\ \textbf{2x} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \end{array}\right) $

''2x'' is the state where first player wins.

''A10'' means it's first player's turn, with that player having thrown 1 head and the second player hasn't thrown a head yet.

Computing the probability of first player winning when the target is reaching two heads first is $\dfrac{16}{27} \approx 0.592592592592593$ which agrees with a simulation.

Extending this to 10 heads gives the probability of first player winning as $\dfrac{619380496}{1162261467} \approx 0.532909774251339$

A guessing routine shows up the following recurrence form:

\begin{align*} f(n) &= \frac{5 (2 n-3)}{9 (n-1)} f(n-1) -\frac{(n-2)}{9 (n-1)}f(n-2)+\frac{2}{9 (n-1)}\\ f(0) &= 1 \\ f(1) &= \frac{2}{3} \end{align*}

  • 1
    Good guess! I got them all correct up to $f(9)$ and then flubbed $f(10)$. Oh well,...2017-01-28
2

We can play this equivalent game: both players flip simultaneously. Repeat until at least one of the players has flipped heads ten times. If both players flip their tenth head simultaneously, player A wins. Otherwise the player who first flips their tenth head wins.

Let $p$ be the probability that the players simultaneously reach ten heads each. Then the probability that player A wins is $(1+p)/2.$

To reach ten heads simultaneously, the players must each have flipped $9$ heads in the first $n+9$ flips, then both flip heads on flip number $n+10,$ where $n\geq0.$ So $$ p = \sum_{n=0}^\infty \binom{n+9}{9}^2 4^{-(n+10)}. $$ Wolfram Alpha says this is approximately $0.0658195.$ Therefore player A wins with probability approximately $0.53291.$ This agrees with the other answers so far that assume the ten heads do not need to be tossed consecutively.

  • 0
    Your formula for $p$ simplifies to $3^{-10}$ which is nowhere near $.0658$. Did I misunderstand something?2017-01-28
  • 0
    @ByronSchmuland That's because when I copied the formula here earlier, I left out the squaring of the binomial coefficient, although I remembered to square it when I had Wolfram Alpha evaluate it: http://m.wolframalpha.com/input/?i=sum+of+%28%28n%2B9%29+choose+9%29%5E2%2F2%5E%2820%2B2%2An%29+for+n%3D0+to+infinity2017-01-28
1

Basic approach. Since the steps are fairly uniform, you can solve this with a recurrence, looking at the result after each round of flips. We ignore all rounds where both players flip tails, so we're left with probability one-third each of Player $1$ flipping heads, Player $2$ flipping heads, and both players flipping heads. Thus,

$$ p(0, 0) = 1 $$

$$ p(i, -1) = p(-1, j) = 0 \qquad \forall i, j $$

$$ p(i, j) = \frac{p(i-1, j)+p(i, j-1)+p(i-1, j-1)}{3} \qquad \forall i, j \geq 0 \text{ (except $i = j = 0$)} $$

The probability of Player $1$ winning is then

$$ P(\text{Player $1$ wins}) = \sum_{j=0}^{10} p(10, j) $$

This seems like it's easier just to code up a computation than to solve the partial sums analytically. I obtain the same result as @gar.

0

You can model this problem by taking $X_1,X_2,\dots $ and $Y_1,Y_2,\dots$ be independent binary variables with probability $\frac{1}{2}$. Let $t_1$ and $t_2$ be the smallest values such that $X_t,X_{t-1},\dots X_{t-9}$ and $Y_t,T_{t-1},\dots, Y_{t-9}$ are all ones. Let $A$ be the event $t_1\geq t_2$ and let $p(n)$ be the probability that $t_1=n$ ( this is the same as the probability that $t_2=n$).

We have that $P(A)=\sum\limits_{n=1}^\infty\sum\limits_{m=n}^\infty p(n)p(m)=\dfrac{(\sum\limits_{n=1}^\infty p(n))^2+\sum\limits_{n=1}^\infty p(n)^2}{2}=\frac{1}{2}+\sum\limits_{n=1}^\infty \frac{P(n)^2}{2}$.

How do we calculate $p(n)$?

We have $p(10)=2^{-10},P(11)=2^{-11}$ and for $n>11$ we have $p(n)=2^{-11}(1-Q(n-12))$ .

This allows us to approximate $P(A)$ by calculating suffiecently large values of $p(n)$, one can notice that $\sum\limits_{n=N+1}^\infty P(n)^2\leq \sum\limits_{n=N+1}^\infty P(n)$. We can control this last sum quite nicely, notice that the probability that at least one streak appears in the first $N$ throws is at least $1-(1-2^{-10})^{\lfloor N/10 \rfloor}$. So we can give good precision to our approximations.

An approximation with approximately $100,000$ terms yields $0.500061$.

Which I think makes sense, the expected number of throws is $2(2^9-1)=1022$, so $p(n)$ doesn't really concentrate densely around a given set of values. $2\%$ would seem really high to me as the probability that $t_1=t_2$.

here is the code used for the approximation:

#include 
using namespace std;

const int MAX=10000010;
double P[MAX];
double Q[MAX];

int main(){
    for(int n=10;n11) P[n]=pow(0.5,12)*(1-Q[n-12]);
        Q[n]=Q[n-1]+P[n];
    }
    double res=0;
    for(int i=0;i