0% found this document useful (0 votes)
61 views10 pages

The Inclusion Exclusion Principle 5

The document discusses the Inclusion-Exclusion Principle, which is a counting technique that computes the number of elements that satisfy at least one of several properties while avoiding double counting. It provides definitions and proofs for two sets and three sets. Examples are given to illustrate counting problems involving sets and their intersections.

Uploaded by

novelynbanut7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views10 pages

The Inclusion Exclusion Principle 5

The document discusses the Inclusion-Exclusion Principle, which is a counting technique that computes the number of elements that satisfy at least one of several properties while avoiding double counting. It provides definitions and proofs for two sets and three sets. Examples are given to illustrate counting problems involving sets and their intersections.

Uploaded by

novelynbanut7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Discrete Mathematics

The Inclusion-Exclusion Principle

Group 4:
Buca, Noel
Celoy, Conley
Domiclong, Nika
Delio, Eunah
Legueb, Aldrin
Pandosen, Dulce Amor
Pastor, Anjanet
Segundo, Novelyn

April 2024
The Inclusion-Exclusion Principle
∣A∪B∣=∣A∣+∣B∣−∣A∩B∣
Definition. The Principle of Inclusion and Exclusion is a counting technique that computes the number of
elements that satisfy at least one of several properties while guaranteeing that elements satisfying more than one
property are not counted twice.
The underlying idea behind the principle is that summing the number that satisfies at least one of two
categories and subtracting the overlap to prevent double counting. This principle is particularly useful in
combinatorics and probability problem solving when it is necessary to devise a counting method that ensures an
object is not counted twice.
A classic representation of this principle is a Venn Diagram.
Two Sets. Case of objects being separated into two, possibly disjoint, sets. If |A| and |B| are finite sets, then the
the principle of Inclusion and Exclusion states that
∣A∪B∣=∣A∣+∣B∣−∣A∩B∣
Where the |S| denotes the cardinality of set in set notation.
Proof:
Since 𝐴 = (𝐴 − 𝐵) ∪ (𝐴 ∩ 𝐵) and 𝐴 − 𝐵 and 𝐴 ∩ 𝐵 are disjoints, by Addition Principle
|𝐴| = |𝐴 − 𝐵| + |𝐴 ∩ 𝐵|.
Similarly,
|𝐵| = |𝐵 − 𝐴| + |𝐴 ∩ 𝐵|.
Since 𝐴 ⋂ 𝐵 = (𝐴 − 𝐵) ∪ (𝐴 ∩ 𝐵) ∪ (𝐴 − 𝐵) and 𝐴 − 𝐵, 𝐴 ∩ 𝐵, and 𝐵 − 𝐴 are pairwise disjoints,
by Addition Principle.
|𝐴 ∪ 𝐵| = |𝐴 − 𝐵| + |𝐴 ∩ 𝐵| + |𝐴 − 𝐵|.
Combining the equations |𝐴| = |𝐴 − 𝐵| + |𝐴 ∩ 𝐵|, |𝐵| = |𝐵 − 𝐴| + |𝐴 ∩ 𝐵|, and
|𝐴 ∪ 𝐵| = |𝐴 − 𝐵| + |𝐴 ∩ 𝐵| + |𝐴 − 𝐵| , we obtain
|𝐴| + |𝐵| = |𝐴 − 𝐵| + |𝐴 ∩ 𝐵| + |𝐵 − 𝐴| + |𝐴 ∩ 𝐵| = |𝐴 ∪ 𝐵| + |𝐴 ∩ 𝐵|.
Subtracting |𝐴 ∩ 𝐵| from both sides of the preceding equation gives the desired result.
Illustration
Example
In a discrete mathematics class, every student is a major in computer science or mathematics or both.
The number of students having computer science as a major (possibly along with mathematics) is 25; the
number of students having mathematics as a major (possibly along with computer science) is 13; and the
number of students majoring in both computer science and mathematics is 8. How many students are in the
class?
Solution:
|A∪B| = |A| + |B| −|A∩B|
= 25 + 13 −8 = 30
Three Sets. If there are three sets, the principle states that
∣A∪B∪C∣=∣A∣+∣B∣+∣C∣−∣A∩B∣−∣A∩C∣−∣B∩C∣+∣A∩B∩C∣
Illustration

