Example
We have two boxes.
a) The first contains two green balls and seven red balls
b) The second contains four green balls and three red balls.
Bob selects a ball by first choosing one of the two boxes at random.
He then selects one of the balls in this box at random.
If Bob has selected a red ball, what is the probability that he selected a ball from the first box?
Solution: Let
a) be the event that Bob has chosen a red ball
b) be the event that Bob has chosen a green ball
c) be the event that Bob has chosen a ball from the first box
d) be the event that Bob has chosen a ball from the second box. We want to find , the probability that the ball Bob selected came from the first box, given it is red

a) The first contains two green balls and seven red balls
b) The second contains four green balls and three red balls.
Bob selects a ball by first choosing one of the two boxes at random.
He then selects one of the balls in this box at random.
If Bob has selected a red ball, what is the probability that he selected a ball from the first box?
Solution: Let
a) be the event that Bob has chosen a red ball
b) be the event that Bob has chosen a green ball
c) be the event that Bob has chosen a ball from the first box
d) be the event that Bob has chosen a ball from the second box. We want to find , the probability that the ball Bob selected came from the first box, given it is red

Bayes’ Theorem
Suppose that and are events from a sample space such that and . ThenExample
Suppose that one person in 100,000 has a particular rare disease for
which there is a fairly accurate diagnostic test. This test is correct 99.0%
of the time when given to a person selected at random who has the
disease; it is correct 99.5% of the time when given to a person selected
at random who does not have the disease. Given this information can
we finda) the probability that a person who tests positive for the disease has the disease?b) the probability that a person who tests negative for the disease does not have the disease?Should a person who tests positive be very concerned that he or she
has the disease?
Solution:Leta) be the event that a person selected at random has the diseaseb) be the event that a person selected at random tests positive for the disease.We want to compute . To use Bayes’ theorem to compute , we need to find , , , and .In part (a) we showed that only 0.2% of people who test
positive for the disease actually have the disease. People
who test positive for the diseases should not be overly
concerned that they actually have the disease
Solution:Leta) be the event that a person selected at random has the diseaseb) be the event that a person selected at random tests positive for the disease.We want to compute . To use Bayes’ theorem to compute , we need to find , , , and .
We know that one person in 100,000 has this disease, so and .
Because a person who has the disease tests positive 99% of the time, we know that .
This is the probability of a true positive, that a person with the disease tests positive. It follows that ; this is the probability of a false negative, that a person with the disease tests negative.
Furthermore, because a person who does not have the disease tests negative 99.5% of the time, we know that . This is the probability of a true negative, that a person without the disease tests negative.
Finally, we see that . This is the probability of a false positive, that a person without the disease tests positive.
The probability that a person who tests positive for the disease actually has the disease is . By Bayes’ theorem, we have
Because a person who has the disease tests positive 99% of the time, we know that .
This is the probability of a true positive, that a person with the disease tests positive. It follows that ; this is the probability of a false negative, that a person with the disease tests negative.
Furthermore, because a person who does not have the disease tests negative 99.5% of the time, we know that . This is the probability of a true negative, that a person without the disease tests negative.
Finally, we see that . This is the probability of a false positive, that a person without the disease tests positive.
The probability that a person who tests positive for the disease actually has the disease is . By Bayes’ theorem, we have
The probability that someone who tests negative for the disease does not have the disease is . By Bayes’ theorem, we know that
Consequently, 99.99999% of the people who test negative really do not have the disease.
Consequently, 99.99999% of the people who test negative really do not have the disease.