In this explainer, we will learn how to represent a sample space using a tree diagram.

A tree diagram can be a great way of illustrating all the possible outcomes in an experiment. Each stage of the experiment is represented by a set of branches and each outcome is represented by a branch with its probability attached. The tree diagram of an experiment contains every possible outcome, that is, the sample space.

Before we draw a tree diagram, let us remind ourselves of how to write a sample space, using an example.

### Example 1: Writing a Sample Space

A bag contains 7 balls which are numbered 1 to 7. Determine the sample space of choosing a ball at random.

### Answer

The sample space consists of all possible outcomes in an experiment. In this case, the experiment is “choosing a ball at random.” The bag we are choosing from contains 7 balls numbered 1 to 7 and the result of choosing a single ball will be a ball with one of these numbers on it. So, the sample space contains each of these seven possible outcomes: one, two, three, four, five, six, and seven, but nothing else.

We usually write a sample space within curly brackets, so in this case the sample space is .

In our next example, we will use a tree diagram to represent the sample space.

### Example 2: The Sample Space on a Tree Diagram

Suppose 60% of single-scoop ice cream from the local ice cream van is sold in a carton and the other 40% is sold in a cone. Suppose also that the ice cream van sells three different flavors of ice cream—chocolate, vanilla, and strawberry—and that 25% of single-scoop sales are chocolate, 45% are vanilla, and 30% are strawberry.

Draw a tree diagram to represent single-scoop ice cream sales from the ice cream van.

### Answer

We can begin our tree diagram with two branches representing the two types of ice cream container.

We need to add our probabilities to the branches, but first we will convert the percentages to probabilities. If 60% of single-scoop ice cream is sold in cartons, this means the probability for “carton” is . Similarly, if 40% of single-scoop sales is in cones, then the probability of “cone” is . We can put these on the branches in our diagram.

Both the carton and the cone options have 3 possible flavors of ice cream to choose from, so there will be 3 further branches attached to each of the carton and cone branches.

Working out the probabilities for the 3 different flavors, we have

We can now complete our tree diagram by adding the probabilities for the ice cream flavors.

Our tree diagram above represents the sample space for single-scoop ice cream sales. Every possibility is covered by a branch or set of branches; and since there are 2 choices to begin with (carton or cone) and 3 flavors (chocolate, vanilla, or strawberry), there are possible outcomes in total.

In our next example, we will represent a sample space on a tree diagram and use this to calculate a probability.

### Example 3: Sample Space for Flipping a Coin Twice

- Draw a tree diagram to represent flipping a fair coin twice.
- Write the sample space and determine the number of possible outcomes.
- Determine how many outcomes contain a single heads.
- Find the probability of throwing a single heads in two flips of a fair coin.

### Answer

**Part 1**

To draw the tree diagram, we first note that when flipping a fair coin there are two possible outcomes, heads and tails. To represent our first flip of the coin, we will need one branch for each of these outcomes.

The top branch represents the coin landing with heads facing up and the bottom branch represents tails facing up. (We will fill in the probabilities later when we have all our branches in place.) If our coin landed heads up on the first throw, on our second throw we have the same possible outcomes as before: either heads or tails. So from the “heads” branch of the first throw we need 2 more branches for the outcomes of the second throw.

If we got tails on out first throw, for our second throw we again have two possible outcomes: heads and tails. And each of these needs a branch.

Now every possible outcome for flipping a coin twice has its own set of branches and we can insert the probabilities. We know that the probability of a fair coin landing with heads facing up is 0.5 and the same goes for tails. This is the same for any toss of a fair coin, so all the branches in our diagram will have the same probability attached.

Our tree diagram is now complete and we have listed all the possible outcomes down the right-hand side.

**Part 2**

The sample space for flipping a coin twice is the set of all possible outcomes. There are 4 possible outcomes and we can read these off from the right-hand column of our tree diagram: Heads, Heads (HH); Heads, Tails (HT); Tails, Heads (TH); and Tails, Tails (TT). We write the sample space as {HH, HT, TH, TT}.

### Note