Examples 1
A total of 1232 students have taken a course in Spanish, 879 have taken a course in French, and 114
have taken a course in Russian. Further, 103 have taken courses in both Spanish and French, 23 have taken
courses in both Spanish and Russian, and 14 have taken courses in both French and Russian. If there are 2092
students who’ve taken a course in either Spanish, French. and Rusian, how many students have taken a course
in all of the three languages?

Solution:
Let S be the set of students who have taken a course in Spanish, F the set of students who have taken a
course in French, and R the set of students who have taken a course in Russian. Then, we have
|S| = 1232 |F| = 879
|R| = 114 |S∩F| = 103
|S∩R| = 23 |F∩R| = 14
|S∪F∪R|=2092
Using the equation:
|S∪F∪R| = |S|+ |F|+ |R| − |S∩F| − |S∩R| − |F∩R| + |S∩F∩R|
2092= 1232 + 879 + 114 −103 −23 −14 + |S∩F∩R|

|S∩F∩R| = - |S|- |F|- |R| + |S∩F| + |S∩R| + |F∩R| + |S∪F∪R|


= - 1232 - 879 - 114 + 23 + 103 + 14 + 2092
=7
Therefore, there are 7 students who’ve taken all of the three languages.

Example 2
There are 350 farmers in a large region. 260 farm carrots, 100 farm potatoes, 70 farm radish, 40 farm
carrots and radish, 40 farm potatoes and radish, and 30 farm carrots and potatoes. Let C, P, and R denote the set
of farms that farm carrots, potatoes, and radish respectively. Determine the number of farmers that farm carrots,
potatoes, and radish.

Solution:

The letters for denoting the sets have already been provided in the question itself. We may therefore note
the cardinality straight away:

Given: |U| = 350 |C| = 260

|P| = 100 |R| = 70

|C ∩ R| = 40 |P ∩ R| = 40

|C ∩ P| = 30

We need to determine the cardinality of the intersection of all three sets, which is |C ∩ P ∩ R|. This is
the unknown which we can assign algebraically. Use x to represent |C ∩ P ∩ R|.

Let x farmers farm carrots, potatoes, and radish. That is, let |C ∩ P ∩ R| = x

Now solve for x algebraically:

|U|= 350 = 190 + x + (30 – x) + x + (40 – x) + (40 – x) + 30 + x + x – 10

350 = 320 + x

x = 30

Therefore, 30 farmers farm carrots, potatoes and radish.

Generalization. In general, the Inclusion-Exclusion Principle can be represented as follows.

If A1​, A2 ​…, An​are finite sets, then the principle of inclusion and exclusion states
𝑛
||⋃𝑛 𝐴 || = ∑ |𝐴 | − 𝑛−1
| 𝑖=1 𝑖| 𝑖
𝑖=1

1≤𝑖<𝑗≤𝑛
| 𝐴𝑖 ∩ 𝐴𝑗| + ∑
1≤𝑖<𝑗<𝑘≤𝑛
| 𝐴𝑖 ∩ 𝐴𝑗 ∩ 𝐴𝑘| − … + (− 1) |𝐴1∩… ∩𝐴𝑛|

Proof:
From the two-set inclusion-exclusion proof,
|
𝐴𝑖∪𝐴𝑗| = |𝐴𝑖| + |𝐴𝑗| − |𝐴𝑖∩𝐴𝑗 , |
We start by writing the three-fold union as the union of two sets:
|𝐴1∪𝐴2∪𝐴3|=|(𝐴1∪𝐴2)∪𝐴3|

and so we can use the two-set result 𝐴1∪ 𝐴2and 𝐴3 , so

