# Lesson Explainer: Conditional Probability: Tree Diagrams Mathematics

In this explainer, we will learn how to use tree diagrams to calculate conditional probabilities.

When working out probabilities for more than one event, it can be helpful to illustrate the problem using a tree diagram. These can be particularly useful when we are looking at conditional probabilities. (Recall that the conditional probability of event is the probability of event given that event has occurred and is written as .)

In our first example, we will use a tree diagram to calculate probabilities for selection without replacement.

### Example 1: Calculating Conditional Probability without Replacement

A bag contains 22 red balls and 15 black balls. Two balls are drawn at random. Find the probability that the second ball is black given that the first ball is red. Give your answer to three decimal places.

### Answer

We can see from the question that it concerns two events of balls being selected from a bag. As such, it is helpful to use a tree diagram to illustrate this.

As the two balls are being selected either simultaneously, or one after another, then we can treat these events as two consecutive events. So, the first set of branches will have two outcomes: red ball and black ball, to represent the first ball, and the second set of branches will have the same outcomes, but will represent the second ball, as seen below:

As the first ball and the second ball are drawn at the same time, then we can assume that they are selected without replacement. This means that once the first ball is selected, it is not put back in the bag, and this changes the total number of balls in the bag, as well as the number of each color. Therefore, we must consider the outcome of the first ball when calculating the probability of the outcome of the second ball.

We will start calculating the probabilities of the outcomes of the first ball. As there are 22 red balls and 15 black balls, then there are 37 balls in total. For the probability of selecting a red ball we can use the simple rule for probability:

Similarly, the probability of selecting a black ball is:

We can now add this information onto the first branches of the tree diagram as follows:

Notice that the probabilities, which are on the two branches, add up to 1. This must be true for each set of branches in the tree diagram since, at every stage, all possible outcomes are covered by each set of branches.

Next, we will determine the probabilities of the outcomes of the second ball. To do this, we must consider what the first outcome was in order to adjust the number of balls of each color, as well as the total number of balls.

If the first ball was red, then that means there is one fewer red ball in the bag when the second ball is selected. This means that there are now 21 red balls, however, the number of black balls, 15, remains unchanged. This also means that the total number of is now .

The probability that the second ball is red, given the first is red is the number of red balls in the bag (21 now) divided by the total (now 36)

Similarly, the probability that the second ball is black, given the first is red is the number of black balls in the bag (still 15) divided by the total (now 36)

We can add this new information to the tree diagram for the second set of branches that stem from the red branch of the first set.

Again, it is good to check that the pair of branches add up to 1, which they do here.

To find the remaining branches we consider if the first ball was black. If this was the case then there is one fewer black ball in the bag, meaning there are now 14 balls, but the same number of red balls, which was 22 at the start. The total has changed to .

The probability that the second ball is red, given the first is black is the number of red balls in the bag (22 still) divided by the total (now 36)

Similarly, the probability that the second ball is black, given the first is black is the number of black balls in the bag (now 14) divided by the total (now 36)

We can add this new information to the tree diagram for the second set of branches that stem from the black branch of the first set.

Once again, it is good to check that the pair of branches add up to 1, which they do here.

Now we have found all the information needed to fill in the tree diagram then we can determine the probability that the second ball is black given that the first ball is red.

Note that we have already determined this earlier in the question when calculating the second set of branches:

However, it may not always be the case in conditional probability questions using tree diagrams that we can determine this from a branch of the tree diagram, so we will next consider how to use the formula for conditional probability.

The formula for conditional probability states the probability of , given that has occurred is:

In the context of this question, we have the probability that the second ball is black, given that the first ball is red, so the formula is as follows:

Using the tree diagram, we can determine and . For clarity, is the same as .

In order to determine we simply need to read off the first branch of the tree diagram when the first ball is red, which is .

To find , we need to find the probability that the first ball is red, and the second ball is black. We can do this by reading across the tree diagram and then calculating using the formula:

