Better Discrete Maths
Better Discrete Maths
1 INTRODUCTION 4
1.1 What is Discrete Mathematics? . . . . . . . . . . . . . . . . . . . . 4
1.2 Importance of studying Discrete Mathematics . . . . . . . . . . . . . . . 4
2 Set Theory 6
2.1 Definition of a set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2 Notations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2.1 Specifying Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.3 Some important sets used in Mathematics . . . . . . . . . . . . . . . . . 8
2.4 Subsets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.4.1 Proper subset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.4.2 Equal sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.4.3 Super set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.4.4 The Null set or the Empty set . . . . . . . . . . . . . . . . . . . 10
2.4.5 Singleton Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.5 Cardinality of a set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.5.1 Number of subsets for a finite set . . . . . . . . . . . . . . . . . . 11
2.5.2 The power set . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.5.3 The Universal set . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.6 Venn Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.7 Set Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.7.1 Union of sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.7.2 Intersection of sets . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2
CONTENTS 3
3 Relations 24
3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.2 Cartesian Product of sets . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Chapter 1
INTRODUCTION
Definition 1.1.1. The study of mathematical properties of sets and systems that have
a countable number of elements.
4
1.2 Importance of studying Discrete Mathematics 5
e) Discrete mathematics has become popular in recent decades because of its applica-
tions to computer science. Discrete mathematics is the mathematical language of
computer science. Concepts and notations from discrete mathematics are useful in
studying and describing objects and problems in all branches of computer science,
such as computer algorithms, programming languages, cryptography, automated the-
orem proving, and software development.
f) Discrete math plays the significant role in big data analytics. The Big Data era
poses a critically difficult challenge and striking development opportunities: how to
efficiently turn massively large data into valuable information and meaningful knowl-
edge. Discrete mathematics produces a significant collection of powerful methods,
including mathematical tools for understanding and managing very high-dimensional
data, inference systems for drawing sound conclusions from large and noisy data sets,
and algorithms for scaling computations up to very large sizes. Discrete mathemat-
ics is the mathematical language of data science, and as such, its importance has
increased dramatically in recent decades.
Chapter 2
Set Theory
Example 2.1.1. The set of all first year students at Karatina University
2.2 Notations
Each of the objects in the set is called a member or an element of the set. The objects
themselves can be almost anything. Books, cities, numbers, animals, flowers, etc. El-
ements of a set are usually denoted by lower-case letters. While sets are denoted by
upper case letters of the English alphabet.
The symbol ∈ indicates the membership in a set.
The symbol ∈ is read “is a member of ” or “is an element of ”.
We write a ∈ A to denote that a is an element of the set A.
The notation a ∈
/ A denotes that a is not an element of the set A.
6
2.2 Notations 7
2. The Roster Method: In this method, one lists all the elements in the set between
a pair of braces.
Example 2.2.1. The set V of all vowels in the English alphabet can be written
as V = {a, e, i, o, u} .
Example 2.2.2. The set O of odd positive integers less than 10 can be expressed
by O = {1, 3, 5, 7, 9} .
Remark. In this method the order in which the elements are listed is immaterial,
and is used for small sets.e.g. O = {1, 3, 5, 7, 9} = {3, 5, 1, 9, 7}.
Repetition of objects is not allowed in a set also.
Sometimes the roster method is used to describe a set without listing all its mem-
bers. Some members of the set are listed, and then ellipses (...) are used when the
general pattern of the elements is obvious.
Example 2.2.3. The set of positive integers less than 100 can be denoted by
{1, 2, 3, ..., 99}.
3. Set Builder Notation: In this method,we characterize all those elements in the
set by stating the property or properties they must have to be members.
Example 2.2.4. The set O of all odd positive integers less than 10 can be written
as O = {x | x is an odd positive integer less than 10}
The vertical bar | is read as “such that”.. The colon : , can also be used instead.
Alternatively, let Z+ denote the set of positive integers, then we can write
O = {x ∈ Z+ | x is odd and x < 10} for the set O of all odd positive integers less
than 10
2.3 Some important sets used in Mathematics 8
We often use this type of notation to describe sets when it is impossible to list all
the elements of the set. For instance, the set Q+ of all positive rational numbers
can be written as:
+ p
Q = x ∈ R | x = , f or some positive integers p and q .
q
ii) Z = {..., −3. − 2, −1, 0, 1, 2, 3, ...}: the set of integers. An integer (from the Latin
integer meaning ”whole”) is a number that can be written without a fractional
component.They are the positive whole numbers, negative whole numbers and zero.
NB: Zero is neither positive nor negative, it is considered neutral.
v) R, the set of real numbers.The real numbers include all the rational numbers, and
all the irrational numbers.
Recall the notation for intervals of real numbers. When a and b are real numbers with
a < b, we write:
[a, b] = {x : a ≤ x ≤ b}, called a closed interval.
[a, b) = {x : a ≤ x < b}, called half-closed or half-open interval.
2.4 Subsets 9
2.4 Subsets
Definition 2.4.1. The set A is a subset of set B if and only if every element of A is
also an element of B.We use the notation A ⊆ B to indicate that A is a subset of the
set B. We also say that A is contained in B.
Example 2.4.4. N ⊆ Z ⊆ R ⊆ C
Definition 2.4.2. A set A is called proper subset of the set B if A is subset of B and B
is not a subset A i.e., A is said to be a proper subset of B if every element of A belongs
to the set B, but there is at least one element of B, which is not in A. If A is a proper
subset of B, then we denote it by A ⊂ B.
If A and B are sets such that every element of A is an element of B and every element
of B is an element of A, then A and B are equal (Identical) sets, denoted A = B.
2.5 Cardinality of a set 10
Definition 2.4.3. The set with no elements is called an empty set or null set denoted
by the symbol ∅ or {}.
Definition 2.5.1. The number of elements in a set is the cardinality of that set. The
cardinality of the set A is often notated as |A| or n(A).
Definition 2.5.2. Let A be a set. If there are exactly n distinct elements in A where n
is a non-negative integer, we say that A is a finite set and that n is the cardinality of
A.
Example 2.5.1. Let A be the set of odd positive integers less than 10. Then |A|= 5.
Example 2.5.2. Let S be the set of letters in the English alphabet. Then |S|= 26.
Example 2.5.3. Because the null set has no elements, it follows that |∅|= 0.
Example 2.5.5. List all the subsets of the set A = {1, 2, 3}.
Solution:
The subset of A containing no elements - ∅
The subset of A containing one element each - {1} , {2} , {3}
The subset of A containing two elements each -{1, 2} , {1, 3} , {2, 3}
The subset of A containing three elements - {1, 2, 3}
Therefore, all possible subsets of A are ∅,{1} , {2} , {3},{1, 2} , {1, 3} , {2, 3} ,{1, 2, 3}.
These are 8 = 23 in total.
The table below gives a summary on the list of all possible number of subsets for a
given finite set.
Exercise 1:
c) List all the subsets with two elements of the set {a, b, c, d, e}
2.6 Venn Diagrams 12
Definition 2.5.4. Given a set S, the power set of S is the set of all subsets of the set
S. The power set of S is denoted by P (S).
Exercise 2:
Remark. If a set has n elements, then its power set has 2n elements.
Definition 2.5.5. A Universal Set is the set of all elements under consideration, usually
denoted by U . All other sets are subsets of the universal set.
Example 2.6.1. Draw a Venn Diagram showing that set A Is a subset of set B.
2.7 Set Operations 13
A⊆B
Example 2.6.2. Draw a Venn diagram that represents V , the set of vowels in the
English alphabet.
e V o
U a u
Example 2.6.3. Draw a Venn diagram that represents the relationship between the
sets: U = {1, 2, 3, ..., 8}, A = {1, 4, 5, 7} and B = {2, 4, 6, 7}.
U
A B
1 4 2
5 7 6
3 8
Let A and B be sets. The union of the sets A and B, denoted by A ∪ B, is the set that
contains those elements that are either in A or in B, or in both.
2.7 Set Operations 14
In symbols we write: A ∪ B = {x : x ∈ A or x ∈ B}
Venn Diagram for the union of two sets:
A B
A ∪ B shaded
A B
A ∪ B ∪ C shaded
Example 2.7.1. Given U = {1, 2, 3, ..., 8}, A = {1, 4, 5, 7} and B = {2, 4, 6, 7} find
A ∪ B.
U
A B
1 4 2
5 7 6
3 8
A ∪ B = {1, 2, 4, 5, 6, 7}
General case:
n
S
If A1 , A2 , ..., An denote sets, then the union of these sets denoted by Ai is defined as
i=1
n
S
Ai = {x : x ∈ Ai for at least one set Ai } .
i=1
2.7 Set Operations 15
Let A and B be sets. The intersection of the sets A and B, denoted by A ∩ B, is the set
containing those elements in both A and B.
In symbols we write: A ∩ B = {x : x ∈ A and x ∈ B}
Venn Diagram for the intersection of two sets:
A B
A ∩ B shaded
A B
A ∩ B ∩ C shaded
Example 2.7.2. Given U = {1, 2, 3, ..., 8}, A = {1, 4, 5, 7} and B = {2, 4, 6, 7} find
A ∩ B.
U
A B
1 4 2
5 7 6
3 8
A ∩ B = {4, 7}
Definition 2.7.1. Two sets are called disjoint if their intersection is the empty set.
2.7 Set Operations 16
A B
1 3 2 4
5 7 6 8
Let A and B be sets. The difference of A and B, denoted by A − B, is the set containing
those elements that are in A but not in B. The difference of A and B is also called the
complement of B with respect to A.
A B
A \ B Shaded
A B
B \ A Shaded
2.7 Set Operations 17
Definition 2.7.2. Let U be the universal set. The complement of the set A, denoted
by Ā or Ac , is the complement of A with respect to U . Therefore, the complement of
the set A is U − A.
Ac
A 4 B Shaded
A B
Remark. A ⊕ B = A 4 B = (A ∪ B) − A ∩ B = (A − B) ∪ (B − A)
Example 2.7.4. Let the universal set be the set U = {a, b, c, d, e, f, g} and let A =
{a, c, e, g} and B = {d, e, f, g}. Find A ∪ B, A ∩ B, B − A , Ac and A 4 B.
Solution:
A ∪ B = {a, c, d, e, f, g}
A ∩ B = {e, g}
B − A = {d, f }
2.7 Set Operations 18
Ac = {b, d, f }
A 4 B = {a, c, d, f }
On a Venn diagram the information can be illustrated as below:
U
A B
a e d
c g f
Example 2.7.5. Consider three sets A, B, C. The following are the 8 = 23 fundamental
products of the sets:
P1 = A ∩ B ∩ C, P2 = A ∩ B ∩ C c , P3 = A ∩ B c ∩ C, P4 = A ∩ B c ∩ C c ,
P5 = Ac ∩ B ∩ C, P6 = Ac ∩ B ∩ C c , P7 = Ac ∩ B c ∩ C, P 8 = Ac ∩ B c ∩ C c
The eight products correspond precisely to the eight disjoint regions in the Venn diagram
of sets A, B, C as indicated by the labeling of the regions in the figure below:
2.7 Set Operations 19
A B
P4 P2 P6
P1
P3 P5
C P7 P8
Fundamental Products
The notation n(S) or |S| will denote the number of elements in a set S.
Cardinality of union of two sets: Suppose A and B are finite sets. Then
iii) A ∪ B and A ∩ B are finite and n(A ∪ B) = n(A) + n(B) − n(A ∩ B). This is called
the Inclusion–Exclusion Principle.
Cardinality of union of three sets: Suppose A, B and C are finite sets. Then
A ∪ B ∪ C is finite and
n(A ∪ B ∪ C) = n(A) + n(B) + n(C) − n(A ∩ B) − n(A ∩ C) − n(B ∩ C) + n(A ∩ B ∩ C).
Example 2.7.6. Suppose a list A contains the 30 students in a mathematics class, and
a list B contains the 35 students in an English class, and suppose there are 20 names
2.8 Set identities 20
10 20 15
An identity is an equation that is universally true for all elements in some set. For
example, the equation a + b = b + a is an identity for real numbers because it is true for
all real numbers a and b. The collection of set properties in the next theorem consists
entirely of set identities. That is, they are equations that are true for all sets in some
universal set.
1. Commutative laws
a) A ∪ B = B ∪ A
b) A ∩ B = B ∩ A
2. Associative laws
a) A ∪ (B ∪ C) = (A ∪ B) ∪ C
2.8 Set identities 21
b) A ∩ (B ∩ C) = (A ∩ B) ∩ C
3. Distributive laws
a) A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C)
b) A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)
4. Identity laws
a) A ∩ U = A
b) A ∪ ∅ = A
5. Complement laws
a) A ∪ Ac = U
b) A ∩ Ac = ∅
7. Idempotent laws :
a) A ∪ A = A
b) A ∩ A = A
a) A ∪ U = U
b) A ∩ ∅ = ∅
9. De Morgan’s laws
a) (A ∩ B)c = Ac ∪ B c
b) (A ∪ B)c = Ac ∩ B c
a) A ∪ (A ∩ B) = A
2.8 Set identities 22
b) A ∩ (A ∪ B) = A
a) U c = ∅
b) ∅c = U
i) X ⊆ Y
ii) Y ⊆ X
Example 2.8.3. Use set builder notation and logical equivalences to establish the De
Morgan law (A ∩ B)c = Ac ∪ B c
(A ∩ B)c = {x : x ∈
/ A ∩ B} by definition of complement
= {x : its false that (x ∈ A) or its false that (x ∈ B)} by logical equivalences of statemen
= {x : x ∈
/ A or x ∈
/ B} by definition of does not belong symbol
= {x : x ∈ Ac or x ∈ B c } by definition of complements
= {x : x ∈ Ac ∪ B c } by definition of union
Relations
3.1 Introduction
Relationships between elements of sets are represented using the structure called a rela-
tion, which is just a subset of the Cartesian product of the sets. Relations can be used
to solve problems such as determining which pairs of cities are linked by airline flights
in a network, finding a viable order for the different phases of a complicated project, or
producing a useful way to store information in computer databases.
Definition 3.2.1. An ordered pair of elements a and b, where a is designated as the first
element and b as the second element, is denoted by (a, b). In particular,(a, b) = (c, d) if
and only if a = c and b = d.
Definition 3.2.2. Consider two arbitrary sets A and B. The set of all ordered pairs
(a, b) where a ∈ A and b ∈ B is called the product, or Cartesian product, of A and B
usually denoted by A × B, which is read “A cross B.”
By Definition, we write, A × B = {(a, b) : a ∈ A and b ∈ B}
24