Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 13

The Principle of Inclusion-Exclusion: Formulation and Proof

Recommended resources

Welcome back! In the previous module, we delved into the Pigeonhole Principle, a powerful tool for proving the existence of certain properties in combinatorial structures. We culminated our study by proving the elegant Erdős-Szekeres theorem, which guarantees order within seemingly random sequences.

Today, we pivot from existence proofs to the art of precise counting. We will introduce another fundamental pillar of combinatorics: the Principle of Inclusion-Exclusion (PIE). While the sum rule allows us to count disjoint sets, PIE gives us a systematic method for counting the elements in a union of overlapping sets by cleverly adding and subtracting the parts that have been overcounted. This principle is indispensable for tackling a vast range of complex counting problems you'll encounter in higher-level combinatorics.

Our learning outcome for this lesson is to formulate and prove the general Principle of Inclusion-Exclusion.

The Intuition: Correcting for Overlaps

Before diving into a general formula, let's build our intuition. You're already familiar with the simplest case of PIE for two sets, A and B. When we want to find the size of their union, , a naive first attempt would be to simply add their sizes: . However, any elements in the intersection have been counted twice. To correct this, we subtract the size of the intersection once.

This gives us the familiar formula:

Now, let's extend this to three sets: A, B, and C.

Principle of Inclusion-Exclusion - AoPS Wiki - Art of Problem Solving

This article from the Art of Problem Solving Wiki provides a clear, step-by-step development of the intuition behind PIE.

Start by reading the Two Set Example for a quick refresher. Then, carefully read the Three Set Example, which breaks down the process of overcounting and correction for three sets. Pay close attention to how the elements in the triple intersection are first added three times, then subtracted three times, and finally need to be added back in.

The logic you just read for three sets leads to the formula:

This process is visualized perfectly in the following diagram, which shows how many times each region is counted at each stage of the formula.

The Venn diagrams illustrate the counting process for PIE with three sets. (Left) Naively summing the sets overcounts the intersections. (Center) Subtracting pairwise intersections undercounts the central region. (Right) Adding the triple intersection back results in each region being counted exactly once.

Notice the pattern: we add the sizes of single sets, subtract the sizes of pairwise intersections, and then add back the size of the triple intersection. This alternating sum is the core idea of the principle.


The General Formula

We can now generalize this pattern to any number of finite sets, . This gives us the formal statement of the Principle of Inclusion-Exclusion.

The Principle of Inclusion-Exclusion (PIE): For finite sets , the size of their union is given by:

Using more compact summation notation, this is:

This formula states that to find the size of the union, we sum the sizes of all non-empty intersections, with the sign determined by whether the number of sets in the intersection is odd or even.


Proof of the Principle

Stating the formula is one thing; proving its universal correctness is another. We'll explore two distinct proofs that offer different insights into why PIE works. This aligns with your goal of gaining a deep and versatile understanding of combinatorics.

Proof 1: The Combinatorial Argument

The most intuitive proof involves showing that every element in the union is counted exactly once on the right-hand side of the equation.

Let's consider an arbitrary element that belongs to the union . Suppose that is a member of exactly of these sets, where . We need to show that this element contributes a net count of exactly 1 to the right-hand side of the PIE formula.

  • The first term, , counts exactly times.
  • The second term, , subtracts the count of exactly times, since is in of the pairwise intersections.
  • The third term adds the count of back times.
  • ...and so on.

The total number of times is counted is:

Recall the binomial theorem identity: . If we set , we get:

Rearranging this gives us:

Since , the total count for our element is exactly 1. This holds for any element in the union, so the formula is correct.

This video provides a great walkthrough of this argument, framing it in terms of "conditions" an element might satisfy.

INCLUSION-EXCLUSION PRINCIPLE - DISCRETE MATHEMATICS

This video from TrevTutor presents the general formula for PIE and gives a formal proof using the combinatorial argument we just discussed.

Watch the segment from this timestamp where the presenter proves why an element lying in the intersection of r sets is counted exactly once by the formula. The video uses r where we used k, but the logic is identical.

Proof 2: An Algebraic Approach with Characteristic Functions

For a different and highly elegant perspective, we can use an algebraic tool called characteristic functions. This method transforms the problem from counting elements in sets to manipulating simple functions.

2 The Principle of Inclusion-Exclusion

This document provides a formal proof of PIE using characteristic functions. It's a powerful technique common in advanced combinatorics.

First, read the introductory section to understand the definition and properties of characteristic functions. Pay special attention to the identities listed in Proposition 2.0.2. Next, read the main proof in the section titled "The Main Result: PIE". Focus on how the proof reduces the problem of counting elements to proving an identity for these functions for a single element x.

Let's summarize the key steps of this algebraic proof:

  1. Define the Characteristic Function: For a subset of a universal set , the characteristic function is 1 if and 0 otherwise. A key property is that .
  2. Relate Set Operations to Algebra:
    • Intersection:
    • Complement:
  3. Express the Union: Using De Morgan's laws, the union can be written as the complement of an intersection: .
  4. Translate to Characteristic Functions: Substituting , we get:
  5. Expand and Simplify: When we expand the product on the right, the '1' cancels out, and we are left with:
  6. Sum Over All Elements: Summing this identity over all gives us the PIE formula:

This proof is exceptionally clean and shows the deep connection between logic, set theory, and algebra.


Conclusion

In this lesson, we have formally introduced the Principle of Inclusion-Exclusion, one of the most versatile tools in enumerative combinatorics.

Key Takeaways:

  • PIE provides a general formula to count the elements in a union of overlapping sets.
  • The core idea is to systematically correct for overcounting and undercounting by creating an alternating sum of intersection sizes.
  • The general formula for the union of sets is: .
  • We proved this formula using two different methods: a combinatorial argument that tracks how individual elements are counted, and an algebraic proof using characteristic functions. Both are essential perspectives for deep mastery.

You have now formally derived and proven PIE. In the upcoming lessons, we will put this powerful tool to work. Our next topic will be applying PIE to solve complex distribution problems, such as using the stars and bars method with upper-bound constraints, a common scenario in Olympiad problems.