# Tree diagram

In probability and statistics, a tree diagram is a visual representation of a probability space; a probability space is comprised of a sample space, event space (set of events/outcomes), and a probability function (assigns probabilities to the events).

Tree diagrams are made up of nodes that represent events, and branches that connect nodes to outcomes. The probabilities of the outcomes of an event occurring are displayed along the corresponding branch.

Although tree diagrams can be tedious to construct, they are useful for organizing a sequence of events and probabilities in a clear and simple manner. Below is an example of a basic tree diagram with one event (the flip of a coin) and the probabilities of its two outcomes, heads or tails:

The grey circle represents the event of flipping a coin and the branches show that there is a 50% chance of either heads or tails occurring as a result of the coin flip. Note that the sum of the probabilities of the branches of an event must equal 1. In the above case, there are only 2 branches. If there are more outcomes, there can be more than 2 branches, but the sum of the probabilities of the outcomes must still be 1 for each event in the tree diagram. This is one way to confirm that the probabilities in your tree diagram are correct.

## Independent events

The example above can be extended to multiple flips of a coin. The flip of a coin is an independent event because the probability of subsequent flips is not dependent upon any previous flips. The probability of either heads or tails occurring on any given flip of a coin is 50%.

To determine the probability of the outcome at the end of a tree diagram, multiply the probabilities of each branch leading to the desired final outcome. In the case of a coin flip, the probability of each outcome is the same, and is just (0.5)^{n}, where n is the number of flips. We can confirm this in the above figure where the probability of heads occurring twice on two flips of a coin can be determined by following the branches that result in an outcome of two heads, and multiplying the probabilities of each branch:

0.5 × 0.5 = (0.5)^{2} = 0.25

Thus, there is a 25% of heads occurring twice on two flips of a coin.

The tree diagram could be extended indefinitely for any number of coin flips. This same method can be used to determine the probabilities of any other independent events, as long as the probabilities at each branch are known.## Dependent events

Tree diagrams are also useful for determining the probabilities of dependent events, in large part because they make it easy to see the various branches and associated probabilities.

Example

Jeremy has 5 coins in his pocket: 3 pennies and 2 dimes. Given that he removes one coin at a time from his pocket and does not replace the coin, use a tree diagram to determine the probability of Jeremy choosing 2 dimes if he removes only 2 coins from his pocket.

The probability of the first coin Jeremy removes from his pocket being a dime is 2/5; the probability that it is a penny is 3/5. The probability of the second coin he removes from his pocket being a penny or a dime is dependent upon the first coin Jeremy removed, as shown in the tree diagram below:

If the first coin Jeremy removes from his pocket is a penny, the probability of him removing 2 dimes (in only 2 tries) is 0. If the first coin he removes is a dime, there is a 1/4 chance that the next coin he removes is a dime. The probability of Jeremy removing 2 dimes consecutively can be determined by multiplying the top-most two branches of the tree diagram:

Thus, there is a 10% chance that the first two coins Jeremy removes from his pocket are both dimes.

It is worth noting that in the above example, the bottom branch (where a penny is picked first) is not used, since if Jeremy picked a penny first, there is no way for him to pick two dimes within the constraints of the experiment. This will not always be the case when using a tree diagram. If Jeremy removed 3 coins instead of 2, the probability of 2 of the coins being dimes increases, and more branches would need to be taken into consideration:

As can be seen from the figure above, there are 3 different ways that Jeremy can remove 2 dimes from his pocket in 3 tries. Given that "D" is dime and "P" is penny, Jeremy can draw 2 dimes in the following three ways: {DD, DPD, PDD}. Using the tree diagram, we can determine the probabilities of each by multiplying along their respective branches, then summing each of those probabilities.

The probability of DDP is: 2/5 × 1/4 = 0.1 |

The probability of DPD is: 2/5 × 3/4 × 1/3 = 0.1 |

The probability of PDD is: 3/5 × 1/2 × 1/3 = 0.1 |

Sum the probabilities:

0.1 + 0.1 + 0.1 = 0.3

Thus, if Jeremy removes 3 coins from his pocket, there is a 30% chance that two of the coins are dimes.