|(𝐴1∪ 𝐴3)∪𝐴3|=|𝐴1∪𝐴2|+|𝐴3|−|(𝐴1∪𝐴2)∩𝐴3|

Now we can use the two-set result on |𝐴1∪𝐴2| to get

|𝐴1∪𝐴2∪𝐴3|=|𝐴1∪𝐴2|+|𝐴3|−|(𝐴1∪𝐴2)∩𝐴3|=|𝐴1|+|𝐴2|−|𝐴1∩𝐴2|+|𝐴3|−|(𝐴1∪𝐴2)∩𝐴3|=|𝐴1|+|𝐴2|+|𝐴3|−|𝐴1∩𝐴2|−|(
𝐴1∪𝐴2)∩𝐴3|

Now use the distributive property on the last term:


|𝐴1∪𝐴2∪𝐴3|=|𝐴1|+|𝐴2|+|𝐴3|−|𝐴1∩𝐴2|−|(𝐴1∩𝐴3)∪(𝐴2∩𝐴3)|

and use the two-set property yet again on the last term, with sets 𝐴1∩𝐴3 and 𝐴2∩𝐴3 to get

|(𝐴1∩𝐴3)∪(𝐴2∩𝐴3)|=|𝐴1∩𝐴3|+|𝐴2∩𝐴3|−|(𝐴1∩𝐴3)∩(𝐴2∩𝐴3)|=|𝐴1∩𝐴3|+|𝐴2∩𝐴3)|−|𝐴1∩𝐴2∩𝐴3|

Finally, we get:
|𝐴1∪𝐴2∪𝐴3|=|𝐴1|+|𝐴2|+|𝐴3|−|𝐴1∩𝐴2||−|𝐴1∩𝐴3|−|𝐴2∩𝐴3|+|𝐴1∩𝐴2∩𝐴3|

In other words, we have that the size of a three-set union can be comp
𝑛
||⋃𝑛 𝐴 || = ∑ |𝐴 | − 𝑛−1
| 𝑖=1 𝑖| 𝑖
𝑖=1

1≤𝑖<𝑗≤𝑛
| 𝐴𝑖 ∩ 𝐴𝑗| + ∑
1≤𝑖<𝑗<𝑘≤𝑛
| 𝐴𝑖 ∩ 𝐴𝑗 ∩ 𝐴𝑘| − … + (− 1) |𝐴1∩… ∩𝐴𝑛|

An alternative form of inclusive and exclusive counting principles:

Let U be the universal set where |U|=N:

|A’ | = N - |A|

|A’ ∩ B’| = N - |A ∪ B|

| A’∩ B’∩ C’| = N - |A ∪ B ∪ C|

In general:

|A1’∩ A2’∩ A3’ ∩ … ∩ An’| = N - |A1 ∪ A2 ∪ A3 ∪ … ∪ An|


𝑛
= N - ∑ |𝐴𝑖| +
𝑖=1

1≤𝑖<𝑗≤𝑛
|𝐴𝑖 ∩ 𝐴𝑗| − ∑ |𝐴𝑖 ∩ 𝐴𝑗 ∩ 𝐴𝑘| + … + |𝐴1∩… ∩𝐴𝑛|
1≤𝑖<𝑗<𝑘≤𝑛
Applications

Example 1: Solving for linear equation model.

How many nonnegative integer solutions of x1+x2+x3=11 where with x1 ≤ 3, x2 ≤ 4, and x3 ≤ 6 ?

To apply the inclusion-exclusion, let a solution have c1 if x1 > 3, condition c2 if x2 > 4 and condition c3 if
x3 >6. The number of solutions satisfying the inequalities x 1≤3,x2≤4 and x3≤6 is. n(c1’∩c2’∩c3’)

n(c1’∩c2’∩c3’) = N- [n(c1)+n(c2)+n(c3)]+[n(c1⋂c2)+n(c1⋂c3)+n(c2⋂c3)]-n(c1∩c2∩c3)

