6. Counting II

Inclusion-exclusion

Inclusion-Exclusion

students, imagine trying to count how many students in a school play video games, watch sports, or do both ๐ŸŽฎ๐Ÿ€. If you count โ€œvideo game studentsโ€ and then count โ€œsports students,โ€ some students get counted twice because they belong to both groups. The Inclusion-Exclusion Principle is the tool that helps us correct this overlap and count accurately.

In this lesson, you will learn how Inclusion-Exclusion works, why it matters in counting, and how to use it in problems that involve overlapping sets. By the end, you should be able to:

  • explain the key ideas and vocabulary behind Inclusion-Exclusion,
  • apply it to count objects correctly,
  • connect it to the broader topic of Counting II,
  • and see how it works in real examples and problem solving.

What Inclusion-Exclusion Is

In counting, a set is a collection of objects. If we have two sets $A$ and $B$, the union $A \cup B$ means everything in $A$, everything in $B$, or both. The problem is that if an object belongs to both $A$ and $B$, then simply adding $|A|$ and $|B|$ counts it twice.

The Inclusion-Exclusion Principle fixes that by subtracting the overlap:

$$|A \cup B| = |A| + |B| - |A \cap B|$$

Here, $|A|$ means the number of elements in $A$, and $|A \cap B|$ means the number of elements in both $A$ and $B$.

Why the formula works

Think of a school club list:

  • $A$ = students in the chess club,
  • $B$ = students in the robotics club.

If you add the number of chess students and robotics students, any student in both clubs gets counted twice. Subtracting $|A \cap B|$ removes the extra count and leaves each student counted exactly once.

This is the main idea of Inclusion-Exclusion: add the counts of individual groups, then subtract the overlap โœ…

A Two-Set Example

Suppose in a class of $30$ students:

  • $18$ study Spanish,
  • $12$ study French,
  • $5$ study both Spanish and French.

How many students study at least one of these languages?

Let $S$ be the set of Spanish students and $F$ be the set of French students. We want $|S \cup F|$.

Using Inclusion-Exclusion:

$$|S \cup F| = |S| + |F| - |S \cap F|$$

Substitute the values:

$$|S \cup F| = 18 + 12 - 5 = 25$$

So, $25$ students study at least one of the two languages.

If the class has $30$ students total, then the number who study neither language is:

$$30 - 25 = 5$$

This kind of reasoning is very common in discrete mathematics because it lets you count without listing every person or object one by one.

Extending to Three Sets

Inclusion-Exclusion becomes even more useful when there are three overlapping sets. Suppose $A$, $B$, and $C$ are three sets. A first guess might be:

$$|A \cup B \cup C| = |A| + |B| + |C|$$

But this counts objects in pairwise intersections twice. So we subtract the pairwise overlaps:

$$|A \cup B \cup C| = |A| + |B| + |C| - |A \cap B| - |A \cap C| - |B \cap C|$$

However, now objects in all three sets were subtracted too many times, so we add them back once:

$$|A \cup B \cup C| = |A| + |B| + |C| - |A \cap B| - |A \cap C| - |B \cap C| + |A \cap B \cap C|$$

This pattern is called alternating signs. We add the single sets, subtract the pairwise intersections, then add the triple intersection.

Example with three sets

Suppose in a survey of $50$ students:

  • $22$ like pizza,
  • $18$ like burgers,
  • $15$ like tacos,
  • $8$ like both pizza and burgers,
  • $6$ like both pizza and tacos,
  • $5$ like both burgers and tacos,
  • $2$ like all three.

Let $P$, $B$, and $T$ be the sets of students who like pizza, burgers, and tacos. Then:

$$|P \cup B \cup T| = 22 + 18 + 15 - 8 - 6 - 5 + 2$$

$$|P \cup B \cup T| = 38$$

So $38$ students like at least one of the three foods. If the survey included $50$ students total, then $12$ students like none of them.

This example shows how Inclusion-Exclusion gives a structured way to handle overlap in larger counting problems ๐Ÿ•๐Ÿ”๐ŸŒฎ

The General Pattern

The Inclusion-Exclusion Principle can be extended to any number of finite sets. For $n$ sets, the pattern is:

  • add the sizes of the individual sets,
  • subtract the sizes of all intersections of two sets,
  • add the sizes of all intersections of three sets,
  • subtract the sizes of all intersections of four sets,
  • and continue alternating.

