0.
1 Principle of inclusion-exclusion ⃝Francis
c Oketch
Dr. Francis Oketch Ochieng
Lecture 3 Email:
[email protected] Tel: +254712 457 837
0.1 Principle of inclusion-exclusion
If A and B are disjoint sets, then the number of elements in their union is equal to the sum of their
respective cardinalities, i.e., if A ∩ B = ∅, then
|A ∪ B| = |A| + |B|
However if A ∩ B ̸= ∅, then
|A ∪ B| = |A| +. |B| − |A ∩ B|
Hence, if A, B and C are three sets, then
|A ∪ B ∪ C| = |A| + |B| + |C| − |A ∩ B|
. − |A ∩ C| − |B ∩ C| + |A ∩ B ∩ C|
It can be easily extended for any finite number of sets.
Example(s):
1. Find the number of integers between 1 and 100 (inclusive) that are divisible by either 2 or 5.
Solution
Let A be the set of all integers divisible by 2, between 1 and 100 (inclusive).
A = {x : 1 ≤ x ≤ 100 and x is divisible by 2}
= {2, 4, 6, · · · , 100}
= {2y : 1 ≤ y ≤ 50}, ∴ |A| = 50
Let B be the set of all integers divisible by 5, between 1 and 100 (inclusive).
B = {x : 1 ≤ x ≤ 100 and x is divisible by 5}
= {5, 10, 15, · · · , 100}
= {5y : 1 ≤ y ≤ 20}, ∴ |B| = 20
A ∩ B - set of all integers between 1 and 100 divisible by both 2 and 5.
A ∩ B = {x : 1 ≤ x ≤ 100 and x is divisible by both 2 and 5}
= {10, 20, 30, · · · , 100}
= {10y : 1 ≤ y ≤ 10}, ∴ |A ∩ B| = 10
Hence,
|A ∪ B| = |A| + |B| − |A ∩ B| = 50 + 20 − 10 = 60
Exercise:
1. Find the number of integers between 1 and 100 (inclusive) divisible by 3, 5, or 7. [ans:
|A ∪ B ∪ C| = 55]
2. Find the number of even numbers between 200 and 400 (inclusive) which are divisible by 3, 5 or
7. [ans: |A ∪ B ∪ C| =]
0.2 Set identities (Boolean algebra)
1
0.2 Set identities (Boolean algebra) ⃝Francis
c Oketch
1. Identity laws: • A∩A=A
• A∩U =A • A∪A=A
• A∪∅=A 7. Adsorption laws:
2. Zero laws: • A ∩ (A ∪ B) = A
• A ∪ (A ∩ B) = A
• A∩∅=∅
• A∪U =U 8. Complementation laws:
3. Commutative laws: • A ∩ Ac = ∅
• A ∪ Ac = U
• A∩B =B∩A
• A∪B =B∪A 9. Double complementation:
4. Associative laws: • (Ac )c = A
• (A ∩ B) ∩ C = A ∩ (B ∩ C) 10. Universal laws:
• (A ∪ B) ∪ C = A ∪ (B ∪ C) • Uc = ∅
5. Distributive laws: • ∅c = U
• A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C) 11. De Morgan’s laws:
• A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C) • (A ∩ B)c = Ac ∪ B c
6. Idempotent laws: • (A ∪ B)c = Ac ∩ B c
0.2.1 How to prove set identities
There are three different methods of proving set identities
• Method 1: Using Venn diagram
In this method, we show that the two sides are equal by shading the required region (separately
for each side).
Example(s):
1. Prove the following set identities
(a) A ∪ (A ∩ B) = A
(b) (A ∩ B)c = Ac ∪ B c
• Method 2: Using Boolean Algebra
Example(s):
1. Prove the following set identities
(a) A ∩ (Ac ∪ B) = A ∩ B
2
0.2 Set identities (Boolean algebra) ⃝Francis
c Oketch
Proof.
A ∩ (Ac ∪ B) = (A ∩ Ac ) ∪ (A ∩ B) “Distributive law”
= ∅ ∪ (A ∩ B) “Complementaion law”
= (∅ ∪ A) ∩ (∅ ∪ B) “Distributive law”
= A ∩ B “Identity law”
(b) (Ac ∩ B c ) ∩ (A ∪ B ∪ C) = Ac ∩ B c ∩ C
Proof.
(Ac ∩ B c ) ∩ (A ∪ B ∪ C) = (A ∪ B)c ∩ (A ∪ B ∪ C) “De Morgan’s law”
= [(A ∪ B)c ∩ (A ∪ B)] ∪ [(A ∪ B)c ∩ C] “Distributive law”
= ∅ ∪ [(A ∪ B)c ∩ C] “Complementation law”
= (A ∪ B)c ∩ C “Identity law”
= Ac ∩ B c ∩ C “De Morgan’s law”
(c) A − (B ∪ C) = (A − B) ∩ (A − C)
Proof.
A − (B ∪ C) = A ∩ (B ∪ C)c
= A ∩ (B c ∩ C c ) “De Morgan’s law”
= (A ∩ B c ) ∩ (A ∩ C c ) “Distributive law”
= (A − B) ∩ (A − C)
• Method 3: Using set membership
In this method, we show that A = B iff A ⊂ B and B ⊂ A.
Example(s):
1. Prove the following set identities
(a) A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)
Proof. Using sets, show that A ∩ (B ∪ C) ⊂ (A ∩ B) ∪ (A ∩ C) and (A ∩ B) ∪ (A ∩ C) ⊂
A ∩ (B ∪ C)
Let x ∈ A ∩ (B ∪ C) ⇒ x ∈ A and x ∈ B ∪ C
⇒ x ∈ A and (x ∈ B or x ∈ C)
⇒ (x ∈ A and x ∈ B) or (x ∈ A and x ∈ C)
⇒ (x ∈ A ∩ B) or (x ∈ A ∩ C)
⇒ x ∈ (A ∩ B) ∪ (A ∩ C)
Hence, A ∩ (B ∪ C) ⊂ (A ∩ B) ∪ (A ∩ C)
Conversely,
Let y ∈ (A ∩ B) ∪ (A ∩ C) ⇒ y ∈ A ∩ B or y ∈ A ∩ C
⇒ (y ∈ A and y ∈ B) or (y ∈ A and y ∈ C)
⇒ y ∈ A and (y ∈ B or y ∈ C)
⇒ y ∈ A and y ∈ B ∪ C
⇒ y ∈ A ∩ (B ∪ C)
Hence, (A ∩ B) ∪ (A ∩ C) ⊂ A ∩ (B ∪ C)
Therefore, A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C).
3
0.2 Set identities (Boolean algebra) ⃝Francis
c Oketch
(b) (A ∩ B)c = Ac ∪ B c
Proof. Using sets, show that (A ∩ B)c ⊂ Ac ∪ B c and Ac ∪ B c ⊂ (A ∩ B)c
Let x ∈ (A ∩ B)c ⇒ x ∈
/ A∩B
⇒ x∈
/ A or x ∈
/B
⇒ x ∈ Ac or x ∈ B c
⇒ x ∈ Ac ∪ B c
Hence, (A ∩ B)c ⊂ Ac ∪ B c
Conversely,
Let y ∈ Ac ∪ B c ⇒ y ∈ Ac or y ∈ B c
⇒ y∈
/ A or y ∈
/B
⇒ y∈
/ A∩B
⇒ y ∈ (A ∩ B)c
Hence, Ac ∪ B c ⊂ (A ∩ B)c
Therefore, (A ∩ B)c = Ac ∪ B c .
2. Let A ⊂ B ∪ C and A ∩ B = ∅. Show that A ⊂ C.
Proof.
Let x ∈ A ⇒ x ∈ B ∪ C
⇒ x ∈ B or x ∈ C
If x ∈ B, then x ∈ A ∩ B which is a contradiction since A ∩ B = ∅. Thus, x ∈ C and hence
A ⊂ C.
3. Prove that if A ⊂ C and B ⊂ D then A ∪ B ⊂ C ∪ D
Proof.
Let x ∈ A ∪ B ⇒ x ∈ A or x ∈ ∪B
if x ∈ A ⇒ x ∈ C since A ⊂ C
if x ∈ B ⇒ x ∈ D since B ⊂ D
∴ x ∈ C or x ∈ ∪D
⇒ x∈C ∪D
Therefore, A ∪ B ⊂ C ∪ D.
4. Show that P(A ∩ B) = P(A) ∩ P(B)
Proof.
Let X ∈ P(A ∩ B) ⇒ X ⊂ A ∩ B
⇒ X ⊂ A and X ⊂ B
⇒ X ∈ P(A) and X ∈ P(B)
⇒ X ∈ P(A) ∩ P(B)
5. For any 3 non-empty sets A, B, C, then A × (B ∩ C) = (A × B) ∩ (A × C).
4
0.2 Set identities (Boolean algebra) ⃝Francis
c Oketch
Proof.
Let (x, y) ∈ A × (B ∩ C) ⇒ x ∈ A and y ∈ B ∩ C
⇒ x ∈ A and (y ∈ B and y ∈ C)
⇒ x ∈ A and y ∈ B) and (x ∈ A and y ∈ C)
⇒ (x, y) ∈ A × B and (x, y) ∈ A × C
⇒ (x, y) ∈ (A × B) ∩ (A × C)
Hence, A × (B ∩ C) ⊂ (A × B) ∩ (A × C)
Conversely,
Let (p, q) ∈ (A × B) ∩ (A × C) ⇒ (p, q) ∈ (A × B) and (p, q) ∈ (A × C)
⇒ (p ∈ A and q ∈ B) and (p ∈ A and q ∈ C)
⇒ p ∈ A and (q ∈ B and q ∈ C)
⇒ p ∈ A and q ∈ B ∩ C
⇒ (p, q) ∈ A × (B ∩ C)
Hence, (A × B) ∩ (A × C) ⊂ A × (B ∩ C)
Therefore, A × (B ∩ C) = (A × B) ∩ (A × C).
Exercise:
1. Show that
(a) A − B = A ∩ B c
(b) (A ∩ B) ∩ C = A ∩ (B ∩ C)
(c) (A − C) − (B − C) = (A − B) − C. [hint: use boolean algebra]
(d) [A ∪ (B ∩ C)]c = (C ∩ B)c − A. [hint: use boolean algebra]
2. Prove that if A ⊂ C and B ⊂ D then A ∩ B ⊂ C ∩ D.
3. Show that P(A) ∪ P(B) ⊂ P(A ∪ B). Is P(A) ∪ P(B) = P(A ∪ B) in general? Explain. [ans:
P(A) ∪ P(B) ̸= P(A ∪ B). Use A = {a} and B = {b}]
4. Show that if A ⊂ B, then P(A) ∪ P(B) = P(A ∪ B).
5. Let A,B,C,D be sets. If A × B = ∅ and A × B = C × C, then A = C and B = D.
6. Show that A × (B ∪ C) = (A × B) ∪ (A × C).
1
1
Mathematics is fun!