Get started

Inclusion–exclusion Of the numbers 1 to 30, 15 are even and 10 are multiples of 3. So are 25 of them one or the other?

Maths olympiad · 45 minutes

Able students add the multiples of 2 and of 3, find they have counted some twice, and build the rule that puts it right for two sets, then three. It comes with slides to present, a vote that shows who's stuck, practice that climbs to coprime counts and derangements, and homework.

You can present and print it without signing in.

Use in my lessons

Free. The whole lesson is copied into your Library for you to change.

Each marked value is how many of the numbers 1 to n are multiples of x. For n = 30 there are 15 multiples of 2 and 10 of 3. So are 25 of the numbers multiples of 2 or 3? Count to check. Then move n and try again: is the quick sum ever right?

246810

At x = 1, 2, 3 …: 30, 15, 10, 7, 6, 5, 4, 3, 3, 3

The idea in one minute

To count what is in A or B, add the two counts and take off what is in both, which was counted twice: |A ∪ B| = |A| + |B| − |A ∩ B|. For three sets, add the three, take off the three pairs, and add back the three-way overlap: a thing in all three was counted three times and taken off three times. Often the easier count is the complement: those in none of the sets are the total minus the union.

The lesson is problem first. Students add 15 and 10, count, and find only 20 numbers from 1 to 30 are multiples of 2 or 3. A Venn diagram shows why, and a check of each region shows why the rule for three sets ends by adding back. Then it is used where olympiads use it: multiples (with the lowest common multiple, not the product), numbers sharing no factor with 30, and the stretch, derangements: the ways nobody gets their own letter back.

By the end, students can

  • count the multiples of k from 1 to n as the whole number part of n ÷ k
  • use |A ∪ B| = |A| + |B| − |A ∩ B|, and the rule for three sets, explaining each term
  • count the complement: those in none of the sets
  • count numbers coprime to 30 or 105 up to a bound
  • count derangements of 4 or 5 things with inclusion–exclusion

Key words

  • union
  • intersection
  • complement
  • Venn diagram
  • lowest common multiple
  • coprime
  • derangement

Before this lesson

Students should draw Venn diagrams, find the lowest common multiple of two numbers, and know what n! means. It suits able students aged about 13 to 16.

Taught in Counting routes on a grid.

The lesson, step by step

