If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Tree diagrams and conditional probability

AP.STATS:
VAR‑4 (EU)
,
VAR‑4.D (LO)
,
VAR‑4.D.1 (EK)
,
VAR‑4.D.2 (EK)
CCSS.Math: , , ,

Example: Bags at an airport

An airport screens bags for forbidden items, and an alarm is supposed to be triggered when a forbidden item is detected.
  • Suppose that 5, percent of bags contain forbidden items.
  • If a bag contains a forbidden item, there is a 98, percent chance that it triggers the alarm.
  • If a bag doesn't contain a forbidden item, there is an 8, percent chance that it triggers the alarm.
Given a randomly chosen bag triggers the alarm, what is the probability that it contains a forbidden item?
Let's break up this problem into smaller parts and solve it step-by-step.

Starting a tree diagram

The chance that the alarm is triggered depends on whether or not the bag contains a forbidden item, so we should first distinguish between bags that contain a forbidden item and those that don't.
"Suppose that 5, percent of bags contain forbidden items."
Question 1
What is the probability that a randomly chosen bag does NOT contain a forbidden item?
P, left parenthesis, start text, n, o, t, space, f, o, r, b, i, d, d, e, n, end text, right parenthesis, equals
  • Your answer should be
  • an integer, like 6
  • a simplified proper fraction, like 3, slash, 5
  • a simplified improper fraction, like 7, slash, 4
  • a mixed number, like 1, space, 3, slash, 4
  • an exact decimal, like 0, point, 75
  • a multiple of pi, like 12, space, start text, p, i, end text or 2, slash, 3, space, start text, p, i, end text

Filling in the tree diagram

"If a bag contains a forbidden item, there is a 98, percent chance that it triggers the alarm."
"If a bag doesn't contain a forbidden item, there is an 8, percent chance that it triggers the alarm."
We can use these facts to fill in the next branches in the tree diagram like this:
Question 2
Given that a bag contains a forbidden item, what is the probability that it does NOT trigger the alarm?
question mark, start subscript, 1, end subscript, equals
  • Your answer should be
  • an integer, like 6
  • a simplified proper fraction, like 3, slash, 5
  • a simplified improper fraction, like 7, slash, 4
  • a mixed number, like 1, space, 3, slash, 4
  • an exact decimal, like 0, point, 75
  • a multiple of pi, like 12, space, start text, p, i, end text or 2, slash, 3, space, start text, p, i, end text

Question 3
Given that a bag does NOT contain a forbidden item, what is the probability that is does NOT trigger the alarm?
question mark, start subscript, 2, end subscript, equals
  • Your answer should be
  • an integer, like 6
  • a simplified proper fraction, like 3, slash, 5
  • a simplified improper fraction, like 7, slash, 4
  • a mixed number, like 1, space, 3, slash, 4
  • an exact decimal, like 0, point, 75
  • a multiple of pi, like 12, space, start text, p, i, end text or 2, slash, 3, space, start text, p, i, end text

Completing the tree diagram

We multiply the probabilities along the branches to complete the tree diagram.
Here's the completed diagram:

Solving the original problem

"Given a randomly chosen bag triggers the alarm, what is the probability that it contains a forbidden item?"
Use the probabilities from the tree diagram and the conditional probability formula:
P, left parenthesis, start text, f, o, r, b, i, d, d, e, n, space, end text, vertical bar, start text, space, a, l, a, r, m, end text, right parenthesis, equals, start fraction, P, left parenthesis, start text, F, end text, \cap, start text, A, end text, right parenthesis, divided by, P, left parenthesis, start text, A, end text, right parenthesis, end fraction
Question 4
Find the probability that a randomly selected bag contains a forbidden item AND triggers the alarm.
P, left parenthesis, start text, F, end text, \cap, start text, A, end text, right parenthesis, equals
  • Your answer should be
  • an integer, like 6
  • a simplified proper fraction, like 3, slash, 5
  • a simplified improper fraction, like 7, slash, 4
  • a mixed number, like 1, space, 3, slash, 4
  • an exact decimal, like 0, point, 75
  • a multiple of pi, like 12, space, start text, p, i, end text or 2, slash, 3, space, start text, p, i, end text

