5 Session Five: Counting 5.1 Session Objectives 5.2 5.3 Counting 5.4 Counting Techniques
5 Session Five: Counting 5.1 Session Objectives 5.2 5.3 Counting 5.4 Counting Techniques
5.2 Introduction
Counting techniques are discussed with particular emphaize on the inclusion-exclusion prin-
ciple.
5.3 Counting
Counting is the process of creating a bijection between a set we want to count and some
set whose size we already know. Typically this second set will be a finite ordinal N =
{1, 2, · · · , n}.
Counting a set A using a bijection f : A → N gives its size |A| = n which is called the
cardinality of N . Furthermore, it gives a well-ordering of A, since N is well-ordered as we
can define x ≤ y for x, y ∈ A by x ≤ y if and only if f (x) ≤ f (y).
Often the quickest way to find f is to line up all the elements of A in a well-ordering and
then count them off: the smallest element of A gets mapped to 1, the next smallest to 2,
and so on.
The branch of mathematics that studies sets constructed by combining other sets is called
combinatorics, and the subbranch that counts these sets is called enumerative combi-
natorics.
Theorem 5.4.1 (Addition/Sum Rule). Let A and B be finite disjoint sets (A ∩ B = ∅).
Then
|A ∪ B| = |A| + |B|
More generally, if A1 , A2 , · · · , An are pairwise disjoint sets (i.e., Ai ∩ Aj = ∅ ∀ i 6= j). Then
[n X n
Ai = |Ai |
i=1 i=1
Copyright
c Dr. Michael Munywoki, 2020. All rights reserved Page 2
Discrete Mathematics Counting
|A − B| = |A| − |A ∩ B|
|A × B| = |A| × |B|
More generally, n
Y Y n
Ai = |Ai |
i=1 i=1
where the product on the left is a Cartesian product and the product on the right is an
ordinary integer product.
Theorem 5.4.4 (Inclusion-Exclusion Principle). Let A and B be finite sets. Then
|A ∪ B| = |A| + |B| − |A ∩ B|
Copyright
c Dr. Michael Munywoki, 2020. All rights reserved Page 3
Discrete Mathematics Counting
Remark 5.4.1. To calculate the size of Al ∪ A2 ∪ · · · ∪ An , calculate the sizes of all possible
intersections of sets from {A1 , A2 , · · · , An }, add the results obtained by intersecting an odd
number of the sets, and then subtract the results obtained by intersecting an even number of
the sets.
Example 5.4.3. Give a formula for the number of elements in the union of four sets.
Solution:
So
|A ∪ B| = |A| + |B| − |A ∩ B|
1000 1000 1000
= + −
7 11 7 · 11
= 142 + 90 − 12
Copyright
c Dr. Michael Munywoki, 2020. All rights reserved Page 4
Discrete Mathematics Counting
Exercise 5.4.1. 1. A total of 1232 students take a course in Spanics, 879 take a course
in French, and 114 take a course in Russian. Further, 103 take courses in both Spanish
and French, 23 take both Spanish and Russian, and 14 take courses in both French and
Russian. If 2092 students are taking at least one Spanich, French, and Russian, how
many students take a course in all the three languages?
Solution:
2. Suppose that there are 1807 freshmen at your school. Of these, 453 are taking a
course in computer science, 567 are taking a course in mathematics, and 299 are
taking courses in both computer science and mathematics. How many are not taking a
course either in computer science or in mathematics?
(a) A1 ⊆ A2 and A2 ⊆ A3 .
(b) the sets are pairwise disjoint.
(c) there are two elements common to each pair of sets and one element in all three
sets.
For more material on Counting check out [2, 1, 3] or check the following additional reading
notes:1, 2 and 3. For more reference material you can also watch inclusion-exclusion principle.
References
[1] D. J. Hunter. Essentials of Discrete Mathematics. Jones & Bartlett Learning, 4 edition,
2021. ISBN-13:978-1284184761.
[3] K. Ross. Discrete Mathematics and Its Applications. McGraw-Hill Higher Education, 8
edition, 2018.
Copyright
c Dr. Michael Munywoki, 2020. All rights reserved Page 5