Chapter 2
Chapter 2
Chapter 2
Fall, 2013/2014
1 Sets
2 Set Operations
3 Functions
5 Matrices
Set
is an unordered collection of objects, called elements or members of the
set. A set is said to contain its elements. We write a ∈ A to denote that
a is an element of the set A. The notation a 6∈ A denotes that a is not an
element of the set A.
Equal sets
Two sets are equal if and only if they have the same elements. Therefore,
if A and B are sets, then A and B are equal if and only if
∀x(x ∈ A ↔ x ∈ B). We write A = B if A and B are equal sets.
The sets {1, 3, 5} and {3, 5, 1} are equal, because they have the
same elements.
The order in which the elements of a set are listed does not matter.
{1, 3, 3, 3, 5, 5, 5, 5} is the same as the set {1, 3, 5} because they
have the same elements.
It does not matter if an element of a set is listed more than once.
Empty set or null set: the set that has no elements and is denoted
by ∅ or by {} [but not {∅}].
By using the set builder, the set can be described by stating the
property they must have to be members.
The set of all odd positive integers can be written as
O = {x|x is an odd positive integer less than 10} or
O = {x ∈ Z + |x is odd and x < 10}.
Famous sets: N: natural numbers, Z: integers, Z+ : positive
integers, Q: rational numbers, R: real numbers, R+ : positive real
numbers and C: complex numbers.
Subset
The set A is a subset of B if and only if every element of A is also an
element of B, i.e ∀x(x ∈ A → x ∈ B). We use the notation A ⊆ B to
indicate that A is a subset of the set B.
Proper subset
written as A ⊂ B and it read as ”A is a proper subset of B”. It used to
emphasize that a set A is a subset of the set B but that A 6= B, i.e.
∀x(x ∈ A → x ∈ B) ∧ ∃x(x ∈ B ∧ x 6∈ A)
A = B → (A ⊆ B) ∧ (B ⊆ A)
(A ⊆ B) ∧ (B ⊆ C ) → A ⊆ C [SEE VENN DIAGRAM]
The power set of S is the set of all subsets of the set S and is denoted by
P(S) or 2S , i.e. P(S) = {B|B ⊆ S}
P({0, 1, 2}) = {∅, {0}, {1}, {2}, {0, 1}, {0, 2}, {1, 2}, {0, 1, 2}} .
P(∅) = {∅}
P({∅}) = {∅, {∅}}
ECOM 2311- Discrete Mathematics - Ch.2 Dr. Musbah Shaat 7 / 45
Sets
Cartesian Products
Two sets are called disjoint if their intersection is the empty set.
Let U be the universal set. The complement of the set A, denoted by Ā,
is the complement of A with respect to U. Therefore, the complement of
the set A is U − A, i.e. Ā = {x ∈ U|x 6∈ A}.
Function Definition
Let A and B be nonempty sets. A function f from A to B is an
assignment of exactly one element of B to each element of A. We write
f (a) = b if b is the unique element of B assigned by the function f to the
element a of A. If f is a function from A to B, we write f : A → B.
Functions are sometimes also called mappings or transformations.
If f is a function from A to B, we say that A is the domain of f and B is
the codomain of f. If f (a) = b, we say that b is the image of a and a is a
preimage of b. The range, or image, of f is the set of all images of
elements of A. Also, if f is a function from A to B, we say that f maps A
to B.
Check if the following relations of the sets A = {a, b, c},
B = {1, 2, 3} are functions or not :
√
f = {(a, 1), (b, 2), (c, 1)} g = {(a, 1), (b, 2)} ×
h = {(a, 1), (b, 2), (c, 1), (a, 2)} ×
ECOM 2311- Discrete Mathematics - Ch.2 Dr. Musbah Shaat 16 / 45
Functions
Introduction
EX. What are the domain, codomain, and range of the function that
maps the set A = {a, b, c} to the set B = {1, 2, 3} according to the
relation f = {(a, 1), (b, 2), (c, 1)}.
Domain: {a, b, c}.
Codomain: {1, 2, 3}.
Range: {1, 2}
EX. What are the domain, codomain and range of f : Z → Z which
assign the square of an integer to this integer. i.e. f (x) = x 2
Domain: Z (all integers)
Codomain: Z (all integers)
Range: the set of all integers that are perfect squares, namely,
{0, 1, 4, 9, · · · }.
EX. Express the range of the function that maps the set A to B using
the set builder notation.
range of f ={b ∈ B|f (a) = b for some a ∈ A}
ECOM 2311- Discrete Mathematics - Ch.2 Dr. Musbah Shaat 17 / 45
Functions
Introduction
Let g be a function from the set A to the set B and let f be a function
from the set B to the set C. The composition of the functions f and g,
denoted for all a ∈ A by f ◦ g , is defined by (f ◦ g )(a) = f (g (a)).
To find (f ◦ g )(a) we first apply the function g to a to obtain g(a)
and then we apply the function f to the result g(a) to obtain
(f ◦ g )(a) = f (g (a)).
The composition f ◦ g cannot be defined unless the range of g is a
subset of the domain of f.
EX. Let g be the function from the set {a, b, c} to itself such that g(a)
= b, g(b) = c, and g(c) = a. Let f be the function from the set a, b, c
to the set 1, 2, 3 such that f (a) = 3, f (b) = 2, and f (c) = 1. What is
the composition of f and g, and what is the composition of g and f ?
The composition f ◦ g is defined by
(f ◦ g )(a) = f (g (a)) = f (b) = 2, (f ◦ g )(b) = f (g (b)) = f (c) = 1, and
(f ◦ g )(c) = f (g (c)) = f (a) = 3.
g ◦ f is not defined, because the range of f is not a subset of the domain
of g.
EX. Let f and g be the functions from the set of integers to the set of
integers defined by f (x) = 2x + 3 and g(x) = 3x + 2. What is the
composition of f and g? What is the composition of g and f ?
(f ◦ g )(x) = f (g (x)) = f (3x + 2) = 2(3x + 2) + 3 = 6x + 7.
(g ◦ f )(x) = g (f (x)) = g (2x + 3) = 3(2x + 3) + 2 = 6x + 11.
Note that f ◦ g 6= g ◦ f
The floor function assigns to the real number x the largest integer that
is less than or equal to x. The value of the floor function at x is denoted
by bxc. The ceiling function assigns to the real number x the smallest
integer that is greater than or equal to x. The value of the ceiling
function at x is denoted by dxe.
b 12 c = 0, d 12 e = 1, b −1 −1
2 c = −1, d 2 e = 0
Note that dx + y e =
6 dxe + dy e
The sets A and B have the same cardinality if and only if there is a
one-to-one correspondence from A to B. When A and B have the same
cardinality, we write |A| = |B|.
SCHRÖDER-BERNSTEIN THEOREM
if there are one-to-one functions f from A to B and g from B to A, then
there is a one-to-one correspondence between A and B.
Sequence
A sequence is a function from a subset of the set of integers (usually
either the set {0, 1, 2, . . .} or the set {1, 2, 3, . . .}) to a set S. We
use the notation an to denote the image of the integer n. We call an a
term of the sequence.
Geometric progression
A geometric progression is a sequence of the form
a, ar , ar 2 , · · · , ar n , · · ·
where the initial term a and the common ratio r are real numbers.
Arithmetic progression
An arithmetic progression is a sequence of the form
a, a + d, a + 2d, · · · , a + nd, · · ·
where the initial term a and the common difference d are real numbers.
List the first five terms of the sequences
{bn } with bn = (−1)n ⇒ the terms are: 1, −1, 1, −1, · · · . Its a
geometric progression with initial term 1 and common ratio -1.
{sn } with sn = −1 + 4n ⇒ the terms are: −1, 3, 7, 11, · · · . Its an
arithmetic progression with initial term -1 and common difference 4.
Recurrence Relation
A recurrence relation for the sequence {an } is an equation that expresses
an in terms of one or more of the previous terms of the sequence,
namely, a0 , a1 , ..., an−1 , for all integers n with n ≥ n0 , where n0 is a
nonnegative integer. A sequence is called a solution of a recurrence
relation if its terms satisfy the recurrence relation.
ECOM 2311- Discrete Mathematics - Ch.2 Dr. Musbah Shaat 32 / 45
Sequences and Summations
Recurrence Relations
Fibonacci sequence
The Fibonacci sequence, f0 , f1 , f2 , · · · is defined by the initial conditions
f0 = 0, f1 = 1, and the recurrence relation
fn = fn−1 + fn−2 for n = 2, 3, 4, · · ·
Find formulae for the sequences with the following first five terms: (a) 1,
1/2, 1/4, 1/8, 1/16 (b) 1, 3, 5, 7, 9
(a) an = 1/2n is a possible match (b) an = 2n + 1 is a possible match.
How can we produce the terms of a sequence if the first 10 terms are 1,
2, 2, 3, 3, 3, 4, 4, 4, 4?
The integer 1 appears once, the integer 2 appears twice, the integer
3 appears three times, and the integer 4 appears four times. A
reasonable rule for generating this sequence is that the integer n
appears exactly n times.
How can we produce the terms of a sequence if the first 10 terms are 1,
3, 4, 7, 11, 18, 29, 47, 76, 123?
Starting with the third term, each term is the sum of the two
previous terms. That is, 4 = 3 + 1, 7 = 4 + 3, 11 = 7 + 4, and so on.
We can guess that the sequence is determined by the recurrence
relation Ln = Ln−1 + Ln−2 with initial conditions L1 = 1 and L2 = 3.
ECOM 2311- Discrete Mathematics - Ch.2 Dr. Musbah Shaat 34 / 45
Sequences and Summations
Summations
Pn
The summation notation i=m ai used to refer to the sum of
am + am+1 + · · · + an .
Matrix
A matrix is a rectangular array of numbers. A matrix with m rows and n
columns is called an m × n matrix. A matrix with the same number of
rows as columns is called square. Two matrices are equal if they have the
same number of rows and the same number of columns and the
corresponding entries in every position are equal.
Zero-one matrices
It is a matrix with entries that are 0 or 1. They represent discrete
structures using Boolean arithmetic.
The Boolean arithmetic is based on the Boolean operations ∧ and ∨,
which operate on pairs of bits, defined by
Boolean product
Let A = [aij ] be an m×k zero-one matrix and B = [bij ] be a k×n
zero-one matrix. Then the Boolean product of A and B, denoted by
A B, is the m×n matrix with (i, j)th entry cij where
cij = (ai1 ∧ b1j ) ∨ (ai2 ∧ b2j ) ∨ · · · ∨ (aik ∧ bkj ).