30 minutes in total. Each step says what changes for this length.

  1. 1 · Think3 min

    Is it 25?

    From 1 to 30:

    15 are multiples of 2,

    10 are multiples of 3.

    So 25 are multiples of 2 or 3?

    The values: multiples of x, 1 to n.

    Answer, then list them and count.

    Write here

    3 min 1 · Hook · students think · the slides say “Think”

    Is it 25?

    Students add 15 and 10, then count, before anyone explains.

    For this length: Show the list at once and vote

    Say

    “From 1 to 30, fifteen numbers are even and ten are multiples of 3. How many are even or a multiple of 3? Answer, then check by listing.”

    Ask
    • Which numbers did you count twice?
    • What do the numbers counted twice have in common?
    Watch for

    Students who answer 25 and move on: ask them to list the numbers and count.

    For the teacher

    Two minutes: answer, then list. Most say 25 at once.

    The list has 20. Ask which five were counted twice: 6, 12, 18, 24, 30. The lesson turns that into a rule.

    Take a vote with Ask the class first: is it 25, more or fewer? Then list: 2, 3, 4, 6, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 22, 24, 26, 27, 28, 30: twenty. The five counted twice are the multiples of 6.

    Shorter: Show the list at once and vote (−2 min).

  2. 2 · Watch8 min

    Counted twice

    Left: multiples of 2 (15).

    Right: multiples of 3 (10).

    Middle: multiples of 6 (5),

    counted in both.

    15 + 10 − 5 = 20

    |A ∪ B| = |A| + |B| − |A ∩ B|

    Take the overlap off once.

    2 · Watch

    What is in both?

    1 to 60: multiples of 4 or 6?

    Multiples of 4: 15. Multiples of 6: 10.

    In both: 12, 24, 36, 48, 60, the multiples of 12,

    the lowest common multiple, not 4 × 6 = 24.

    15 + 10 − 5 = 20

    The overlap is the multiples of the lowest common multiple.

    2 · Watch

    Three sets

    Add the three sets,

    take off the three pairs,

    add back all three.

    In one set: counted 1.

    In two: 2 − 1 = 1.

    In all three: 3 − 3 + 1 = 1.

    Check each region: once only.

    2 · Watch

    Count what is left: the complement

    1 to 30: how many share no factor with 30?

    Divisible by 2, 3 or 5: 15 + 10 + 6 − 5 − 3 − 2 + 1 = 22

    None of them: 30 − 22 = 8

    They are 1, 7, 11, 13, 17, 19, 23, 29.

    None = total − (in at least one).

    2 · Watch

    Stretch: every letter wrong

    4 letters, 4 envelopes: 4! = 24 ways.

    Take off a chosen letter right: 4 × 3! = 24

    Add back two right: 6 × 2! = 12

    Take off three right: 4 × 1! = 4. Add back all four: 1

    24 − 24 + 12 − 4 + 1 = 9

    List them for 3 letters: are there 2?

    8 min 2 · Explain · you explain · the slides say “Watch”

    Counted twice, then three times

    The rule for two sets from a Venn diagram, then three sets, the complement, and derangements as a stretch.

    For this length: Leave derangements for practice question 9

    Say

    “Everything in both circles was counted once for A and once for B. Take it off once, and each number is counted exactly once.”

    Ask
    • Which numbers are multiples of both 4 and 6?
    • A number in all three sets: how many times is it added, and how many times taken off?
    • Is it easier to count the numbers in none of the sets directly, or the others?
    Watch for

    The overlap of multiples of 4 and 6 taken as multiples of 24: it is the lowest common multiple, 12.

    Two sets: multiples

    1 to 100: multiples of 2 or 3?

    50 + 33 − 16 (the multiples of 6) = 67

    Three sets

    1 to 100: divisible by 2, 3 or 5?

    50 + 33 + 20 − 16 − 10 − 6 + 3 = 74

    Divisible by none of them: 100 − 74 = 26

    Derangements of 4

    4 letters in 4 envelopes, every one wrong?

    24 − 4 × 3! + 6 × 2! − 4 × 1! + 1 = 9

    For the teacher

    First slide: the hook's answer as a Venn diagram. Multiples of 2 in one circle, of 3 in the other, multiples of 6 in the middle: 15 + 10 − 5 = 20. The rule: |A ∪ B| = |A| + |B| − |A ∩ B|.

    Second slide: the overlap. Multiples of 4 and of 6 are the multiples of 12, the lowest common multiple, not of 24. From 1 to 60: 15 + 10 − 5 = 20.

    Third slide: three sets. Add the three, take off the three pairs, add back the three-way overlap. Count each region: one set, 1; two sets, 2 − 1 = 1; three sets, 3 − 3 + 1 = 1. Every number is counted exactly once.

    Fourth slide: the complement. How many of 1 to 30 share no factor with 30? Those divisible by 2, 3 or 5: 15 + 10 + 6 − 5 − 3 − 2 + 1 = 22, so 30 − 22 = 8.

    Fifth slide, the stretch: derangements. Four letters, four envelopes, every letter wrong. Of 4! = 24 ways, take off those with a given letter right (4 × 3!), add back those with two right (6 × 2!), take off three (4 × 1!), add back all four (1): 9.

    Check the three-set rule region by region on the slide: a number in exactly one set is counted 1 time; in exactly two, 2 − 1 = 1; in all three, 3 − 3 + 1 = 1. The numbers 1 to 30 coprime to 30 are 1, 7, 11, 13, 17, 19, 23, 29: eight, as the rule says.

    Shorter: Leave derangements for practice question 9 (−4 min).

  3. 3 · Your turn5 min

    A worked example, then yours

    I do: 1 to 100, multiples of 2 or 3:

    50 + 33 − 16 (multiples of 6) = 67

    You do: 1 to 60, multiples of 4 or 6?

    Say what the overlap is before you take it off.

    Write here

    3 · Your turn

    Two more pairs

    I do: 1 to 100, by none of 2, 3, 5: 100 − 74 = 26

    You do: 1 to 60, by none of 2, 3 and 5?

    I do: 30 pupils; 18 football, 15 chess, 8 both: 5 none

    You do: 40 pupils, music 20, drama 16, art 12;

    pairs 7, 5 and 4; all three 2. How many in none?

    Fill the Venn diagram from the middle out.

    Write here

    The answers slide comes with your copy.

    5 min 3 · Your turn · students write

    A worked example, then yours

    Each worked count beside a twin that students solve themselves.

    For this length: Do the first two pairs only

    Say

    “Watch me write each count with what it counts. Then you do the twin. Always say what the overlap is.”

    Ask
    • What is the lowest common multiple here?
    • Do you want the union, or the numbers in none?
    Watch for

    The overlap as the product of the two numbers, and the three-way overlap taken off instead of added back.

    Two sets

    1 to 100: multiples of 2 or 3?

    50 + 33 − 16 = 67 (the overlap: multiples of 6)

    Then their turn

    1 to 60: how many are multiples of 4 or 6?

    Three sets, then none

    1 to 100: divisible by 2, 3 or 5: 74

    By none of them: 100 − 74 = 26

    Then their turn

    1 to 60: how many are divisible by none of 2, 3 and 5?

    People in clubs

    30 pupils: 18 football, 15 chess, 8 both

    In at least one: 18 + 15 − 8 = 25, so 5 in neither

    Then their turn

    40 pupils: music 20, drama 16, art 12; music and drama 7, music and art 5, drama and art 4, all three 2. How many in none?

    For the teacher

    Work the first pair aloud: write what each number counts under it. The twin is the lowest common multiple trap: 4 × 6 = 24, but 12 is in both lists.

    The second pair counts the complement, as olympiad questions usually ask. The third is the same rule with people: a Venn diagram filled from the middle out checks it.

    Twins: 20 (15 + 10 − 5: the overlap is the multiples of 12); 16 (60 − 44); 6 (40 − 34). Open the answers slide once most have finished.

    Shorter: Do the first two pairs only (−3 min).

  4. 4 · Vote and practise9 min

    Vote first

    How many of 1 to 120 are multiples of 6 or of 8?

    A: 35

    B: 33

    C: 30

    D: 25

    Choose on your own, then say what you took off.

    4 · Vote and practise

    Climb: from fluent to olympiad

    1. Multiples of 7 from 1 to 100?

    2. 1 to 100: multiples of 3 or 5?

    3. 1 to 100: multiples of neither 3 nor 5?

    4. 25 pupils: 14 French, 12 Spanish, 4 neither. Both?

    5. 1 to 120: divisible by 2, 3 or 5?

    Stuck? Write what each number counts.

    Write here

    4 · Vote and practise

    Reason, then count

    6. Why add back the three-way overlap?

    7. 1 to 1000: how many share no factor with 30?

    8. 1 to 1000: neither a square nor a cube?

    9. Six letters, six envelopes, every one wrong?

    Each term: what it counts, and its sign.

    Write here

    9 min 4 · Who's stuck? · students vote · the slides say “Vote and practise”

    Vote, then climb

    One question shows who's stuck; then practice from counting multiples to coprime counts and derangements.

    For this length: After the vote, questions 1–5 only

    Say

    “Choose an answer on your own. Nobody talks until everyone has chosen.”

    Ask
    • Which numbers are multiples of both 6 and 8?
    • How many times did you count 24?
    Watch for

    No overlap taken off; the overlap as multiples of 48; the overlap taken off twice.

    Write each count with what it counts. Check overlaps with the lowest common multiple. The last question is a write-up: each term with its reason.

    The question that shows who's stuck

    1. How many of the numbers 1 to 120 are multiples of 6 or of 8?
      1. 35
      2. 33
      3. 30
      4. 25
    An example of what your Classroom shows as they answer
    • A8
    • B7
    • C11
    • D3

    Each wrong answer points to a different mistake. As they answer, your Classroom shows who chose what, so you can see in seconds who needs help, and with what.

    1. From 1 to 100 there are ___ multiples of 7
    2. From 1 to 100, ___ numbers are multiples of 3 or 5
    3. From 1 to 100, ___ numbers are multiples of neither 3 nor 5
    4. A class of 25: 14 learn French, 12 learn Spanish and 4 learn neither. ___ learn both
    5. From 1 to 120, ___ numbers are divisible by 2, 3 or 5
    6. In the rule for three sets, why is |A ∩ B ∩ C| added back at the end?
      1. Those things were added 3 times and taken off 3 times, so they weren't counted at all
      2. Those things were counted twice
      3. To make up for things in none of the sets
      4. It isn't: it should be taken off too
    7. How many of the numbers 1 to 1000 share no factor (other than 1) with 30?
    8. Stretch: how many of the numbers 1 to 1000 are neither a perfect square nor a perfect cube?
    9. Stretch: six letters are put into their six addressed envelopes at random. In how many ways is every letter in a wrong envelope? Explain each term.

    Support · Stuck: write the sets out for a small n, draw the Venn diagram, and fill it from the middle out. For each term, say in words what it counts.

    For the teacher

    Everyone chooses before anyone explains. Ask a student for each answer to say what they took off. No overlap, 6 × 8 and a double subtraction all show up here.

    Questions 1–3 are two sets; 4 is people; 5 is three sets; 6 asks why; 7 is a coprime count. 8 and 9 are olympiad level: squares and cubes, and derangements.

    Students write the long answer on paper or the board; the quiz keeps it for you to mark and comment on.

    If the class is split, list the multiples of 6 and of 8 up to 48 together and circle those in both. Long answers (9) are marked by you: a mark for each term with what it counts, one for the sign pattern, one for the total. Model answers are in each question's explanation.

    Shorter: After the vote, questions 1–5 only (−6 min).

    Longer: Swap and mark: pairs check each other's counts for questions 7 and 9 (+10 min).

  5. 5 · Show what you know5 min

    Three sets, every term

    How many of the numbers 1 to 200

    are divisible by 2, 3 or 7?

    Write each term with what it counts.

    Pairs and the triple: lowest common multiples.

    Write here

    5 min 5 · Exit · students show · the slides say “Show what you know”

    Three sets, every term

    One three-set count, every term said, shows who has the whole rule.

    Say

    “Count them, and say under each term what it counts.”

    Watch for

    Products used for the overlaps, or the last term taken off.

    Each term with what it counts, then the total.

    1. How many of the numbers 1 to 200 are divisible by 2, 3 or 7? Write each term with what it counts.
    For the teacher

    How many of the numbers 1 to 200 are divisible by 2, 3 or 7?

    Write each term with what it counts.

    Answers of 142 with terms explained show the whole idea; answers of 134 took the three-way overlap off. Start next time with the region check. Set the homework.

    Longer: Then ask: how many are divisible by none of them? (+5 min).

