Conditional Probability

A conditional probability is the probability of an event, given that another event is known to have happened. Knowing that the second event happened rules out some outcomes, so the probability can change.

Our example is a medical test. A condition affects 1 person in 100, and there is a test for it. Of the people who have the condition, 9 in 10 test positive. Of the people who do not have it, 1 in 10 test positive. A person tests positive. We want the probability that this person has the condition, given the positive test.

Count the people

We find this probability first for a crowd, because people in a crowd can be counted. In the figure, 1000 people take the test one after another.

We look only at the two positive stacks, because we know the person tested positive. At the end, 9\red{9} of these people have the condition and 99 do not. So 9\red{9} of the 108 people who test positive have the condition, which is about 8%.

A positive test for a person who does not have the condition is called a false positive. Only 1 in 10 of the people without the condition get one, and 9 in 10 of the people with the condition test positive. However, only 1 person in 100 has the condition, which is 10 of the 1000 people. The positive tests from people with the condition and the false positives are therefore

910×10=9and110×990=99.\frac{9}{10} \times 10 = \red{9} \qquad\text{and}\qquad \frac{1}{10} \times 990 = 99.

The definition

Let AA and BB be events with P(B)>0P(B) > 0. The conditional probability of AA given BB is

P(A∣B)=P(A∩B)P(B),(1)P(A \mid B) = \frac{P(A \cap B)}{P(B)}, \tag{1}

where A∩BA \cap B is the event that both happen. The denominator keeps only the outcomes in BB, and the numerator keeps the outcomes of AA that are also in BB.

We apply the definition to the count. Choose one of the 1000 people at random. Let DD be the event that the person has the condition, and let TT be the event that the person tests positive. Then P(D∣T)P(D \mid T) is the probability that the person has the condition, given that the person tested positive. This is the probability we want.

Of the 1000 people, 108 test positive, and 9\red{9} both have the condition and test positive. So P(T)=108/1000P(T) = 108/1000 and P(D∩T)=9/1000P(D \cap T) = \red{9}/1000, and (1) gives

P(D∣T)=P(D∩T)P(T)=9/1000108/1000=9108=112.\begin{aligned} P(D \mid T) &= \frac{P(D \cap T)}{P(T)} \\[6pt] &= \frac{\red{9}/1000}{108/1000} \\[6pt] &= \frac{\red{9}}{108} = \frac{1}{12}. \end{aligned}

Of the people who test positive, 1 in 12 has the condition. This is the share from the count, because the 1000 cancels.

The total cancels whenever every outcome is equally likely (each of the 1000 people, each face of a die). Then P(A∣B)P(A \mid B) is the number of outcomes in both AA and BB, divided by the number of outcomes in BB.

The tree

A probability tree is a diagram of every possible outcome when events happen one after another. It branches once for each result an event can have, so each path from the start to an end is one possible outcome.

Each branch carries the probability of its result, given the branches before it. The probability of a path is the product of the probabilities along it. This is the multiplication rule, which is (1) with both sides multiplied by P(B)P(B):

P(A∩B)=P(B) P(A∣B).(2)P(A \cap B) = P(B)\,P(A \mid B). \tag{2}

We draw the tree for the test. The first event is whether the person has the condition, and the second event is the test result. The three numbers we were given go on the branches:

On paper Draw this tree, with a probability on every branch and the product at the end of every path. Then compare it with the figure.

Two paths end in a positive test, and no person follows both, so we add their probabilities: P(T)=9/1000+99/1000=108/1000P(T) = 9/1000 + 99/1000 = 108/1000. Only the first of the two goes through the condition, so P(D∩T)=9/1000P(D \cap T) = \red{9}/1000, and (1) gives

P(D∣T)=P(D∩T)P(T)=9/1000108/1000=112.\begin{aligned} P(D \mid T) &= \frac{P(D \cap T)}{P(T)} \\[6pt] &= \frac{\red{9}/1000}{108/1000} \\[6pt] &= \frac{1}{12}. \end{aligned}

This is the answer from the count. The tree needed no crowd, only the three probabilities.

P(T∣D)P(T \mid D) and P(D∣T)P(D \mid T) are different probabilities. P(T∣D)=9/10P(T \mid D) = 9/10 is the probability of a positive test for a person who has the condition. P(D∣T)=1/12P(D \mid T) = 1/12 is the probability of the condition for a person who tests positive.

Practice

Work each problem on paper before opening its solution.

Problem 1

Two dice that add to 8

A red die and a blue die are rolled. The sum of the two numbers is 8.

Draw a grid with one row for each number on the red die and one column for each number on the blue die, so that each of the 36 cells is one outcome. Shade every cell where the sum is 8. Then circle the shaded cells where at least one die shows a 6.