Question 5
Find the probability that a randomly selected bag triggers the alarm.
P, left parenthesis, start text, A, end text, right parenthesis, equals
  • Your answer should be
  • an integer, like 6
  • a simplified proper fraction, like 3, slash, 5
  • a simplified improper fraction, like 7, slash, 4
  • a mixed number, like 1, space, 3, slash, 4
  • an exact decimal, like 0, point, 75
  • a multiple of pi, like 12, space, start text, p, i, end text or 2, slash, 3, space, start text, p, i, end text

Question 6
Given a randomly chosen bag triggers the alarm, what is the probability that it contains a forbidden item?
Use three decimal places in your answer.
P, left parenthesis, start text, F, end text, vertical bar, start text, A, end text, right parenthesis, equals
  • Your answer should be
  • an integer, like 6
  • a simplified proper fraction, like 3, slash, 5
  • a simplified improper fraction, like 7, slash, 4
  • a mixed number, like 1, space, 3, slash, 4
  • an exact decimal, like 0, point, 75
  • a multiple of pi, like 12, space, start text, p, i, end text or 2, slash, 3, space, start text, p, i, end text

Try one on your own!

A hospital is testing patients for a certain disease. If a patient has the disease, the test is designed to return a "positive" result. If a patient does not have the disease, the test should return a "negative" result. No test is perfect though.
  • 99, percent of patients who have the disease will test positive.
  • 5, percent of patients who don't have the disease will also test positive.
  • 10, percent of the population in question has the disease.
If a random patient tests positive, what is the probability that they have the disease?
Step 1
Find the probability that a randomly selected patient has the disease AND tests positive.
P, left parenthesis, start text, D, end text, \cap, start text, plus, end text, right parenthesis, equals
  • Your answer should be
  • an integer, like 6
  • a simplified proper fraction, like 3, slash, 5
  • a simplified improper fraction, like 7, slash, 4
  • a mixed number, like 1, space, 3, slash, 4
  • an exact decimal, like 0, point, 75
  • a multiple of pi, like 12, space, start text, p, i, end text or 2, slash, 3, space, start text, p, i, end text

Step 2
Find the probability that a random patient tests positive.
P, left parenthesis, start text, plus, end text, right parenthesis, equals
  • Your answer should be
  • an integer, like 6
  • a simplified proper fraction, like 3, slash, 5
  • a simplified improper fraction, like 7, slash, 4
  • a mixed number, like 1, space, 3, slash, 4
  • an exact decimal, like 0, point, 75
  • a multiple of pi, like 12, space, start text, p, i, end text or 2, slash, 3, space, start text, p, i, end text

Step 3
If a random patient tests positive, what is the probability that they have the disease?
Round to three decimal places.
P, left parenthesis, start text, D, end text, vertical bar, start text, plus, end text, right parenthesis, equals
  • Your answer should be
  • an integer, like 6
  • a simplified proper fraction, like 3, slash, 5
  • a simplified improper fraction, like 7, slash, 4
  • a mixed number, like 1, space, 3, slash, 4
  • an exact decimal, like 0, point, 75
  • a multiple of pi, like 12, space, start text, p, i, end text or 2, slash, 3, space, start text, p, i, end text