One-to-one: let the student list the multiples of 2 and of 3 up to 30 and circle those in both, then draw the Venn diagram. Ask them to check every region of the three-set picture is counted exactly once before trusting the rule.

Homework: counting without double counting

Write each term with what it counts. Use the lowest common multiple for overlaps. Draw a Venn diagram when people are counted.

  1. How many of the numbers 1 to 500 are multiples of 4 or 10?
  2. In a year group of 50, 30 go to maths club, 25 to science club and 10 to neither. How many go to both?
  3. How many of the numbers 1 to 300 are divisible by 3, 5 or 7?
  4. How many of the numbers 1 to 300 share no factor (other than 1) with 105?
  5. How many of the numbers 1 to 100 are multiples of 6 or 9? Explain why the overlap is not the multiples of 54.
  6. 100 people were asked what they drink: 45 tea, 50 coffee, 30 juice; 15 tea and coffee, 10 tea and juice, 12 coffee and juice, and 5 all three. How many drink none of them?
  7. Challenge: five friends draw names for presents from a hat. In how many ways does nobody draw their own name?

Print the worksheet, with space for working and the homework. The answers come with your copy in the Library.

Inclusion–exclusion: common questions

What is the inclusion–exclusion principle?

A way to count things in at least one of several sets without counting any twice. For two sets, add the sizes and take off the overlap. For three, add the sizes, take off the three pairwise overlaps and add back the three-way overlap. The signs keep alternating for more sets.

Which competitions is this lesson useful for?

It suits able students aged about 13 to 16 preparing for maths challenges and olympiads, such as the UKMT Intermediate and Senior Mathematical Challenges and their follow-on rounds. The problems are our own, written in the style of such competitions, not taken from past papers.

Why the lowest common multiple and not the product?

A number in both lists is a multiple of both numbers, and those are exactly the multiples of their lowest common multiple. For 3 and 5 that is the product, 15; for 4 and 6 it is 12, not 24, so using the product misses 12, 36 and 60.

Are derangements too hard for this age?

They are the stretch. Students who are fluent with three sets can follow the pattern for four letters, and checking that there are 2 ways for three letters by listing makes it believable. It is fine to leave them for another day.

Can I use the lesson without creating an account?

Yes. You can read the lesson, print the worksheet and open its slides without signing in. Anything you draw on the slides isn't saved. With a free teacher account, you can keep the whole lesson in your Library to change and teach, including the quizzes, the answers and the answer slides.

Teach this lesson tomorrow

Keep the whole lesson, change what you like, and use it with a group. Present its slides step by step while each student works on their own copy.

Use in my lessons

Free. The whole lesson is copied into your Library for you to change.

Written in our own words and free to use with your students. Not endorsed by any exam board.