Skip to content
Tutorials Center
My learning

Topics

Lesson 20 of 37 ยท Compound Events and Conditional Probability

The Multiplication Rule and Tree Diagrams

Use P(A and B) = P(A) x P(B | A) and tree diagrams to find probabilities of sequences of events, with and without replacement.

Many real situations are sequences: draw a card, then another; test a part, then test the next one; flip a coin, then roll a die. To find the chance of a whole sequence, you multiply along the way. A tree diagram is a picture that keeps this bookkeeping tidy.

This lesson builds directly on conditional probability.

The multiplication rule

For any two events A and B:

Text
P(A and B) = P(A) ร— P(B | A)

Read it as: first A must happen, then, knowing A happened, B must happen. If B's chance does not depend on A, the second factor is just P(B) (see independent events).

Drawing without replacement

A bag holds 5 red and 3 blue counters. You draw two without putting the first back. What is P(both red)?

  • First draw red: 5/8.
  • Given that, 4 red remain among 7 counters: 4/7.
Text
P(both red) = 5/8 ร— 4/7 = 20/56 = 5/14

The second probability changed because the bag changed. With replacement it would stay 5/8.

Tree diagrams

Each branch carries a probability. Multiply along a path to get the probability of that outcome; add the probabilities of paths that lead to the same event.

flowchart LR
  S["Start"] -->|"R: 5/8"| R1["First red"]
  S -->|"B: 3/8"| B1["First blue"]
  R1 -->|"R: 4/7"| RR["R, R: 20/56"]
  R1 -->|"B: 3/7"| RB["R, B: 15/56"]
  B1 -->|"R: 5/7"| BR["B, R: 15/56"]
  B1 -->|"B: 2/7"| BB["B, B: 6/56"]

Branches from one node always add to 1. The four path products add to 1 as well.

Now the probability of getting one of each colour is the sum of two paths:

Text
P(one red, one blue) = 15/56 + 15/56 = 30/56 = 15/28
Python Tree diagram by code: exact fractions

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Always check that the path probabilities add to 1. If they do not, a branch is wrong.

Checking with a simulation

A simulation repeats the experiment many times and compares the observed fraction with the calculation. It will not match exactly, but it should be close.

Python Simulate drawing two counters

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The law of total probability

Sometimes an event can happen by several routes. Add up the routes. Suppose a school has two buses. Bus 1 carries 60% of students and is late 10% of the time; Bus 2 carries 40% and is late 20% of the time. A random student is late with probability:

Text
P(late) = 0.6 ร— 0.10 + 0.4 ร— 0.20 = 0.06 + 0.08 = 0.14

This pattern, "add the products over every route", is the law of total probability. It is the denominator in Bayes' theorem.

Three or more stages

Trees extend to more stages. For three draws without replacement from the same bag, P(all red) = 5/8 ร— 4/7 ร— 3/6 = 60/336 = 5/28. Multiply a new factor for each stage, adjusting counts as items leave the bag.

"At least one" questions are easiest by complement: P(at least one) = 1 - P(none).

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. A bag has 4 green and 6 yellow counters. Two are drawn without replacement. What is P(both green)?

    After one green is removed, 3 green remain among 9 counters, so the second factor is 3/9. The product is 12/90 = 2/15.
  2. 2. In a tree diagram, how do you get the probability of one complete path?

    Each branch is a conditional probability, and the multiplication rule says to multiply them along the path.
  3. 3. Two paths in a tree both give the event you want. What do you do with their probabilities?

    The paths are mutually exclusive ways to reach the event, so their probabilities add.
  4. 4. Bus 1 carries 60% of students and is late 10% of the time. Bus 2 carries 40% and is late 20% of the time. P(late) is...

    0.6 ร— 0.10 + 0.4 ร— 0.20 = 0.06 + 0.08 = 0.14.

Summary

  • P(A and B) = P(A) ร— P(B | A).
  • Multiply along tree branches; add paths that lead to the same event.
  • Without replacement, later probabilities change; with replacement they stay the same.
  • Branches from a node add to 1, and so do all complete paths.
  • The law of total probability adds the products over every route.

Next: Independent Events