# Given that the first coin toss resulted in heads, probability that I get n heads total *before* n tails?

Imagine the following experience:

You toss a coin until I get n heads OR n tails. That means that the maximum amount of tosses I will perform is 2n-1. I now want to find the probability that I obtain n heads first, given that the first toin coss was a heads.

The denominator is one half, since the coin is fair. Therefore, the probability I am looking for is 2P(obtain n heads AND first is heads). I've now been trying to count the cardinality of the two sets A and B such that A is the set of all possible games that could have been played in which I obtain n heads and started with a head, and B is the set of all possible games that could have been played total.

My approach to count A: Consider a multiset with n-2 heads (two heads have been used up for the first and last game) and i tails. We can now take the sum from i=0 to n-1 of the permutation of that multiset.

Same for B, but we consider the multiset with n-1 heads and i tails. (one head has been used up as the first game)

Divide the cardinality of A by the cardinality of B. Multiply the result by 2. This is my current result to the problem.

However, I'm pretty sure that it is wrong, as I wrote a simulation to this problem that gives me a different probability. Any tips?

In order for $n$ heads to occur before $m$ tails, we would need to flip $n$ heads in the first $n+m-1$ trials, this is because if we flip $n$ heads, then at most $m-1$ tails could have occurred, whereas if we flipped less than $n$ heads, then at least $m$ tails would have to have occurred to fill in the remaining trials, in which case $n$ heads do not appear before $m$ tails. Since the probability of obtaining exactly $k$ heads out of $n+m-1$ trials is $$\binom {n+m-1}{k}\left(\frac 12\right)^k\left(\frac 12\right)^{n+m-1-k}$$ the probability you are after can be expressed as $$\sum_{k=n}^{n+m-1} \binom {n+m-1}{k}\left(\frac 12\right)^k\left(\frac 12\right)^{n+m-1-k}$$ Setting $m=n$ and simplifying we get $$\mathbb{P}(n \text{ heads before } n \text{ tails})=\sum_{k=n}^{2n-1} \binom {2n-1}{k}\left(\frac 12\right)^{2n-1}$$