Discrete Maths 7 19
Discrete Maths 7 19
Discrete Maths 7 19
This chapter will be devoted to understanding set theory, relations, functions. We start with the basic
DR
set theory.
1.1 Sets
Mathematicians over the last two centuries have been used to the idea of considering a collection of
objects/numbers as a single entity. These entities are what are typically called sets. The technique of
using the concept of a set to answer questions is hardly new. It has been in use since ancient times.
However, the rigorous treatment of sets happened only in the 19-th century due to the German math-
ematician Georg Cantor. He was solely responsible in ensuring that sets had a home in mathematics.
Cantor developed the concept of the set during his study of the trigonometric series, which is now
known as the limit point or the derived set operator. He developed two types of transfinite numbers,
namely, transfinite ordinals and transfinite cardinals. His new and path-breaking ideas were not well
received by his contemporaries. Further, from his definition of a set, a number of contradictions and
paradoxes arose. One of the most famous paradoxes is the Russell’s Paradox, due to Bertrand Russell
in 1918. This paradox amongst others, opened the stage for the development of axiomatic set theory.
The interested reader may refer to Katz [8].
In this book, we will consider the intuitive or naive view point of sets. The notion of a set is taken
as a primitive and so we will not try to define it explicitly. We only give an informal description of
sets and then proceed to establish their properties.
A “well-defined collection” of distinct objects can be considered to be a set. Thus, the principal
property of a set is that of “membership” or “belonging”. Well-defined, in this context, would enable
us to determine whether a particular object is a member of a set or not.
7
8 CHAPTER 1. BASIC SET THEORY
Members of the collection comprising the set are also referred to as elements of the set. Elements
of a set can be just about anything from real physical objects to abstract mathematical objects. An
important feature of a set is that its elements are “distinct” or “uniquely identifiable.”
A set is typically expressed by curly braces, { } enclosing its elements. If A is a set and a is an
element of it, we write a ∈ A. The fact that a is not an element of A is written as a 6∈ A. For instance,
if A is the set {1, 4, 9, 2}, then 1 ∈ A, 4 ∈ A, 2 ∈ A and 9 ∈ A. But 7 6∈ A, π 6∈ A, the English word
‘four’ is not in A, etc.
Example 1.1.1. 1. Let X = {apple, tomato, orange}. Here, orange ∈ X, but potato 6∈ X.
2. X = {a1 , a2 , . . . , a10 }. Then, a100 6∈ X.
3. Observe that the sets {1, 2, 3}, {3, 1, 2} and {digits in the number 12321} are the same as the
order in which the elements appear doesn’t matter.
We now address the idea of distinctness of elements of a set, which comes with its own subtleties.
Example 1.1.2. 1. Consider the list of digits 1, 2, 1, 4, 2. Is it a set?
2. Let X = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}. Then X is the set of first 10 natural numbers. Or equivalently,
X is the set of integers between 0 and 11.
Definition 1.1.3. The set S that contains no element is called the empty set or the null set and
is denoted by { } or ∅. A set that has only one element is called a singleton set.
One has three main ways for specifying a set. They are:
T
1. Listing all its elements (list notation), e.g., X = {2, 4, 6, 8, 10}. Then X is the set of even integers
AF
Note that the above expressions are certain rules that help in defining the elements of the set
X. In general, one writes X = {x : p(x)} or X = {x | p(x)} to denote the set of all elements x
(variable) such that property p(x) holds. In the above, note that “colon” is sometimes replaced
by “|”.
3. Defining a set of rules which generate its members (recursive notation), e.g., let
In the recursive definition of a set, the first rule is the basis of recursion, the second rule gives
a method to generate new element(s) from the elements already determined and the third rule
binds or restricts the defined set to the elements generated by the first two rules. The third rule
should always be there. But, in practice it is left implicit. At this stage, one should make it
explicit.
We now mention some set operations that enable us in generating new sets from existing ones.
T
AF
We now state a few properties related to the union and intersection of sets.
(a) S ∪ (S ∩ T ) = S ∩ (S ∪ T ) = S.
(b) S ⊆ T if and only if S ∪ T = T .
DR
X \ Y = {{b, c}, {{b}, {c}}}, Y \ X = {a, c} and X∆Y = {a, c, {b, c}, {{b}, {c}}}.
1.3. RELATIONS 11
In naive set theory, all sets are essentially defined to be subsets of some reference set, referred to
as the universal set, and is denoted by U . We now define the complement of a set.
Definition 1.2.7. Let U be the universal set and X ⊆ U . Then, the complement of X, denoted by
X c , is defined by X c = {x ∈ U : x 6∈ X}.
(a) (S ∪ T )c = S c ∩ T c .
AF
(b) (S ∩ T )c = S c ∪ T c .
DR
The De-Morgan’s laws help us to convert arbitrary set expressions into those that involve only
complements and unions or only complements and intersections.
Definition 1.2.10. Let X be a set. Then, the set that contains all subsets of X is called the power
set of X and is denoted by P(X) or 2X .
3. Let X = {a, b, c}. Then P(X) = {∅, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}}.
4. Let X = {{b, c}, {{b}, {c}}}. Then P(X) = {∅, {{b, c}}, {{{b}, {c}}}, {{b, c}, {{b}, {c}}} }.
1.3 Relations
In this section, we introduce the set theoretic concepts of relations and functions. We will use these
concepts to relate different sets. This method also helps in constructing new sets from existing ones.
12 CHAPTER 1. BASIC SET THEORY
Definition 1.3.1. Let X and Y be two sets. Then their Cartesian product, denoted by X × Y , is
defined as X × Y = {(a, b) : a ∈ X, b ∈ Y }. The elements of X × Y are also called ordered pairs
with the elements of X as the first entry and elements of Y as the second entry. Thus,
X × X = {(a, a), (a, b), (a, c), (b, a), (b, b), (b, c), (c, a), (c, b), (c, c)}.
X ×Y = {(a, 1), (a, 2), (a, 3), (a, 4), (b, 1), (b, 2), (b, 3), (b, 4), (c, 1), (c, 2), (c, 3), (c, 4)}.
Remark 1.3.3. Let X and Y be two nonempty sets. Then, X × Y can also be defined as follows:
Let x ∈ X and y ∈ Y and think of (x, y) as the set {{x}, {x, y}}, i.e., we have a new set in which an
element (a set formed using the first element of the ordered pair) is a subset of the other element (a set
formed with both the elements of the ordered pair). Then, with the above understanding, the ordered
pair (y, x) will correspond to the set {{y}, {x, y}}. As the two sets {{x}, {x, y}} and {{y}, {x, y}} are
not the same, the ordered pair (x, y) 6= (y, x).
Exercise 1.3.4. Let X, Y, Z and W be nonempty sets. Then, prove the following statements:
1. The product construction can be used on sets several times, e.g.,
T
AF
X × Y × Z = {(x, y, z) : x ∈ X, y ∈ Y, z ∈ Z} = (X × Y ) × Z = X × (Y × Z).
DR
2. X × (Y ∪ Z) = (X × Y ) ∪ (X × Z).
3. X × (Y ∩ Z) = (X × Y ) ∩ (X × Z).
4. (X × Y ) ∩ (Z × W ) = (X ∩ Z) × (Y ∩ W ).
5. (X × Y ) ∪ (Z × W ) ⊆ (X ∪ Z) × (Y ∪ W ). Give an example to show that the converse need not
be true.
6. Is it possible to write the set T = {(x, x, y) : x, y ∈ N} as Cartesian product of 3 sets? What
about the the set T = {(x, x2 , y) : x, y ∈ N}?
A relation can be informally thought of as a property which either holds or does not hold between
two objects. For example, x is taller than y can be a relation. However, if x is taller than y, then y
cannot be taller than x.
Definition 1.3.5. Let X and Y be two nonempty sets. A relation R from X to Y is a subset of
X × Y , i.e., it is a collection of certain ordered pairs. We write xRy to mean (x, y) ∈ R ⊆ X × Y .
Thus, for any two sets X and Y , the sets ∅ and X × Y are always relations from X to Y . A relation
from X to X is called a relation on X.
Example 1.3.6. 1. Let X be any nonempty set and consider the set P(X). Define a relation R
on P(X) by R = {(S, T ) ∈ P(X) × P(X) : S ⊆ T }.
(a) R = A × A.
1.3. RELATIONS 13
(b) R = {(a, a), (b, b), (c, c), (d, d), (a, b), (a, c), (b, c)}.
(c) R = {(a, a), (b, b), (c, c)}.
(d) R = {(a, a), (a, b), (b, a), (b, b), (c, d)}.
(e) R = {(a, a), (a, b), (b, a), (a, c), (c, a), (c, c), (b, b)}.
(f) R = {(a, b), (b, c), (a, c), (d, d)}.
(g) R = {(a, a), (b, b), (c, c), (d, d), (a, b), (b, c)}.
(h) R = {(a, a), (b, b), (c, c), (d, d), (a, b), (b, a), (b, c), (c, b)}.
(i) R = {(a, a), (b, b), (c, c), (a, b), (b, c)}.
Sometimes, we draw pictures to have a better understanding of different relations. For example,
to draw pictures for relations on a set X, we first put a node for each element x ∈ X and label
it x. Then, for each (x, y) ∈ R, we draw a directed line from x to y. If (x, x) ∈ R then a loop is
drawn at x. The pictures for some of the relations is given in Figure 1.1.
c d c d c d
a b a b a b
T
AF
3. Let A = {1, 2, 3}, B = {a, b, c} and let R = {(1, a), (1, b), (2, c)}. Figure 1.2 represents the
relation R. 1
1 a
2 b
3 c
Definition 1.3.7. Let X and Y be two nonempty sets and let R be a relation from X to Y . Then,
the inverse relation, denoted by R−1 , is a relation from Y to X, defined by R−1 = {(y, x) ∈ Y × X :
(x, y) ∈ R}. So, for all x ∈ X and y ∈ Y
One can ask similar questions for an element y ∈ Y . To accommodate all these, we introduce a
notation in the following definition.
1. for any set Z, one writes R(Z) := {y : (z, y) ∈ R for some z ∈ Z}.
AF
Example 1.3.11. Let a, b, c, and d be distinct symbols and let R = {1, a), (1, b), (2, c)}. Then,
1. dom R = {1, 2}, rng R = {a, b, c},
2. R({1}) = {a, b}, R({2}) = {c}, R({1, 2}) = {a, b, c}, R({1, 2, 3}) = {a, b, c}, R({4}) = ∅.
3. dom R−1 = {a, b, c}, rng R−1 = {1, 2},
4. R−1 ({a}) = {1}, R−1 ({a, b}) = {1}, R−1 ({b, c}) = {1, 2}, R−1 ({a, d}) = {1}, R−1 ({d}) = ∅.
The following is an immediate consequence of the definition, but we give the proof of a few parts
for the sake of better understanding.
Proposition 1.3.12. Let R be a nonempty relation from X to Y , and let Z be any set.
1. R(Z) = R(X ∩ Z) ⊆ Y, R−1 (Z) = R−1 (Z ∩ Y ) ⊆ X.
2. dom R = R−1 (Y ) = rng R−1 ⊆ X, rng R = R(X) = dom R−1 ⊆ Y.
3. R(Z) 6= ∅ if and only if dom R ∩ Z 6= ∅.
4. R−1 (Z) 6= ∅ if and only if rng R ∩ Z 6= ∅.
Proof. We prove the last two parts. The proof of the first two parts is left as an exercise.
3. Let f (S) 6= ∅. There exist a ∈ S ∩ A and b ∈ B such that (a, b) ∈ f . It implies that a ∈ dom f ∩ S
(a ∈ S). Converse is proved in a similar way.
4. Let rng f ∩ S 6= ∅. There exist b ∈ rng f ∩ S and a ∈ A such that (a, b) ∈ f . Then a ∈ f −1 (b) ⊆
f −1 (S). Similarly, the converse follows.
1
In some texts, the set X is referred to as the domain set of R and it should not be confused with dom R.
1.4. FUNCTIONS 15
1.4 Functions
Definition 1.4.1. Let X and Y be nonempty sets and let f be a relation from X to Y .
1. f is called a partial function from X to Y , denoted by f : X * Y , if for each x ∈ X, f ({x})
is either a singleton or ∅.
2. For an element x ∈ X, if f ({x}) = {y}, a singleton, we write f (x) = y. Hence, y is referred to
as the image of x under f ; and x is referred to as the pre-image of y under f .
f (x) is said to be undefined at x ∈ X if f ({x}) = ∅.
3. If f is a partial function from X to Y such that for each x ∈ X, f ({x}) is a singleton then f is
called a function and is denoted by f : X → Y .
Observe that for any partial function f : X * Y , the condition (a, b), (a, b0 ) ∈ f implies b = b0 .
Thus, if f : X * Y , then for each x ∈ X, either f (x) is undefined, or there exists a unique y ∈ Y
such that f (x) = y. Moreover, if f : X → Y is a function, then f (x) exists for each x ∈ X, i.e., there
exists a unique y ∈ Y such that f (x) = y.
It thus follows that a partial function f : X * Y is a function if and only if dom f = X, i.e.,
domain set of f is X.
2. R2 = {(a, 1), (b, 4), (c, 2), (d, 3)} is a relation from A to B. The following are true.
(a) R2 is a partial function.
(b) R2 (a) = 1, R2 (b) = 4, R2 (c) = 2 and R2 (d) = 3.
(c) R2 (X) = {2, 4}.
(d) R2−1 (1) = a, R2−1 (2) = c, R2−1 (3) = d and R2−1 (4) = b. Also, R2−1 (X) = {b, d}.
Convention:
Let p(x) be a polynomial in the variable x with integer coefficients. Then, by writing ‘f : Z → Z
is a function defined by f (x) = p(x)’, we mean the function f = {(a, p(a)) : a ∈ Z}. For example,
the function f : Z → Z given by f (x) = x2 corresponds to the set {(a, a2 ) : a ∈ Z}.
Example 1.4.3. 1. For A = {a, b, c, d} and B = {1, 3, 5}, let f = {(a, 5), (b, 1), (d, 5)} be a relation
in A × B. Then, f is a partial function with dom f = {a, b, d} and rng f = {1, 5}. Further, we
can define a function g : {a, b, d} → {1, 5} by g(a) = 5, g(b) = 1 and g(d) = 5. Also, using g, one
obtains the relation g −1 = {(1, b), (5, a), (5, d)}.
2. The following relations f : Z → Z are indeed functions.
(a) f = {(x, 1) : x is even} ∪ {(x, 5) : x is odd}.
(b) f = {(x, −1) : x ∈ Z}.
(c) f = {(x, 1) : x < 0} ∪ {(0, 0)} ∪ {(x, −1) : x > 0}.
16 CHAPTER 1. BASIC SET THEORY
by 0.
AF
(a) f : Z → Z defined by
i. f = {(x, 1) : 2 divides x} ∪ {(x, 5) : 3 divides x}.
ii. f = {(x, 1) : x ∈ S} ∪ {(x, −1) : x ∈ S c }, where S = {n2 : n ∈ Z} and S c = Z \ S.
iii. f = {(x, x3 ) : x ∈ Z}.
√
(b) f : R+ → R defined by f = {(x, ± x) : x ∈ R+ }, where R+ is the set of all positive real
numbers.
√
(c) f : R → R defined by f = {(x, x) : x ∈ R}.
√
(d) f : R → C defined by f = {(x, x) : x ∈ R}.
(e) f : R− → R defined by f = {(x, loge |x|) : x ∈ R− }, where R− is the set of all negative real
numbers.
(f ) f : R → R defined by f = {(x, tan x) : x ∈ R}.
Proof. Suppose fZ (x) = fZ (y) for some x, y ∈ Z. Then f (x) = f (y). As f is one-one, x = y. Thus,
T
fZ is one-one.
AF
DR
Definition 1.4.14. Let X and Y be sets. A function f : X → Y is said to be bijective (also call a
bijection) if f is both one-one and onto. The set X is said to be equinumerous1 with the set Y if
there exists a bijection f : X → Y .
1
If X is equinumerous with Y then X is also said to be equivalent to Y .
18 CHAPTER 1. BASIC SET THEORY
Clearly, if a set X is equinumerous with a set Y then Y is also equinumerous with X. Hence, X
and Y are said to be equinumerous sets.
Example 1.4.15. 1. The function f : {1, 2, 3} → {a, b, c} defined by f (1) = c, f (2) = b and
f (3) = a, is a bijection. Thus, f −1 : {a, b, c} → {1, 2, 3} is a bijection; and the set {a, b, c} is
equinumerous with {1, 2, 3}.
2. Let X be a nonempty set. Then the identity map on X is a bijection. Thus, the set X is
equinumerous with itself.
3. The set N is equinumerous with {2, 3, . . .}. Indeed the function f : N → {2, 3, . . .} defined by
f (1) = 3, f (2) = 2 and f (n) = n + 1, for all n ≥ 3 is a bijection.
Exercise 1.4.16. 1. Let f : X → Y be a bijection. Then, for every choice of pairs x, y with x ∈ X
and y ∈ Y there exists a bijection, say h : X → Y , such that h(x) = y.
2. Define f : W → Z by f = { x, −x : x is even} ∪ { x, x+1
2 2 : x is odd}. Is f one-one? Is it onto?
3. Define f : N → Z by f = {(x, 2x) : x ∈ N}, and g : Z → Z by g = { x, x2 : x is even} ∪ {(x, 0) :
Notice that the composition of two relations in the above definition is a relation. In case, both f
and g are functions, g ◦ f is also a function, and (g ◦ f )(x) = g (f (x)) as (x, z) ∈ g ◦ f implies that
there exists y such that y = f (x) and z = g(y). Similarly, one defines f ◦ g if rng g ⊆ dom f .
Example 1.5.2. Let f = {(β, a), (3, b), (3, c)} and g = {(a, 3), (b, β), (c, β)}. Then, g◦f = {(3, β), (β, 3)}
and f ◦ g = {(a, b), (a, c), (b, a), (c, a)}.
The proof of the next result is omitted as it directly follows from definition.
5. [Extension] If dom f ∩ dom h = ∅ and rng f ∩ rng h = ∅ then the function f ∪ h from X ∪ Z to
Y ∪ W defined by f ∪ h = {(a, f (a)) : a ∈ X} ∪ {(c, h(c)) : c ∈ Z} is a bijection.
6. Let X and Y be sets with at least two elements each and let f : X → Y be a bijection. Then the
number of bijections from X to Y is at least 2.
Theorem 1.5.4. [Properties of the identity function] Let X and Y be two nonempty sets and Id
be the identity function on X. Then, for any two functions f : X → Y and g : Y → X,
f ◦ Id = f and Id ◦ g = g.
Proof. By definition, (f ◦ Id)(x) = f (Id(x)) = f (x), for all x ∈ X. Hence, f ◦ Id = f . Similarly, the
other equality follows.
Proof. To show that f is one-one, suppose f (a) = f (b) for some a, b ∈ X. Then
Thus, f is one-one.
To show that g is onto, let a ∈ X. Write b = f (a). Now, a = (g ◦ f )(a) = g(f (a)) = g(b). That is,
we have found b ∈ Y such that g(b) = a. Hence, g is onto.
T
AF
Show that f is a bijection and g = f −1 . Can we conclude the same without assuming the second
condition?