Skip to content
Tutorials Center
My learning

Topics

Lesson 6 of 36 ยท Counting Principles

The Product Rule

Learn the product rule: when a task has several independent steps, multiply the number of choices. Covers tree diagrams, dependent steps, licence plates and Python checks.

The product rule counts sequences of choices. If you must complete several steps one after another, and each step offers a fixed number of options no matter how earlier steps went, you multiply.

Product rule. If a task has two steps, the first done in m ways and the second in n ways for every way of doing the first, then the task can be done in m ยท n ways. It extends to any number of steps.

Basic example

A school lunch combo needs 1 sandwich (4 kinds), 1 side (3 kinds) and 1 drink (5 kinds). The number of combos is 4 x 3 x 5 = 60. You never choose both a ham and a cheese sandwich; each step is a separate decision, and choices in different steps combine freely.

Python Lunch combos

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.

Tree diagrams

A tree diagram draws the product rule: each level of the tree is one step, each branch one option. The number of leaves is the number of outcomes.

flowchart TD
    S["Start"] --> A1["Shirt: red"]
    S --> A2["Shirt: blue"]
    A1 --> B1["Pants: jeans"]
    A1 --> B2["Pants: shorts"]
    A2 --> B3["Pants: jeans"]
    A2 --> B4["Pants: shorts"]

2 shirts x 2 pants give 4 leaves.

Trees are great for small cases, but they become unmanageable as steps grow. The point is to see the multiplication, then do it by arithmetic.

When later steps depend on earlier ones

The product rule still works if the number of options in a later step depends on the earlier choices, as long as it is the same count every time. Example: line up 3 books chosen from 5 distinct books on a shelf. The first slot has 5 options. The second has 4 (whichever book was used is gone, though which one is gone varies, the count 4 does not). The third has 3. So 5 x 4 x 3 = 60. This is the idea behind permutations.

Python Dependent choices, same counts

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.

Licence plates: product plus sum

A plate has 3 letters followed by 3 digits. Each of 6 positions is a step, with 26 or 10 options: 26^3 x 10^3 = 17,576,000. If a region also allows an older format of 2 letters followed by 4 digits, the formats are disjoint cases and you add: 26^2 x 10^4 = 6,760,000 for the second, total 24,336,000.

Python Plate counting

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.

Restrictions: handle the hard step first

When a rule restricts one position, count that position first. How many 4-digit PINs (digits 0-9) have an even last digit and no leading zero? Start with the restricted positions: first digit 9 choices (1-9), last digit 5 choices (0, 2, 4, 6, 8), the two middle digits 10 each. Total 9 x 10 x 10 x 5 = 4500. If you counted the unrestricted positions first, you would have to subtract awkward overlaps.

Python PINs with restrictions

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.

Order the steps so that the most constrained one comes first. The remaining steps then have clean, independent counts.

Common mistakes

  • Using the rule when step counts are not constant. If the number of options for step 2 depends on which option you chose in step 1 (not just that you chose one), split into cases first and use the sum rule.
  • Multiplying where you should add. "Or" means add; "and then" means multiply.
  • Forgetting that order may create duplicates. Choosing a committee of 2 as "first person, then second person" counts each pair twice; fix that with combinations.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. A phone has 3 colours, 4 storage sizes and 2 cases. How many configurations?

    3 x 4 x 2 = 24 independent decisions.
  2. 2. How many 3-letter words (any letters, repeats allowed) from a 26-letter alphabet?

    26 x 26 x 26 = 17,576.
  3. 3. How many ways to pick a president then a vice-president from 8 people (different people)?

    8 choices for president, then 7 for vice-president: 8 x 7 = 56.
  4. 4. Which keyword in a problem usually signals multiplication?

    Independent steps performed in sequence multiply their counts.

Summary

  • Multiply the number of options at each step of a sequence.
  • The count at each step may depend on earlier choices as long as it is a fixed number.
  • Tree diagrams picture the rule; arithmetic does the work.
  • Fill the most restricted positions first, and combine with the sum rule when formats differ.

Next: Complement and Casework