# Math Help - tricky biased coin flipping question

1. ## tricky biased coin flipping question

I'm having trouble with the following question;

"A biased coin is tossed until more heads then tails appear.
The coin is biased such that it lands on heads with probability 2/3 and tails with probability 1/3

What is the expected number of flips and the variance?"

Any help would be appreciated;

2. Originally Posted by Aaron1097
I'm having trouble with the following question;

"A biased coin is tossed until more heads then tails appear.
The coin is biased such that it lands on heads with probability 2/3 and tails with probability 1/3

What is the expected number of flips and the variance?"

Any help would be appreciated;
I don't know if there is a simple way to do this. I had look up some combinatorial stuff, and do some summations with Maple.

Here goes. The first time that you will toss more heads than tails, you will have made an odd number of tosses. Let's write this as $2n+1$ with $n$ non-negative. If $p$ is the probability of tossing tail and $q$ that of head, you have tossed $n$ tails and $n+1$ heads, and the probability of that is
${1\over 2n+1}\left({2n+1\atop n}\right)q^{n+1}p^n$.
The combinatorial factor in the beginning is the number of ways of tossing heads and tails with the number of heads exceeding the number of tails for the first time at toss $2n+1$. I got this from the Ballot Theorem in William Feller, An Introduction to Probability Theory and Its Applications. Note that
$\sum_{n=0}^\infty{1\over 2n+1}\left({2n+1\atop n}\right)q^{n+1}p^n$
is only equal to 1 if $q>1/2$. Otherwise there is a finite probability that the number of heads will never exceed the number of tails.

The expected number of tosses is now equal to

$\sum_{n=0}^\infty\left({2n+1\atop n}\right)q^{n+1}p^n={2q\over\sqrt{1-4pq}(1+\sqrt{1-4pq})}.$
With $q=2/3$ and $p=1/3$ this becomes equal to 3. For the variance we need

$\sum_{n=0}^\infty(2n+1)\left({2n+1\atop n}\right)q^{n+1}p^n={2q(4pq+\sqrt{1-4pq})\over(1-4pq)^{3/2}(1+\sqrt{1-4pq})},$
which equals 33 with $q=2/3$ and $p=1/3$. The variance is then $33-3^2=24$.