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

When working with conditional probabilities, it is helpful to use a tree diagram to illustrate the probability of the different outcomes. To help us understand how tree diagrams are used, letβs first recall the formula for conditional probability.

### Definition: Conditional Probability

The probability that an event occurs, given that event has already occurred, is where is the probability of given that occurs, is the probability of and occurring at the same time, and is the probability of occurring.

We can rewrite the formula above by multiplying both sides by , giving us

We can use this form of the formula to determine the probability of the intersection of two events. On a tree diagram, it can be calculated by multiplying across branches, with the first branch representing the probability of and the second branch representing the probability of , given that has occurred, as shown below.

We can use our knowledge of the rules of probability to build on our understanding of tree diagrams. Letβs recall some of the rules of probability first.

### Definition: Simple Rules of Probability

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

- The probability of event occurring is given by where is the number of elements in event and is the number of elements in the sample space .
- All probabilities lie in the interval , or
- Total probability: the sum of the probabilities of all possible outcomes is equal to 1 (or ).
- The complement of event , written as
, refers to everything that is
**not**, and

### Note

The complement of event is sometimes also written as .

Using these rules of probability, we can apply them to a tree diagram. In a tree diagram, each set of branches must add up to 1, since the probabilities of all possible outcomes add up to 1. As such, if we have two outcomes of an event, with the first branch of the pair being the probability of , then the second branch of the pair must be the probability of , the complement of . Similarly, if we have the probability of given that has occurred as one of the pair of branches, then the other branch must be the probability of given that has occurred. Further, if we have the probability of given that has occurred as one of the pair of branches, then the other branch must be the probability of given that has occurred. We can illustrate this also on the following tree diagram.

As the tree diagram above has only pairs of branches, then we can use the complement to find the other branch. However, if there are three or more sets of branches, then this will not be the case.

Letβs explore how to use a tree diagram to find a conditional probability in the first example.

### Example 1: Finding a Conditional Probability on a Tree Diagram

A bag contains 3 blue balls and 7 red balls. Fares selects 2 balls without replacement and draws the following tree diagram.

Given that the first ball is red, find the value of that represents the probability that the second ball selected is red.

### Answer

We are told from the question that two balls are selected
**without replacement**. This means that the colour of the second ball is **dependent** on the colour of the
first ball. As such, we need to consider what the outcome of the first event is
when calculating the probability of the outcome in the second event.

As we are required to find the value of , which represents the probability that the second ball selected is red given that the first ball selected is red, then we need to use the information that a red ball is first selected to determine .

At the start, there are 3 blue balls and 7 red balls. If a red ball is selected first, then there will be 6 red balls in the bag now, but the number of blue balls remains unchanged. So, the probability that the second ball will be red is calculated by taking the number of red balls in the bag after a red ball (6) is selected and dividing it by the total number of balls after a red ball is selected (9), as follows:

As we are told in the problem that the probability of the second ball being blue given that the first ball is red is , then we can use the fact that sets of branches must add up to 1 as a way of checking our answer. As , then we can say that this is correct.

Therefore, the probability that the second ball is red given that the first ball is red is .

In the next example, we will discuss how to draw a tree diagram in order to find the probability of a conditional event.

### Example 2: Calculating Conditional Probability without Replacement

A Bag contains 22 red balls and 15 black balls. Two balls are drawn without replacement at random. Find the probability that the second ball is black given that the first ball is red. Give your answer in its simplest form.

### 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
colour. 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 colour, 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 balls is now .

The probability that the second ball is red, given that 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 that the first is red, is the number of black balls in the bag (still 15) divided by the total (now 36):

Therefore, we have found that the probability that the second ball is black, given that the first ball is red, is , as the question requires.

### Note

We can check our answer by using the fact that the set of two branches add up to one, as seen below on the tree diagram.

In the next example, we will discuss how to find probabilities of events when given conditional probabilities by using a tree diagram.

### Example 3: 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.

- Work out the probability that it rains on a given day and the friends play football.
- Work out the probability that it does not rain on a given day and the friends play football.
- 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 that if it rains, the probability that 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 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 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.

In the following example, we will discuss situations where a βfalse positiveβ may occur and how to use a tree diagram to calculate this.

### Example 4: 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.

Drug testing has become standard practice. In 2003, after anonymous testing of almost 1βββ500 players, the Major League Baseball (MLB) announced that approximately of MLB players used performance-enhancing drugs. They got this result taking into account that there was a chance that those who had not taken drugs tested positive (false positive effect) and a chance that those who had taken drugs tested negative (false negative effect).

- Find the probability that an MLB player chosen at random had not taken drugs and tested positive. Round your answer to three decimal places if necessary.
- Find the probability that an MLB player chosen at random had taken drugs and tested positive. Round your answer to three decimal places if necessary.
- Find the probability that an MLB player chosen at random had positive test results. Round your answer to three decimal places if necessary.

### 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 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 , 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., ), 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 of the players tested positive.

In the next example, we will discuss how to find an unknown number of outcomes given a conditional probability and other information. We will use a tree diagram to help us do this.

### Example 5: Finding An Unkwown Parameter Using a Tree Diagram

There are an unknown number of balls in the bag. There are 3 white balls and some black balls. Two balls are selected without replacement. If the probability of selecting a black ball, given that the first ball is white, is , how many black balls are there in the bag?

### Answer

As we are told in the question that there are two possible outcomes of each
event, white and black, and that two balls are selected
**without replacement**, then it is helpful to use a tree diagram to
represent this information. We will start by laying out the tree diagram with
the different outcomes.

We are told in the question that the probability of selecting a black ball, given that the first ball is white, is . This is represented by the branch for selecting a black ball that stems from the branch for selecting a white ball, as shown below.

We are told that there are 3 white balls in the bag initially, but an unknown number of balls in total, and an unknown number of black balls. If we let equal the number of black balls, then the number of balls in total is , since it is the number of black balls, , plus the number of white balls, 3.

We can then say the probability that the first ball is white is the number of white balls, 3, divided by the number of balls in total, . This gives us

Labelling this on the tree diagram, we get the following.

Using as the number of black balls in the bag, and as the total number of balls, we can then write an expression for the probability that the second ball is black, given that the first ball is white. When we select the second ball, we know that since the first ball selected is white, then there are only 2 white balls left in the bag, but still black balls. So the probability of the second ball being black given that the first ball is white is the number of black balls, , divided by the number of balls in the bag, , since there are only 2 white balls in the bag now. This gives us

As we already know that the probability that the second ball is black, given that the first ball is white, is , then we can equate this to the expression above to find . This gives us

Therefore, the number of black balls in the bag is 12.

In this explainer, we have discussed how to find the probability of conditional events using tree diagrams. Letβs recap the key points.

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

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