=N-n(c1)-n(c2)-n(c3)+n(c1⋂c2)+n(c1⋂c3)+n(c2⋂c3)-n(c1∩c2∩c3)

=78-36-28-15+6+1+0+0 = 6 solutions

N =C( 11+3-1 , 3-1)= C(13,2)=78

n(c1)=(number of solution with x1≥4) = C(7+3-1, 2)=C(9,2)=36

n(c2)=(number of solution with x2≥5)= C(6+3-1, 2)=C(8,2)=28

n(c3)=(number of solution with x3 ≥7)=C(6,4)=15

n(c1⋂c2)=(number of solution with x1≥4 and x2≥5)=C(2+3-1, 2)=C(4,2)=6

n(c1⋂c3)=C(0+3-1,2)=C(2,2)=1

n(c2⋂c3)=C(-1+3-1,2)=C(1,2)=0

n(c1∩c2∩c3)= C(-4+3-1, 2)=C(-2,2)=0

Example 2: Prime numbers

For this we can use:

We can also say that N= S0 , our first summation(“of item with one condition “) is = S1, thus S2 is the
second summation of item with two conditions and so on.

|A1’∩ A2’∩ A3’ ∩ … An’| = S0 - S1+ S2 - S3+...+(-1)n-1Sn

How many prime numbers not exceeding 100 are there?


(The Sieve of Eratosthenes : simple and ancient algorithm used to find the prime numbers up to any given limit.)

Solution : 100 = 10 and the prime numbers less than 10 are 2,3,5,7.

S0 - S1+S2-S3+S4 = 99-117+ 45- 6+0 = 21

S0 = 99 numbers excluding 1

S1= ⌊100/2⌋+ ⌊100/3⌋+ ⌊100/5⌋+ ⌊100/7⌋= 117

S2 = ⌊100/6⌋+ ⌊100/10⌋+ ⌊100/14⌋+ ⌊100/15⌋+ ⌊100/21⌋+ ⌊100/35⌋=45

S3= ⌊100/30⌋+ ⌊100/42⌋+ ⌊100/70⌋+ ⌊100/15⌋+ ⌊100/105⌋=6


S4= ⌊100/210⌋=0

Conclusion: There are 21 prime numbers from 1 to 100.


Example 3: Counting onto function:
How many onto functions are there from a set with six elements to a set with three elements?
Suppose that the elements in the codomain are a, b, c. Let c1,c2, and c3 be the properties that a, b, and c
are not in the range of the function, respectively. The function is onto if none of the properties c1,c2 and c3 hold.
So,

n(c1’⋂c2’⋂c3’) = S0 - S1+ S2 - S3
S0= the total number of functions from a set with six elements to one with three elements.
=36
S1= the total number of functions that do not have one element in the range.
=3C1 . 26
S2 = the number of functions that do not have two elements in the range.
=3C2 . 16
S3 = the numbers of functions that do not have three elements in the range.
= 3C3 . 06
Hence, the number of onto functions from a set with dix to a set with three elements is:
n(c1’⋂c2’⋂c3’) = S0 - S1+ S2 - S
=36- 3C1 . 26+3C2 . 16-3C3 . 0
=36-3(26)+3
= 729 -192 + 3
= 540
Example 4: Derangement

There are 3 people at a party. Each person threw their coat onto the bed. When the party's over,
everyone picks up a coat at random. In how many ways NOBODY gets their own coat?
The “nobody” makes this a derangement, since each person is not matched with their own coat.
Brute force:
Trial: 1 2 3

1 1 2 3

2 1 3 2

3 2 1 3

4 2 3 1

5 3 1 2

6 3 2 1