We can also calculate the total number of possible outcomes: there are 2 possible outcomes in the first stage (the first coin flip) and there are 2 possible outcomes for each of these in the second stage. So we have a total of possible outcomes.

**Part 3**

To find the number of outcomes with only one heads, we can look at our sample space.

There are 2 outcomes with only one heads: heads in the first throw and tails in the second, or tails in the first throw and heads in the second. We could also find this out by looking at the column of outcomes to the right of our tree diagram.

**Part 4**

To find the probability of throwing a single heads with two flips of a coin, we find the probability for each outcome with a single heads and add these probabilities together. Looking first at the outcome “Heads, Tails,” to find its probability, multiply the probability for heads in the first throw with the probability for tails in the second throw. (These can be read across the branches in the tree.)

The probability for “heads then tails” is 0.25 and if we do the same for “tails then heads,” we find that this is also 0.25.

Adding the two probabilities for a single heads, we find the probability of a single heads in 2 throws of a coin

As we have seen, tree diagrams can be helpful in determining when to multiply and when to add probabilities. For the probability of a specific outcome, we multiply across the connected branches. If we want to find the probability of combined outcomes, we add the probabilities for those outcomes. Our next example illustrates this.

### Example 4: Representing a Sample Space and Calculating Probabilities Using a Tree Diagram

When Fady gets up, on any given morning, there is a 30% chance he will drink tea, a 50% chance he will choose coffee, and a 20% chance he will opt for juice.

For breakfast, Fady has toast 40% of the time, pancakes 15% of the time, cereal 30% of the time, and nothing if he gets up too late and has to rush.

- Draw a tree diagram to represent Fady’s breakfast food and drink options.
- Find the probability that Fady has coffee with toast in the morning.
- Find the probability that Fady has a hot drink with toast.
- Work out the number of breakfast options Fady has each morning.

### Answer

**Part 1**

To draw the tree diagram for Fady’s breakfast options, let us start with his drink choices. Fady has 3 options: tea, coffee, or juice, so we will need 3 branches for this stage of our tree diagram.

The probability that Fady has tea is 0.3, since he chooses tea 30% of the time; and for the probability we divide the percentage by 100: . In the same way, we find the probability that Fady chooses coffee is and that he chooses juice is . We can put the probabilities for each option on the branches of our tree diagram.

Our next step is to add branches for Fady’s food options. His choices are pancakes, cereal, toast, or nothing and we must have branches for all 4 of these for each of the 3 drink options.

This completes our tree diagram for Fady’s breakfast options.

**Part 2**

To find the probability that Fady has coffee and toast in the morning, we look on our tree diagram for the coffee branch and the branch for toast attached to this.

The probability that Fady has coffee is 0.5 and the probability he has toast is 0.4. Multiplying these together gives us . Therefore, the probability that Fady has coffee and toast is 0.2, which as a percentage is .

**Part 3**

To find the probability that Fady has a hot drink with toast, we note that there are 2 options for hot drinks: coffee and tea. We have already worked out the probability that Fady has coffee and toast (i.e., 0.2), so we need to find the probability that Fady has tea and toast. We do this in the same way as before, by multiplying the probability for tea (0.3) by the probability for toast (0.2): .

If we then add together the two probabilities we have found, we will have the probability that Fady has a hot drink and toast:

The tree diagram gives us a representation of all the different outcomes. For the probability of a particular outcome, we multiply the probabilities on the relevant series of branches (e.g., “tea and toast”). If we want to know the probability of combined outcomes (e.g., “hot drink and toast”), we add the probabilities for each element of the combined outcome (i.e., add the probabilities for “tea and toast” and “coffee and toast”).

So, we multiply across the tree diagram and add down.

**Part 4**

To work out the number of breakfast options Fady has each morning, we can either

- multiply the number of options at each stage: we have 3 drink options and 4 food options, so, the total number of possible outcomes is, ;
- count the number of final outcomes on the right-hand side of our tree diagram: there are 12 outcomes on the right of the tree diagram.

One more point to note regarding using tree diagrams for working out probabilities is that the sum of the probabilities of all the possible outcomes must equal 1. This is shown in the diagram below.