For sets $A_1, A_2, \dots, A_n$, the general formula is:

$$\left|\bigcup_{i=1}^{n} A_i\right| = \sum |A_i| - \sum |A_i \cap A_j| + \sum |A_i \cap A_j \cap A_k| - \cdots$$

The exact sums run over all combinations of the sets with the same number of terms in each intersection.

This formula may look complicated, but the logic is simple: each object should be counted exactly once. The alternating pattern ensures that every object ends up with the correct total count.

A Real-World Counting Argument

Inclusion-Exclusion is not just for school survey questions. It also appears in practical counting problems.

Suppose a store has customers who buy apples, oranges, or bananas. The manager wants to know how many customers bought at least one of these fruits during a day. Some customers bought more than one fruit, so adding separate counts would overcount them. Inclusion-Exclusion gives the exact number of customers who bought at least one fruit.

This is an example of a combinatorial argument, which is a proof or reasoning method based on counting objects in more than one way. In discrete mathematics, combinatorial arguments help show that formulas are correct and help solve problems efficiently.

Why this matters in Counting II

Counting II often deals with more advanced counting tools than basic multiplication or listing. Inclusion-Exclusion is one of the key ideas because it helps when categories overlap. It connects naturally to other topics like the pigeonhole principle and combinatorial reasoning because all of them are about careful counting.

Common Mistakes to Avoid

students, here are some frequent errors students make when using Inclusion-Exclusion:

  1. Forgetting the overlap
  • If you use $|A| + |B|$ for two overlapping sets, you will count shared objects twice.
  1. Subtracting too much
  • In three-set problems, do not stop after subtracting pairwise intersections. You must add back the triple intersection.
  1. Mixing up union and intersection
  • The union $A \cup B$ means โ€œin at least one set,โ€ while the intersection $A \cap B$ means โ€œin both sets.โ€
  1. Not checking what the question asks
  • Some problems ask for the number in the union, while others ask for the number in none of the sets. For โ€œnone,โ€ subtract the union from the total.

A good habit is to draw a Venn diagram when there are two or three sets. A diagram can make overlap easier to see and help you decide whether to add or subtract.

Practice Reasoning Example

Suppose a group of $40$ students was asked whether they play soccer $S$, basketball $B$, or baseball $A$.

  • $20$ play soccer,
  • $17$ play basketball,
  • $15$ play baseball,
  • $7$ play soccer and basketball,
  • $6$ play soccer and baseball,
  • $5$ play basketball and baseball,
  • $3$ play all three.

How many students play at least one sport?

Using Inclusion-Exclusion:

$$|S \cup B \cup A| = 20 + 17 + 15 - 7 - 6 - 5 + 3$$

$$|S \cup B \cup A| = 37$$

So $37$ students play at least one sport, and $3$ students play none.

This example shows how the method can answer questions that would be awkward to solve by direct listing.

Conclusion

Inclusion-Exclusion is a core counting technique in discrete mathematics. It helps correct overcounting when sets overlap by adding individual counts and subtracting shared parts in a careful pattern. For two sets, the formula is simple: $|A \cup B| = |A| + |B| - |A \cap B|$. For three or more sets, the pattern continues with alternating subtraction and addition.

students, this lesson fits into Counting II because it gives you a reliable strategy for solving more complex counting problems. When sets overlap, Inclusion-Exclusion turns messy counting into organized reasoning. That is why it is such an important tool in combinatorics and discrete mathematics ๐Ÿ“˜

Study Notes

  • Inclusion-Exclusion is used when sets overlap and direct addition would count some objects more than once.
  • For two sets, the key formula is $|A \cup B| = |A| + |B| - |A \cap B|$.
  • For three sets, use alternating signs: add single sets, subtract pairwise intersections, then add the triple intersection.
  • The union $A \cup B$ means โ€œin at least one set,โ€ while the intersection $A \cap B$ means โ€œin both sets.โ€
  • To find how many objects are in none of the sets, subtract the union from the total.
  • Venn diagrams are helpful for visualizing small Inclusion-Exclusion problems.
  • Inclusion-Exclusion is an important counting method in discrete mathematics because it handles overlap accurately.
  • It is closely connected to combinatorial arguments, which count the same objects in a structured way.

Practice Quiz

5 questions to test your understanding