Therefore, .

Having found and we can now substitute into the conditional probability formula

Therefore, the probability that the second ball is black given that the first ball is red is 0.417 correct to 3 decimal places.

Before looking at some other examples, let us remind ourselves of some of the rules of probability that we will need.

### Some Probability Rules and Definitions

For any event , if is the probability of event occurring, we have the following:

Rule 1

Rule 2

Total probability: the sum of the probabilities of all possible outcomes is equal to 1 (or 100%).

The complement of event , written as , refers to everything that is not .

Rule 3

Note: The complement of event is sometimes also written as .

Two events, and , are

• independent if the fact that occurs does not affect the probability of occurring,
• dependent if the fact that occurs does affect the probability of occurring.

Rule 4

For independent events, .

Rule 5

If two events are not independent, however, where is the conditional probability for event , given that event has occurred. If the events and are independent, and

In our next example, we will look at conditional probability applied to the weather, using a tree diagram.

### Example 2: Conditional Probability Applied to the Weather Using a Tree Diagram

The probability that it rains on a given day is 0.6. If it rains, the probability that a group of friends play football is 0.2. If it does not rain, the probability that they play football rises to 0.8.

1. Work out the probability that it rains on a given day and the friends play football.
2. Work out the probability that it does not rain on a given day and the friends play football.
3. What is the probability that the friends will play football on a given day?

### Answer

Since we have a small number of outcomes, Rain/No Rain and Football/No Football, we can easily represent the whole set of outcomes on a tree diagram. The outcomes related to football are dependent on whether or not it rains, so our first set of branches should cover whether or not it rains. We know that the probability of rain is 0.6, so the probability that it does not rain, , is , and we can attach these probabilities to the relevant branches.

The second sets of branches covering football-related outcomes will lead off from these two branches and, as we did for Rain/No Rain, we can work out the probabilities for Football/No Football from the information we have.

We know if it rains the probability the friends play football is 0.2, so the probability of not playing football if it rains is . Similarly, if it does not rain, the probability that they play football is 0.8, so the probability that they do not play football if it does not rain is . With this information, we can fill in the new branches and probabilities on our tree diagram.

Now that we have our tree diagram, we can calculate the required probabilities.

Part 1

To work out the probability that it rains on a given day and the friends play football, we multiply the probabilities on the branches along the top of the diagram, corresponding to Rain and Football, highlighted below.

The probability that it rains and the friends play football is, therefore,

Part 2

To work out the probability that it does not rain on a given day and the friends play football, we multiply the probability on the branch for No Rain, with the probability of Football on the branch leading from No Rain.

The probability that it does not rain on a given day and the friends play football is therefore 0.32. That is, there is a 32% chance that it will not rain and the friends will play football.

Part 3

To find the probability that the friends will play football on a given day, we must consider every combined outcome where the result is “playing football.” This means adding the probability that it rains and they play football to the probability that it does not rain and they play football.

The probability that the friends play football on a given day is, therefore,

We can say that there is a 44% chance that the friends will play football on any given day.

### Note

The sum of the probabilities for every possible outcome, combined, is equal to 1. This should always be the case.

### When using a tree diagram to illustrate probabilities, it should always be the case that the sum of the probabilities for each set of branches should equal 1, the sum of the probabilities of all the final outcomes should also equal 1.

Our next example shows how conditional probabilities and tree diagrams can be used in situations where a “false positive” might occur.

### Example 3: Conditional Probabilities, Tree Diagrams, and False Positives

It is a little known fact that drugs have been used to enhance performance in sports since the original Olympic Games (776 to 393 BC). In fact, the origin of the word “doping” is thought to come from the Dutch word “doop,” which is a type of opium juice used by the ancient Greeks.

Currently, in all major sporting events, drug testing has become standard practice. However, it is known that not all those who test positive for drugs have actually taken drugs. This is called the false positive effect. Similarly, there is a false negative effect, that is, that someone who tests negative for drugs has actually taken drugs.