Find the probability that at least one die shows a 6, given that the sum is 8, as an exact fraction.

Solution

Step 1: Count the outcomes

The grid has 36 cells. Each die is equally likely to show each of its numbers, so every cell has probability 1/361/36.

Step 2: Keep the cells where the sum is 8

Let BB be the event that the sum is 8. With the red die written first, its cells are (2,6)(2,6), (3,5)(3,5), (4,4)(4,4), (5,3)(5,3), and (6,2)(6,2). That is 5 cells, so P(B)=5/36P(B) = 5/36. The other 31 cells did not happen.

Step 3: Count the sixes among them

Let AA be the event that at least one die shows a 6. Of the 5 cells in BB, 2\red{2} are in AA: (2,6)(2,6) and (6,2)(6,2). So P(A∩B)=2/36P(A \cap B) = \red{2}/36.

Step 4: Divide

P(A∣B)=P(A∩B)P(B)=2/365/36=25.\begin{aligned} P(A \mid B) &= \frac{P(A \cap B)}{P(B)} \\[6pt] &= \frac{\red{2}/36}{5/36} \\[6pt] &= \frac{\red{2}}{5}. \end{aligned}

The 36 cancels, so the answer is a count of cells: 2\red{2} of the 5 that are left. The pair 2 and 6 is two cells and the pair 4 and 4 is one cell, which is why the grid keeps the two dice apart.

Answer:

2/52/5

Problem 2

Choir and instruments

A school has 120 students. Of these, 40 play an instrument, 30 sing in the choir, and 20 do both.

Draw a table with two rows (plays an instrument, does not) and two columns (sings in the choir, does not). Write a count in each of the four cells, and write the total beside each row and under each column.

One student is chosen at random. Find each probability as an exact fraction. For each one, write down which cells are counted in the numerator and which in the denominator.

  1. The student plays an instrument and sings in the choir.
  2. The student plays an instrument, given that the student sings in the choir.
  3. The student sings in the choir, given that the student plays an instrument.
Solution

Step 1: Fill in the table

The 20 students who do both go in the first cell. The row of students who play an instrument has 40, so its other cell is 40−20=2040 - 20 = 20. The choir column has 30, so its other cell is 30−20=1030 - 20 = 10. The last cell is what is left of the 120 students, which is 70.

Choir Not choir Total
Plays an instrument 20 20 40
Does not 10 70 80
Total 30 90 120

Step 2: Count all 120 students for "and"

Let II be the event that the student plays an instrument and CC the event that the student sings in the choir. Nothing is known about the student, so the denominator is all 120 students:

P(I∩C)=20120=16.P(I \cap C) = \frac{\red{20}}{120} = \frac{1}{6}.

Step 3: Count only the choir column

Given that the student sings in the choir, the student is one of the 30 in the choir column, so

P(I∣C)=2030=23.P(I \mid C) = \frac{\red{20}}{30} = \frac{2}{3}.

This is (1) from the lesson, 20/12030/120\dfrac{20/120}{30/120}, with the 120 canceled.

Step 4: Count only the instrument row

Given that the student plays an instrument, the student is one of the 40 in the first row, so

P(C∣I)=2040=12.P(C \mid I) = \frac{\red{20}}{40} = \frac{1}{2}.

Step 5: Compare

The three fractions have the same numerator, the 20\red{20} students who do both. The denominators are 120, 30, and 40, because each question counts those 20 among a different group.

"And" counts among everyone. "Given" counts among only the group that is given, and the two given groups here are different, so P(I∣C)P(I \mid C) and P(C∣I)P(C \mid I) are different.

Answer:

1/61/6, 2/32/3, and 1/21/2

Problem 3

At least one six

A red die and a blue die are rolled.

Draw the grid of 36 outcomes twice, with one row for each number on the red die and one column for each number on the blue die. On the first grid, shade the cells where the red die shows a 6. On the second grid, shade the cells where at least one die shows a 6.

Find each probability as an exact fraction.

  1. Both dice show a 6, given that the red die shows a 6.
  2. Both dice show a 6, given that at least one die shows a 6.
Solution

Step 1: Shade the first given event

The red die shows a 6 in one row of the grid. The row has 6 cells.

Step 2: Shade the second given event

At least one die shows a 6 in that row and in one column. The row and the column share the cell (6,6)(6,6), so together they have 6+6−1=116 + 6 - 1 = 11 cells.

Step 3: Divide

Both dice show a 6 in 1\red{1} cell, and that cell is in both shaded regions. Every cell has probability 1/361/36, so the two answers are

1/366/36=16and1/3611/36=111.\frac{\red{1}/36}{6/36} = \frac{\red{1}}{6} \qquad\text{and}\qquad \frac{\red{1}/36}{11/36} = \frac{\red{1}}{11}.

