Read · 2 min

The Principle of Inclusion-Exclusion (PIE) is a theorem that allows one to calculate the number of elements in a union of multiple finite sets.

First, consider two sets, AA and BB. PIE states that: ∣A∪B∣=∣A∣+∣B∣−∣A∩B∣|A \cup B| = |A| + |B| - |A \cap B| where ∣S∣|S| denotes the cardinality of a set SS (the cardinality of a set is the number of elements in the set).

Why does this work? Well, the union of AA and BB can be thought of in terms of 33 different regions: the elements in AA and not in BB, the elements in BB and not in AA, and the elements in both AA and BB. (These regions can be seen very clearly in a Venn diagram.)

As an example, take the elements in both AA and BB. When one adds ∣A∣|A| and ∣B∣|B|, these elements are counted twice; however, when ∣A∩B∣|A \cap B| is subtracted, these elements are removed once, so they are counted a total of once, as desired. Similarly, one can check that the elements in the other two regions are also counted exactly once each.

Now, consider three sets: AA, BB, and CC. PIE states that: ∣A∪B∪C∣=∣A∣+∣B∣+∣C∣−∣A∩B∣−∣B∩C∣−∣C∩A∣+∣A∩B∩C∣.|A \cup B \cup C| = |A| + |B| + |C| - |A \cap B| - |B \cap C| - |C \cap A| + |A \cap B \cap C|.

Consider the region containing elements in all 33 sets. The first three terms count these elements 33 times; the second three terms subtract these elements 33 times; and the last term adds these elements once. In total, they are counted 3−3+1=13 - 3 + 1 = 1 time, as desired. (One can check that the same holds for the other 66 regions of the union of A,B,A, B, and CC.

PIE can be extended to any finite number of finite sets. To compute the cardinality of the union of nn finite sets:

  1. Add the cardinalities of the sets.

  2. Subtract the cardinalities of the pairwise intersections.

  3. Add the cardinalities of the triple-wise intersections.

  4. Subtract the cardinalities of the quadruple-wise intersections.

  5. Continue, until the cardinality of the nn-tuple-wise intersection is added (if nn is odd) or subtracted (nn even).

This can be written in terms of an equation, but it tends to be easier to understand the method explained above rather than the equation.

The union of nn sets has 2n−12^n - 1 regions. Consider a region that contains the elements from exactly kk of the nn sets, where kk is an integer from 11 to nn. Then, the first step counts these elements k=(k1)k = {k\choose 1} times. The second step excludes these elements (k2){k\choose 2} times. This continues, until, on the kkth step, the elements are included (if kk is odd) or excluded (if kk is even) exactly 1=(kk)1 = {k\choose k} time. Therefore, the number of times the elements are included (denoted NN) is: N=(k1)−(k2)+(k3)−(k4)+...+(−1)k−1(kk)N = {k\choose 1} - {k\choose 2} + {k\choose 3} - {k\choose 4} + ... + (-1)^{k-1} {k\choose k} N=1−(1−1)kN = 1 - (1-1)^k N=1N = 1 where the second step follows from the Binomial Theorem. Thus, every element is counted exactly once, as desired!

Find your level

The problems run from approachable to very hard, and each is rated by how often real students solve it, so you can pick your next step. These are real problems from the AMC 8, AMC 10, AMC 12 and AIME, the national math competitions for middle and high school students, each with a worked solution on LIVE by Po-Shen Loh.

Interactive · 3 questions

Here, rather than give a standard exercise or practice problem, I will explore some implications that PIE yields for positive real numbers.

We first recall what PIE is:

∣A1∪A2∪...∪An∣|A_1 \cup A_2 \cup ... \cup A_n| is equal to

∑i=1n∣Ai∣−∑i,j=1,i≠jn∣Ai∩Aj∣+∑i,j,k=1,i≠j≠k≠in∣Ai∩Aj∩Ak∣−...\displaystyle\sum_{i=1}^n |A_i| - \displaystyle\sum_{i,j=1, i \neq j}^n |A_i \cap A_j| + \displaystyle\sum_{i,j,k=1, i \neq j \neq k \neq i}^n |A_i \cap A_j \cap A_k| - ...

and so on until we reach the final term, which is

(−1)n−1∣A1∩A2∩...∩An∣(-1)^{n-1}|A_1 \cap A_2 \cap ... \cap A_n|.

Now, let's translate this into the language positive real numbers.

For each ri≥0r_i \ge 0, define RiR_i to be the interval set of a given rir_i. (Ok, I am just making this terminology up at this point as it is mostly original.)

What is this interval set to be exact? Let ϵ\epsilon be a small positive number. We define

Ri=[ϵ,2ϵ,..nϵ]R_i = [ \epsilon, 2\epsilon, .. n\epsilon] where nn is the positive integer such that

nϵ≤ri<(n+1)ϵn\epsilon \le r_i < (n+1)\epsilon

If ϵ=0.5\epsilon = 0.5, what is R1R_1 if r1=1.7r_1 = 1.7?

Choose one answer

Type a concept, like “slope” or “photosynthesis”.

↑ ↓ to choose · Enter to openSearch explanations and problems