Skip to main content
Statistics LibreTexts

Tree Diagrams and Counting

  • Page ID
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    We have seen that probability is defined by

    \[ P(E) = \dfrac {\text{Number in E}}{\text{Number in the Sample Space}} \nonumber \]

    Although this formula appears simple, counting the number in each can prove to be a challenge. Visual aids will help us immensely.

    Example \(\PageIndex{1}\): Tree Diagrams

    A native flowering plant has several varieties. The color of the flower can be red, yellow, or white. The stems can be long or short and the leaves can be thorny, smooth, or velvety. Show all varieties.


    We use a tree diagram, which is a diagram that branches out and ends in leaves that correspond to the final variety. The picture below shows this.

    tree diagram

    To read this tree diagram, we begin from start. then move along the branches collecting words until we get to the end. For example,

    • Always taking the upper path leads to the selection of a red long thorny plant.
    • Always taking the lower path leads to a blue short velvety plant. We can count the total number of leaves (path endings) and get that there are 18 possible varieties.
    • Counting the leaves that came from long stems tell us that there are 9 possible long stemmed varieties.
    Example \(\PageIndex{2}\)

    A committee of three republican senators and four democratic senators is selected to investigate corporate securities fraud. Out of this committee two members are to be selected at random for a subcommittee on the energy sector.

    1. What is the probability that both members will be republican?
    2. What is the probability that both members will be democrat?
    3. What is the probability of one of each?

    We write a tree diagram

    Tree Diagram

    In this tree diagram, D represents democrat and R represents republican. The probabilities are given in the diagram.

    To answer part A, we need to find

    \[ P(\text{ first is } R \text{ and second is } R) \nonumber \]

    This corresponds to the bottom leaf. As we travel to the bottom leaf, we pick up the two numbers

    \[ P(R \text{ and } R) = \dfrac{3}{7}\dfrac{1}{3} = \dfrac{1}{7}\nonumber \]

    To answer part B, we need to find

    \[ P(\text{ first is } D \text{ and second is } D) \nonumber \]

    This corresponds to the top leaf. We have

    \[ P(D \text{ and } D) = \dfrac{4}{7}\dfrac{1}{2} = \dfrac{2}{7} \nonumber \]

    To answer the part C we add the two middle leaves

    \[ \begin{align*} P((D \text{ and }R) \text{ or } (R \text{ and }D)) &= \dfrac{4}{7}\dfrac{1}{2} + \dfrac{3}{7}\dfrac{2}{3} \\[5pt] &= \dfrac{2}{7} + \dfrac{2}{7} \\[5pt] &= \dfrac{4}{7} \end{align*} \]


    Example \(\PageIndex{3}\): Permutation

    Suppose that 40 women try out for the newest play that has an all women cast of seven. You are the director. How many choices do you have?


    The way to work this problem out is to consider the main role first. You have 40 choices for the main role. For the lead supporting actor there are 39 left to select from. For the next role there are 38 to select from. Now following this pattern and consider that there are seven in the cast gives a total number of choices as

    \[ 40 \cdot 39 \cdot 38 \cdot 37 .\cdot 36 \cdot 35 \cdot 34 \nonumber \]

    We could multiply these all out, however there is an easier way. We can write

    \[ 40 \cdot 39 \cdot 38 \cdot 37 \cdot 36 \cdot 35 \cdot 34 \left( \dfrac{33 \cdot 32 \cdot 31 \cdot \, ... \cdot 2 . 1}{ 33 \cdot 32 \cdot 31 \cdot\, ... \cdot 2 \cdot 1} \right) = \dfrac{40!}{(40-7)!} \nonumber \]

    This expression has a special notation. We write

    \[ P_{40,7} = \dfrac{n!}{(n-r)!} = 93,963,542,400 \nonumber \]

    We can see that there are plenty of choices. In general we write

    \[ P_{n,r} = \dfrac{n!}{(n-r)!} \nonumber \]

    This is called a permutation.


    Example \(\PageIndex{4}\): Combination

    How many 5 card poker hands are there?


    We can solve this in a similar way as the prior question. We are selecting 5 cards out of 52 total. Unfortunately this is not quite a permutation since, for example, the hand

    2H 3H 4H 5H 6H

    is the same as the hand

    3H 5H 2H 6H 4H

    where "H" means hearts. That is the order at which the cards are dealt does not matter. The number of ways of ordering 5 cards is 5! (five choices for the first card, four left for the second, three left for the third, two for the fourth, and one for the fifth). We divide by this number to get our solution

    \[ = \dfrac{52!}{(52-5)! \; 5!} \nonumber \]

    We write this with the notation

    \[ C_{52,5} = \dfrac{52!}{(52-5)! \; 5!} = 2,598,960 \nonumber \]

    In general, we have

    \[ C_{n,k} = \dfrac{n!}{(n-k)! \; k!} \nonumber \]

    and call this a combination.

    Example \(\PageIndex{5}\): Probability

    The following was taken from the California state lottery web site:

    "SuperLottoPlus is your chance to win millions of dollars! The jackpot ranges from $7 million to $50 million or more. The jackpot rolls over and grows whenever there is no winner. All you have to do is pick five numbers from 1 to 47 and one MEGA number from 1 to 27 and match them to the numbers drawn by the Lottery every Wednesday and Saturday."

    What is the probability of winning the lottery?


    There is only one element in the event space. Your numbers. For the sample space, first they pick 5 numbers from 47. There are

    \[ C_{47,5} =1,533,939 \nonumber \]

    ways of doing this. Next they select a number from 1 to 27. There are 27 ways of doing this. We multiply to get

    \[ 1,533,939\; \times \; 27 = 41,416,353 \nonumber \]

    So your chances are worse than one in forty-million.

    Contributors and Attributions

    Tree Diagrams and Counting is shared under a not declared license and was authored, remixed, and/or curated by LibreTexts.

    • Was this article helpful?