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.

# Tree diagrams and conditional probability

## 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

## 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

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

## 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

Question 5
Find the probability that a randomly selected bag triggers the alarm.
P, left parenthesis, start text, A, end text, right parenthesis, equals

Question 6
Given a randomly chosen bag triggers the alarm, what is the probability that it contains a forbidden item?
P, left parenthesis, start text, F, end text, vertical bar, start text, A, end text, right parenthesis, equals

## 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

Step 2
Find the probability that a random patient tests positive.
P, left parenthesis, start text, plus, end text, right parenthesis, equals

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