Want to join the conversation?

  • blobby green style avatar for user Prashant.Kuls
    What is the difference between P(E1 and E2) and P(E1|E2)?
    (10 votes)
    Default Khan Academy avatar avatar for user
    • primosaur seed style avatar for user Ian Pulizzotto
      P(E1 and E2) means the probability that E1 and E2 both occur, given no information about what has already occurred.
      P(E1|E2) means the probability that E1 occurs, given that E2 has already occurred.
      Example: Suppose a box contains 3 white balls and 5 black balls, and two balls are drawn one at a time without replacement. If E2 is the event that the first ball is white and E1 is the event that the second ball is white, P(E1 and E2) = 3/8 * 2/7 = 3/28, but P(E1|E2) = 2/7.

      In general, note that since P(E1|E2) = P(E1 and E2)/P(E2), P(E1|E2) is always greater than or equal to P(E1 and E2).
      (25 votes)
  • blobby green style avatar for user jthabet10
    I'm in grade 8 and my teacher is testing us on these probability trees. For question 2, why are the chances of the test testing falsely to be 0.099 and 0.001?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • hopper happy style avatar for user Adam Simpson
      10% of the population have the disease. Of that 10% of the population 99% test positive. So we are calculating 99% of 10% which is 0.10*0.99=0.099. This is the true positive rate (test positive and actually have the disease).
      Of the 10% of the population that have the disease 1% will have a negative test result. (test negative but actually have the disease). 1% of 10% is 0.10*0.01=0.001.
      (5 votes)
  • blobby green style avatar for user joao.boverio
    So they are not independent right? P(F∣A)=0.392 != P(F) = 0.05 ? But why we an calculate P(F&A) as P(F)*P(A) ? Isn't this case only for independent events?
    (2 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Nicolle West
    In question 6, shouldn't you divide the total of all alarms (49+76) by the total number of forbidden objects, which is 50 and not 49?
    (1 vote)
    Default Khan Academy avatar avatar for user
    • cacteye blue style avatar for user Jerry Nilsson
      It's true that out of 1,000 bags we can assume that 50 of them (5%) contain forbidden items – but only 49 of them (98% of 50) will trigger the alarm.

      Likewise, there are 950 legal bags out of which 76 (8%) will also trigger the alarm.

      So, out of the thousand bags, 49 + 76 = 125 will trigger the alarm, and out of those 125 bags, 49 will contain forbidden items (the 50th forbidden bag will just pass through security without being noticed).

      So, the probability that a bag that triggers the alarm also contains a forbidden item is 49∕125 = 0.392
      (2 votes)
  • leaf green style avatar for user Matevž Zorec
    So if they were to test positive again... we should just use the probability they were sick in the first place from the first positive test to calculate the overall probability they are sick?
    (1 vote)
    Default Khan Academy avatar avatar for user
    • piceratops ultimate style avatar for user ANB
      Good question. If they test positive the first time, that means that there is a 68.75% chance that they have the disease. To calculate the probability that they have the disease after testing positive twice, we use .6875 instead of .05 as we used when trying to calculate the probability the first time.

      If the person tests positive two times in a row for this disease, the chances that they have the disease is 97.76%!
      (1 vote)
  • piceratops seedling style avatar for user Tyler Johnson
    how do you know when to put it in the D(positive)/D(positive)+N(positive)
    (0 votes)
    Default Khan Academy avatar avatar for user
    • purple pi pink style avatar for user Constanca Sousa
      You use the conditional probability formula which is P(A/B) = P(A and B)/P(B). P(A/B) translates to "the probability of A occuring given that B has occured". In the above question they ask "If a random patient tests positive, what is the probability that they have the disease?". In other words, "given that a random patient tests positive, what is the probability....." so usually there will be the command words, "if... what/then" or "given" and that's when you will know that you have to use the conditional probability formula.

      Hope it helps!
      (7 votes)
  • blobby green style avatar for user alfred grainger
    10 red balls are in a bag along with 5 white, 4 blue and 1 green. What is the probability that a white ball is randomly selected from the bag in one pick?
    (1 vote)
    Default Khan Academy avatar avatar for user
  • aqualine ultimate style avatar for user Aidenn Frost
    I thought that it taught you what it was. NEVER do proplems.
    (0 votes)
    Default Khan Academy avatar avatar for user