We could also use the principle of inclusion-exclusion to find ( where ci = person i got their coat):
n(c1’∩ c2’ ∩ c3’) = S0 - S1+ S2 - S3
S0=3!
S1= 3C1 . 2!
S2 =3C2 . 1!
S3=3C3 . 0!
n(c1’∩ c2’ ∩ c3’) = 3! - 3C1 . 2! + 3C2.1 !- 3C3.0!
3! 3! 3!
=3!- 1!2!
2! + 1!2!
1! − 3!0!
0!
3! 3! 3!
=3!- 1!
+ 2!
1! − 3!

(
=3! 1 − +
1
1!
1
2!

1
3! )
=3!(1 − 1 + )
1 1
2
− 6

= 6( ) =2
1
3
Theorem:
The number of derangements of a set with n elements is

Dn = n! 1 − ( 1
1!
+
1
2!
+... + (− 1)
𝑛 1
𝑛! )
Proof: Let a permutation have property Ai if it fixes element i.
The number of derangements is the number of permutations having none of the properties Ai for i = 1, 2, … , n.
This means that
Dn = |A1’∩ A2’∩ A3’ ∩ … An’|
Let U be the universal set where |U|=N
Dn = N - |A1U A2U A3 U … An|
𝑛
𝑛−1
= N - ∑ |𝐴𝑖| +
𝑖=1

1≤𝑖<𝑗≤𝑛
|𝐴𝑖 ∩ 𝐴𝑗| − ∑
1≤𝑖<𝑗<𝑘≤𝑛
| 𝐴𝑖 ∩ 𝐴𝑗 ∩ 𝐴𝑘| + … + (− 1) |𝐴1∩… ∩𝐴𝑛|

𝑛
* ∑ |𝐴𝑖| = nc1 .(n-1)!
𝑖=1

* ∑
1≤𝑖<𝑗≤𝑛
|𝐴𝑖 ∩ 𝐴𝑗| = nC2 .(n-2)!

* In general:

∑ |A1U A2U A3 U … Am|= nCm . (n-m)!


1≤𝑖<𝑗≤𝑛

Dn = N- nC1 .(n-1)!+ nC2 .(n-2)!- nC3 . (n-3)!+...+(-1)n nCn . (n-n)!


Dn = n! - nC1 .(n-1)!+ nC2 .(n-2)!- nC3 . (n-3)!+...+(-1)n nCn . (n-n)!
𝑛! 𝑛! 𝑛 𝑛!
Dn = n!- (𝑛−1)!1!
(𝑛 − 1)! + (𝑛−2)!2!
(𝑛 − 2)! − ... + (− 1) 𝑛!0!
0!
𝑛! 𝑛! 𝑛 𝑛!
= n!- 1!
+ 2! −... + (− 1) 𝑛!

(
Dn = n! 1 −
1
1!
+
1
2!
−... + (− 1)
𝑛 1
𝑛! )◾
Example
There are 10 people at a party. Each person threw their coat onto the bed. When the party's over,
everyone picks up a coat at random. How many ways does NOBODY get their own coat?
For this, we could use the principle of inclusion and exclusion to find where
ci = person who got their coat.
n(c1’ ⋂ c2’ ⋂ c3’ ⋂ c4’ ⋂ c5’ ⋂ c6’ ⋂ c7’ ⋂ c8’ ⋂ c9’ ⋂ c10’) = D10

D10= 10!( 1
2!

1
3!
+
1
4!

1
5!
+
1
6!

1
7!
+
1
8!

1
9!
+
1
10! )
=10!( )
1 1 1 1 1 1 1 1 1
2
− 6
+ 24
− 120
+ 720
− 5040
+ 40320
− 362880
+ 3628800

=1334961 ways that nobody gets their coat.

References:
Principle of Inclusion and Exclusion (PIE) | Brilliant Math & Science Wiki

Johnsonbaugh, R.“Inclusion-Exclusion Principle.” Discrete Mathematics, Pearson, 2018, pp 262-263


Derangements | Brilliant Math & Science Wiki
Rosen, H. (2019), Discrete Mathematics and its application: Eighth edition. | New York, NY : McGraw-Hill.
Inclusion-Exclusion Principle: Examples with Solutions

You might also like