In our final example, we will represent the sample space of an experiment on a tree diagram, where the probabilities in the second stage differ for different outcomes of the first stage.

### Example 5: Tree Diagrams for Conditional Probabilities

Ramy has entered a tennis tournament and wants to practice as often as possible to prepare for it. Whether his coach Bassem will play tennis with him on any given day, however, depends on the weather.

Based on past data, the probability that it will rain on any given day before the tournament is 0.4. If it rains, the probability that Bassem will play tennis with Ramy is 0.05. If it does not rain, however, the probability that Bassem will play tennis with Ramy is 0.9.

- Draw a tree diagram to represent the sample space for Ramy’s tennis preparation possibilities.
- What is the chance that on any given day it rains and Ramy and Bassem play tennis?
- What is the probability that Ramy and Bassem play tennis on any given day before the tournament?

### Answer

**Part 1**

To draw a tree diagram, we begin with a branch each for the two possible weather events, “rain” and “no rain.” The probability that it will rain is 0.4, so the probability that it will not rain must be , since the sum of all probabilities must equal 1. We can put these probabilities on our “weather” branches.

Next, following on from each of these two branches, we include branches for the tennis outcomes “play” and “not play.” If it rains, the probability that Ramy and Bassem play is 0.05 and the probability that they do not play is . If it does not rain, the probability that they play is 0.9 and the probability that they do not play is . These probabilities go on the relevant branches of our tree.

This completes our tree diagram.

**Part 2**

To find the probability that on any given day it rains and Ramy and Bassem play tennis, we multiply the probabilities across the connected branches “rain” and “yes” for tennis.

The probability that on any given day it rains and Ramy and Bassem play tennis is, therefore,

**Part 3**

To find the probability that Ramy and Bassem play tennis on any given day before the tournament, we must add the probabilities for every outcome in which Ramy and Bassem play tennis. From our tree diagram, we can see that there are two outcomes in which Ramy and Bassem play tennis. The outcome “rain” and “tennis” and the outcome “no rain” and “tennis.” We have already worked out the probability for “rain” and “tennis,” so it remains to work out the probability for “no rain” and “tennis.”

Adding these two probabilities together gives us the probability that Ramy and Bassem play tennis:

We can convert this to a percentage: ; we can say that there is a 56% chance Ramy and Bassem will play tennis on any given day before the tournament.

### Note

This is an example of representing conditional probabilities on a tree diagram. This is where the probabilities for the second stage (or higher, if there are more than two) differ, depending on what the outcome of the first stage was. Notice, however, that although the probabilities on the second sets of branches are not the same (those for playing tennis or not when it rains are not the same as those for when it does not rain), the diagram still has a set of branches for every possible outcome.

The way we calculate probabilities is the same whether the second (or higher)-stage probabilities are dependent on the first outcome or not. Multiply across branches for the probability of a particular outcome; and, for combined outcomes, add the probabilities of outcomes down the right of the diagram.

### Key Points

- A tree diagram is a convenient and helpful way to illustrate the sample space of an experiment, where the sample space is the set of all possible outcomes.
- Each stage of the experiment is represented by a set (or sets) of branches.
- Every outcome in the first stage, or event, of the experiment is represented by a branch with its probability attached.
- Every outcome for each subsequent stage or event is represented by a branch following from every outcome of the previous stage or event.
- The probability of a particular final outcome is found by multiplying the probabilities on each connected branch leading to that outcome. For example, the probability of “” occurring is .
- The probability of combined final outcomes is found by adding the probabilities of the individual final outcomes. For example, the probability of is
- The total probability for every possible final outcome must equal 1. This means that the sum of the computed probabilities on the right-hand side of the tree diagram must equal 1.

In fact, the sum of the probabilities for each separate event should equal 1. So, in our current tree diagram, and .

### Note

If the probabilities of outcomes within an event are dependent on the outcome of the previous stage or event, the sum of probabilities for each separate set of branches must still equal 1. The sum of the probabilities of all final outcomes must also still be equal to 1.