In 2003, after anonymous testing of almost 1‎ ‎500 players, the MLB (Major League Baseball) announced that approximately 6% of MLB players used performance enhancing drugs. There was, however, a 5% chance that those who tested positive had not taken drugs and a 10% chance that those who had taken drugs tested negative.

1. Find the probability that an MLB player chosen at random had not taken drugs and tested positive.
2. Find the probability that an MLB player chosen at random had taken drugs and tested positive.
3. Find the probability that an MLB player chosen at random had positive test results.

### Answer

Our situation is that an MLB player chosen at random had either taken drugs or had not taken drugs and that, either way, they were given a drug test with either positive or negative results. Our first step is to draw a tree diagram using the information we have. We can then use this to work out the required probabilities.

The first branches illustrate the outcomes “Drugs” and “No Drugs,” that is, whether an MLB player took drugs or not. We know that approximately 6% of MLB players took drugs, so the probability that an MLB player did not take drugs is 0.94 (since as a probability and ).

Our next step is to add branches to each of the outcomes, No Drugs and Drugs, for the test results, which were either positive or negative.

Since the probability of a false positive was 0.05 (5%), that is, it was known that no drugs had been taken but the test was positive anyway, the probability of testing negative when no drugs had been taken was . These two probabilities (0.05 and 0.95) have been placed on the tree diagram next to the relevant branches (Positive or Negative), from the No Drugs branch.

Similarly, when it was known that drugs had been taken, the probability of testing negative was 0.1 (i.e., 10%) and, hence, the probability of testing positive was . These probabilities (0.1 and 0.9) have been placed next to the Positive and Negative branches from the Drugs branch.

Part 1

To find the probability that an MLB player had not taken drugs and tested positive, we multiply the probability on the No Drugs branch by that on the associated Positive branch.

Hence, the probability that an MLB player chosen at random had not taken drugs and tested positive was 0.047 or .

Part 2

To find the probability that an MLB player chosen at random is on drugs and tests positive, we multiply the probabilities for Drugs on the first set of branches and Positive on the second set.

Part 3

To find the probability that an MLB player chosen at random had positive test results, we must add together the probabilities for every possible situation where an MLB player may test positive. Fortunately for us, there are two ways a player might test positive and we have already worked out the probabilities for them both! These are the probability that a player was not on drugs and tested positive () and the probability that a player was on drugs and tested positive ().

Hence, the probability that an MLB player chosen at random tested positive is . That is, approximately 10% of the players tested positive.

### Note

The probability that a player selected at random took drugs and tested positive () is not the same as the probability that a player tested positive given that they took drugs (). In the second case, we have the prior knowledge that the player had taken drugs; in the first case, we do not know their drug status.

Let us recap the main points of using a tree diagram to work out conditional probabilities.

### Key Points

When there is a relatively small number of outcomes, for compound (more than one) events, a tree diagram is a useful way of illustrating a probability problem.

On each branch of the tree, we write the probability of that outcome and the following should be true in any tree diagram:

• The sum of the probabilities for each set of branches should equal 1.
• The sum of the probabilities of all the final outcomes should also equal 1.

Recall that two events, and , are

• independent if the fact that occurs does not affect the probability of occurring,
• dependent if the fact that occurs does affect the probability of occurring.

• For independent events, .
• If two events are not independent, however, where is the conditional probability for event , given that event has occurred. Note, though, that if the events and are independent, and .

If we have two events and each event has two possible outcomes, our tree diagram will look like this:

We can use tree diagrams where there are more than two events and also where each event has more than two outcomes. However, the sum of the probabilities for each set of branches and the sum of the probabilities of all the final outcomes must still equal 1. The example below has two events and 3 possible outcomes for each event. With computers and statistical software, we can of course create much more complex tree diagrams.

Nagwa uses cookies to ensure you get the best experience on our website. Learn more about our Privacy Policy.