Step 4: Compare

The numerator is the same cell both times. The second given event is true for 11 outcomes and not 6, so that one cell is a smaller share of them.

"The red die shows a 6" names a die, so only the blue die is left to ask about, and it shows a 6 with probability 1/61/6. "At least one die shows a 6" does not say which die, so it also keeps the 5 outcomes where only the blue die shows a 6.

Answer:

1/61/6 and 1/111/11

Problem 4

Two batteries from a drawer

A drawer holds 6 batteries that look the same, and 2 of them are dead. We take out two batteries without looking, one after the other. The first goes into a flashlight. The second goes into a battery tester.

Draw the tree: first whether the first battery is dead, then whether the second battery is dead. Write a probability on every branch and the product at the end of every path.

Find each probability as an exact fraction.

  1. Both batteries are dead.
  2. The tester shows that the second battery is dead, and the flashlight has not been switched on. Find the probability that the first battery is dead, given that the second is dead.
Solution

Step 1: Draw the tree

Let AA be the event that the first battery is dead and BB the event that the second is dead. The first branches are AA with probability 2/6=1/32/6 = 1/3 and AcA^c with probability 4/6=2/34/6 = 2/3.

The second branches depend on the first, because the first battery is not put back. If the first is dead, 5 batteries are left and 1 is dead, so P(B∣A)=1/5P(B \mid A) = 1/5. If the first is good, 5 are left and 2 are dead, so P(B∣Ac)=2/5P(B \mid A^c) = 2/5.

Step 2: Multiply along the first path

Both batteries are dead along one path. Its probability is the product along it, which is (2) from the lesson with AA as the event that comes first:

P(A∩B)=P(A) P(B∣A)=13×15=115.P(A \cap B) = P(A)\,P(B \mid A) = \frac{1}{3} \times \frac{1}{5} = \frac{1}{15}.

The other three products are 4/154/15, 4/154/15, and 6/15=2/56/15 = 2/5. In the figure each product is the area of a rectangle.

Step 3: Add the paths that end in a dead second battery

The second battery is dead along two paths, and no pair follows both, so

P(B)=115+415=13.P(B) = \frac{1}{15} + \frac{4}{15} = \frac{1}{3}.

This is the same as P(A)P(A). Before either battery is tested, the second is as likely to be dead as the first.

Step 4: Divide

P(A∣B)=P(A∩B)P(B)=1/151/3=15.\begin{aligned} P(A \mid B) &= \frac{P(A \cap B)}{P(B)} \\[6pt] &= \frac{1/15}{1/3} \\[6pt] &= \frac{1}{5}. \end{aligned}

Step 5: What the later draw tells us

The second draw did not change the first battery. It changed what we know about it. The battery in the tester is one of the 2 dead ones, so the battery in the flashlight is one of the other 5, and 1 of those 5 is dead. That is 1/51/5, which is less than the 1/31/3 we had before the test.

Answer:

1/151/15 and 1/51/5

Problem 5

A flagged email

One in ten emails that arrive at an inbox is spam. A filter flags a spam email with probability 3/43/4, and it flags an email that is not spam with probability 1/61/6.

Draw the tree for one email: first whether it is spam, then whether it is flagged. Write a probability on every branch and the product at the end of every path.

An email is flagged. Use the tree to find the probability that it is spam, as an exact fraction.

Solution

Step 1: Draw the tree

Let SS be the event that the email is spam and FF the event that it is flagged. The first branches are SS with probability 1/101/10 and ScS^c with probability 9/109/10. The second branches are FF and FcF^c. The tree has four paths, and the probability of each is the product along it.

The products are also areas. In the figure, the width of a strip is the probability of the first branch and the height of a rectangle is the probability of the second, so the area of each rectangle is one of the four products.

The four products are 3/403/40, 1/401/40, 3/203/20, and 3/43/4. They add to 1, because together the four rectangles fill the square.

Step 2: Add the paths that end in a flag

An email is flagged along two paths: it is spam and flagged, or it is not spam and flagged. No email follows both, so

P(F)=340+320=940.P(F) = \frac{3}{40} + \frac{3}{20} = \frac{9}{40}.

Step 3: Divide

Only the first of those two paths is spam, so P(S∩F)=3/40P(S \cap F) = 3/40 and

P(S∣F)=P(S∩F)P(F)=3/409/40=13.P(S \mid F) = \frac{P(S \cap F)}{P(F)} = \frac{3/40}{9/40} = \frac{1}{3}.

Of the flagged emails, 2 in 3 are not spam, even though the filter catches 3 in 4 of the spam.

Answer:

1/31/3