Google Answers Logo
View Question
Q: Probability Theory ( Answered 5 out of 5 stars,   1 Comment )
Subject: Probability Theory
Category: Science > Math
Asked by: asadmu-ga
List Price: $10.00
Posted: 17 Jan 2005 17:45 PST
Expires: 16 Feb 2005 17:45 PST
Question ID: 458945
Suppose that you continue to toss a coin, having probability p of
coming up heads, until atleast one head and one tail have been
observed. (a) Find the expected number of tosses needed (b) Find the
expected number of tosses that come up heads
Please show all work (even the small steps)
Subject: Re: Probability Theory
Answered By: elmarto-ga on 17 Jan 2005 19:45 PST
Rated:5 out of 5 stars
Hi asadmu!
In order to solve this problem, we'll make use of the geometric distribution.

Geometric Distribution

The geometric distribution answers a question that is similar to
yours: given an experiment with two possible outcomes
(success-failure, or heads-tails), what's the probability that the
experiment must be repeated "x" times before a success is observed?

The geometric distribution is determined by the following equation:

f(x) = p*(1-p)^(x-1)  , for x>=1

For example, what's the probability that only 1 toss is needed?
It's f(1) = p*(1-p)^0 = p; or in other words, the probability of
observing a success. Similarly, the probability of needing 2 tosses
turns out to be p*(1-p), which is the probability of observing one
failure [probability (1-p)] and one success [probability p].

As you can see in the link I provided above, the expected value of a
geometrically distributed random variable is 1/p.

Let's see how this applies to your question. Let's define p as the
probability of getting heads, so (1-p) is the proabbility of getting
tails. It's clear that you will need to make at least 2 coin tosses in
order to see at least one heads and one tails.

Let's assume now that we have already made the first toss and it
turned out to be tails. We're now about to make our second toss. Since
we've already observed a tails, we should now toss the coin until a
heads is observed. Therefore, notice that, given that the first toss
turned out to be tails, the number of tosses we now need in order to
see a heads is simply a random variable with a geometric distribution,
where "success" is getting a heads, which has probability p. Since we
know the expected value of a geometrically distributed random
variable, we can now say that if the first toss is tails, we'll need
1/p more tosses in order to get a heads. So we'll need a total of (1/p
+ 1) tosses in this case.

What happens, on the other hand, if the first toss results in a heads?
Now we should continue tossing the coin until a tails is observed.
Therefore, the number of tosses we need to make now is a random
variable with a geomtric distribution, where "success" is getting a
*tails*, which has probability (1-p). Therefore, the expected value of
the number of tosses we'll need to make (counting from the second one)
is simply 1/(1-p). So we'll need a total of (1/(1-p) + 1) tosses in
this case.

Now we can easily calculate the expected number of tosses needed to
get both a heads and a tails, before the first toss is made. We
already know that in the first case, we'll need 1/p+1 tosses, and in
the second case, we'll need 1/(1-p)+1. Since the probability of the
first case is (1-p) (the first case is observing a tails in the first
toss) and the probability of the second case is p, the expected number
of tosses needed top observe both heads and tails is:

  (1-p)*(1/p+1) + p*(1/(1-p)+1)
= (1-p)/p + (1-p) + p/(1-p) + p
= (1-p)/p + p/(1-p) + p + 1 - p
= (1-p)/p + p/(1-p) + 1

So the answer to question (a) is (1-p)/p + p/(1-p) + 1

We can use a similar framework in order to answer question (b).

Let's assume as before that we've already made the first toss and are
about to make the second one. The first toss results in a tails. How
many heads should we expect to see by the time the experiment ends?
It's clear that if the first toss resulted in a tails, then we will
only see 1 heads, because when we get heads the experiment will end
(we already got a heads and a tails).

What happens now if the first toss comes up heads? We saw before that
the expected value of tosses needed until the coin comes up tails in
this case is 1/(1-p). Or, in other words, we expect the coin to come
up heads 1/(1-p)-1 times (after the first toss) before we get a tails.
Therefore, counting the first toss, in this case the expected number
of heads is 1/(1-p)-1+1=1/(1-p).

Finally, in order to get the expected number of time that coin will
come up heads before making the first toss, we simply multiply the
expected value in each case by the probability of each case and sum
them, just like before:

 (1-p)*1 + p*(1/(1-p))
=p/(1-p) + (1-p)

So the expected number of tosses that come up heads is p/(1-p)+(1-p).

Google search terms
"geometric distribution"

I hope this helps! If you have any doubt regarding my answer, please
don't hesitate to request clarification before rating it. Otherwise, I
await your rating and final comments.

Best wishes!

Request for Answer Clarification by asadmu-ga on 17 Jan 2005 23:15 PST
Hello almarto thanks for the reply.. i need some clarififcation: 
This is the way i though about the question:
for part a)

Let N = # of tosses needed N>=2

Pr{N=k)=Pr{N=k|head first}*Pr{head first}+Pr{N=k|tail first}*Pr{tail first}
then E[N]= sum from k=2 to infinity k*Pr{N=k)

and then i get (1/p(1-p))-1

Which is different from yours.. 

Your logic is the same as mine but we get different answers.. Can you
please scrutinize this? Did i go wrong in the summation?

part b)

M=# of tosses that come up heads, then from the result in (a) M>=1

Pr{M=k}=Pr{N=k+1|head first}Pr{head first}=p^k(1-p)


Pr{M=1}=Pr{N=2|head first}*Pr{head first} + Pr{N=2 or 3 or 4 ....|tail
first)*Pr{tail first}

so E[M]=1*Pr{M=1} + summation of k=2 to infinity k*Pr{M=k)
=1-p^2+summation of k=2 to infinity kp^k(1-P)=1-p+(p/1-p)

Please chack out my answer... Please help! Thanks


Clarification of Answer by elmarto-ga on 18 Jan 2005 07:40 PST
Hi asadmu!
As a matter of fact, we got the exact same results :-)

My answer for (a) was:

(1-p)/p + p/(1-p) + 1


   (1-p)^2 + p^2 
  -------------- + 1

= -------------- + 1

    1 - 2p(1-p)
= -------------- + 1

= --------- - 1

which is the results you reported.

In question (b) I got:

p/(1-p) + (1-p)

while you state you got 1-p+(p/1-p), which is of course the same.

It's true that I used a more "intuitive" approach to explain my
answer, but we did basically the same steps in order to arrive to the

If you have any further questions, please let me know.

Best wishes!
asadmu-ga rated this answer:5 out of 5 stars
Thanks that was great...!

Subject: Re: Probability Theory
From: readerlife-ga on 08 Dec 2005 23:56 PST
I've always been confused by this question.
You take your coin and flip it, having a 1/2 chance of it landing on heads.
You flip it again, having a 1/2 chance of it landing on heads.
So on and so forth until your 100th flip.
Now assume you have managed to get 99 heads up to this point. What is
the probability to get another head in the 100th toss?
Theoretically, because each toss is independent, it should be again
50%. But probability theory also tells us that in the long run, the
tendency should be half heads and half tails. So, we got 99 heads
already, but it doesn't increase the chance of getting a tail next
toss. Then, how could the probability structure of half-half be
demonstrated anyway?

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  

Google Home - Answers FAQ - Terms of Service - Privacy Policy