Associated Topics || Dr. Math Home || Search Dr. Math

### Coin Flipping: Confusing Mean and Median

Date: 01/31/2003 at 11:27:53
From: Chris
Subject: A probability dilemma

When I calculate the probability of getting 4 heads in a row in
twenty coin tosses using the information provided here:

Consecutive Failures in Bernoulli Trials
http://mathforum.org/library/drmath/view/56637.html

the answer is about 50%. However, when I calculate the expected value
of getting 4 heads in a row using the method provided here:

http://mathforum.org/library/drmath/view/56672.html

the answer is 30 coin tosses. How can this be?

The expected number of coin tosses T needed to get n tosses in a row
should be equal to the probability of getting n tosses in a row in T
tosses, shouldn't it?

I've looked at the definitions used and I'm not clear why the first
case should be smaller. I've re-checked the calculations a number of
times. For the first one, this is the equation for this problem:
1-((1-.5*1.04)/(5/2-4/2*1.04))*(1/1.04^21) For the second one:
x=1/2(1+x)+1/4(2+x)+1/8(3+x)+1/16(4+x)+1/16(4)
x=15/8*16 = 30

Date: 01/31/2003 at 12:07:36
From: Doctor Roy
Subject: Re: A probability dilemma

Hi,

Thanks for writing to Dr. Math.

I think you're getting expected value, or mean, confused with median.
You are expecting the mean to be the point where half the "weight" of
the probability (or 1/2) falls.  This is definitely NOT always the
case.

20 flips is the point where it is equally likely for you to get 4
heads in a row or not. In other words, if you flip a coin 20 times
over and over again and mark whether or not you get 4 heads in a row,
you will find that half of the time it occurs, and it does not occur
the other half of the time (assuming you run this test many, many
times). So for each trial, the only thing you measure is "yes" or "no"
for each set of 20 flips.  The number of yes's should be half the
total number of trials. Note that sometimes (about 1/2 the time) you
don't see 4 heads in a row at all.

30 flips is the expected number of times you must flip the coin to get
4 heads in a row. This is different. In this setup, you flip a coin
until you see 4 heads in a row. Sometimes (very rarely), you only have
to flip the coin 4 times. Sometimes (very, very rarely), you have to
flip the coin an infinite number of times. If you keep track of the
number of times you flip the coin until you see 4 heads in a row and
average the flips, you will find that it gets really close to 30 (if
you run this test many, many times). So for each trial, you measure a
number. You always see 4 heads in a row but then immediately stop, so
you see a different number of flips to get to it.

The "mean" or expected number of flips, is not always the point where
half the time you get a success and the other half you get failure. It
is the average number of flips it takes to get success. The "median"
is the number of flips where half the time you get success.

The key difference is that with the median, you always flip 20 times.
The first 4 times may all be heads, but you still keep flipping. In
fact, you may see 10 heads in a row, but you still keep flipping. Or
the first 4 and last 4 may all be heads, but you still keep flipping.
With the mean, you immediately stop once you see 4 heads in a row.
There is not a chance you see more than 10 heads in a row, or that it
comes up twice.

Does this help?  Please feel free to write back with any questions you
may have.

- Doctor Roy, The Math Forum
http://mathforum.org/dr.math/

Date: 01/31/2003 at 13:12:34
From: Chris
Subject: Thank you (A probability dilemma)

Yes, that's a great help, thanks. Honestly, I still find it
unintuitive how you can 'expect' 4 in a row after 30 throws but have a
50% chance of getting them after 20. But you have shown me how the
definitions of mean/expectation and median lead to this difference.

Thanks again.
- Chris

Date: 01/31/2003 at 13:33:48
From: Doctor Roy
Subject: Re: Thank you (A probability dilemma)

Hi,

I think the biggest concept to understand is the difference in the
"type" of throws.

The 50% chance means the 4 in a row can occur anywhere.

For instance,  we could have the sequence:

HHHHTHTHTTTTTTHHHTTT

In this sequence we get 4 heads in a row at the beginning.

For the 30 throws, we never get a sequence of throws like this.  If we
see 4 heads in a row at the beginning, we say that we count 4 throws
in the beginning, or:

HHHH = 4 throws

HHHHT = 4 throws (since it only took 4 to get 4 in a row).

When we "count" 20 throws in this second scheme, we only see 4 heads
in a row at the end, or something like:

HTHHHTTTHTHTHTHTHHHH

We are really counting different probabilities in both cases. The
first probability is what is the number of throws so that you see 4
heads in a row "anywhere" in the throws with 50% chance.

The second probability is what is the most number of throws so that
you see exactly 4 heads in a row "at the end" of the throws with 50%
chance.

The first says that you see 4 in a row "anywhere" or beginning,
middle, end (or even 8 in a row or more) in 20 throws with 50% chance.
We always throw exactly 20 times. And we don't care about more than
4 heads in a row or 4 heads in a row occurring twice in the 20 throws.

The second says that you see 4 in a row "only at the end" in 30 or
fewer throws with 50% chance.  It's the fewer that really catches you.
With a 50% chance, we see 4 in a row with 4, 5, 6, ....., or 30
throws. So, half the time, we only need to throw FEWER than 30 times.

It's this difference between exactly 4 and at least 4 that really
causes confusion.  With 20 throws, we see "at least" 4 heads in a
row.  We still allow the possibility that "all" the throws could be
indeterminate number of throws. In the first case, we allow the number
of heads to vary (but keep the number of throws constant). In the
second case, we allow the number of throws to vary (but keep the
number of heads constant). By calculating for the randomness of two
different things, we get two different answers.

- Doctor Roy, The Math Forum
http://mathforum.org/dr.math/

Date: 01/31/2003 at 13:42:28
From: Chris
Subject: Thank you (A probability dilemma)

I see... that definitely clears it up. Thanks so much for

- Chris.
Associated Topics:
College Probability

Search the Dr. Math Library:

 Find items containing (put spaces between keywords):   Click only once for faster results: [ Choose "whole words" when searching for a word like age.] all keywords, in any order at least one, that exact phrase parts of words whole words

Submit your own question to Dr. Math
Math Forum Home || Math Library || Quick Reference || Math Forum Search