0% found this document useful (0 votes)
133 views70 pages

Discrete Mathematics: R. Johnsonbaugh

The empty set c = has no elements. Also called null set or void set. A set is a collection of distinct unordered objects Members of a set are called elements.

Uploaded by

Rusdy Saja
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
133 views70 pages

Discrete Mathematics: R. Johnsonbaugh

The empty set c = has no elements. Also called null set or void set. A set is a collection of distinct unordered objects Members of a set are called elements.

Uploaded by

Rusdy Saja
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 70

R.

Johnsonbaugh,
Discrete Mathematics
5
th
edition, 2001
Chapter 2
The Language of Mathematics
2.1 Sets
Set = a collection of distinct unordered
objects
Members of a set are called elements
How to determine a set
Listing:
Example: A = {1,3,5,7} = {7, 5, 3, 1, 3}
Description
Example: B = {x | x = 2k + 1, 0 < k < 30}
Finite and infinite sets
Finite sets
Examples:
A = {1, 2, 3, 4}
B = {x | x is an integer, 1 < x < 4}

Infinite sets
Examples:
Z = {integers} = {, -3, -2, -1, 0, 1, 2, 3,}
S={x| x is a real number and 1 < x < 4} = [0, 4]

Some important sets

The empty set C = { } has no elements.
Also called null set or void set.
Universal set: the set of all elements about
which we make assertions.
Examples:
U = {all natural numbers}
U = {all real numbers}
U = {x| x is a natural number and 1< x<10}


Cardinality
Cardinality of a set A (in symbols |A|) is the
number of elements in A
Examples:
If A = {1, 2, 3} then |A| = 3
If B = {x | x is a natural number and 1< x< 9}
then |B| = 9
Infinite cardinality
Countable (e.g., natural numbers, integers)
Uncountable (e.g., real numbers)
Subsets
X is a subset of Y if every element of X is
also contained in Y (in symbols X _ Y)

Equality: X = Y if X _ Y and Y _ X, i.e., X =
Y whenever x e X, then x e Y, and
whenever x e X, then x e X

X is a proper subset of Y if X _ Y but Y . X
Observation: C is a subset of every set
Power set
The power set of X is the set of all subsets of X,
in symbols P(X),
i.e. P(X)= {A | A _ X}
Example: if X = {1, 2, 3},
then P(X) = {C, {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3}}

Theorem 2.1.4: If |X| = n, then |P(X)| = 2
n
.

See proof by induction in textbook

Set operations:
Union and Intersection
Given two sets X and Y
The union of X and Y is defined as the set
X Y = { x | x e X or x e Y}

The intersection of X and Y is defined as the set
X Y = { x | x e X and x e Y}
Two sets X and Y are disjoint if X Y = C
Complement and Difference
The difference of two sets
X Y = { x | x e X and x e Y}
The difference is also called the relative complement
of Y in X
Symmetric difference
X Y = (X Y) (Y X)
The complement of a set A contained in a
universal set U is the set A
c
= U A
In symbols A
c
= U - A

Example
If X={1, 4, 7, 10}, Y={1, 2, 3, 4, 5}

X Y =
X Y =
X Y =
Y X =
X Y = (how else can you write this?)
Example
If X={1, 4, 7, 10}, Y={1, 2, 3, 4, 5}

X Y = {1, 2, 3, 4, 5, 7, 10}
X Y = {1, 4}
X Y = {7, 10}
Y X = {2, 3, 5}
X Y = (X Y) (X Y) = {2, 3, 5, 7, 10}
Venn diagrams
A Venn diagram provides a graphic view of
sets
Set union, intersection, difference,
symmetric difference and complements can
be easily and visually identified


Properties of set operations (1)
Theorem 2.1.10: Let U be a universal set, and
A, B and C subsets of U. The following
properties hold:
a) Associativity: (A B) C = A (B C)
(A B) C = A (B C)
b) Commutativity: A B = B A
A B = B A

Properties of set operations (2)
c) Distributive laws:
A(BC) = (AB)(AC)
A(BC) = (AB)(AC)
d) Identity laws:
AU=A AC = A
e) Complement laws:
AA
c
= U AA
c
= C


Properties of set operations (3)
f) Idempotent laws:
AA = A AA = A
g) Bound laws:
AU = U AC = C
h) Absorption laws:
A(AB) = A A(AB) = A
Properties of set operations (4)
i) Involution law: (A
c
)
c
= A

j) 0/1 laws: C
c
= U U
c
= C
k) De Morgans laws for sets:
(AB)
c
= A
c
B
c

(AB)
c
= A
c
B
c

2.2 Sequences and strings
A sequence is an ordered list of numbers,
usually defined according to a formula function,
s
n
, n = 1, 2, 3,... is the index of the sequence
If s is a sequence {s
n
| n = 1, 2, 3,},
s
1
denotes the first element,
s
2
the second element,
s
n
the nth element
{n} is called the indexing set of the sequence.
Usually the indexing set is N (natural numbers)
or an infinite subset of N.
Examples of sequences
Examples:
1. Let s = {s
n
} be the sequence defined by
s
n
= 1/n , for n = 1, 2, 3,
The first few elements of the sequence are: 1, , 1/3, ,
1/5,1/6,
2. Let s = {s
n
} be the sequence defined by
s
n
= n
2
+ 1, for n = 1, 2, 3,
The first few elements of s are: 2, 5, 10, 17, 26, 37, 50,

Increasing and decreasing
A sequence s = {s
n
} is said to be
increasing if s
n
< s
n+1

decreasing if s
n
> s
n+1
,
for every n = 1, 2, 3,
Examples:
S
n
= 4 2n, n = 1, 2, 3, is decreasing:
2, 0, -2, -4, -6,

S
n
= 2n -1, n = 1, 2, 3, is increasing:
1, 3, 5, 7, 9,
Subsequences
A subsequence of a sequence s = {s
n
} is a
sequence t = {t
n
} that consists of certain
elements of s retained in the original order
they had in s
Example: let s = {s
n
= n | n = 1, 2, 3,}
1, 2, 3, 4, 5, 6, 7, 8,
Let t = {t
n
= 2n | n = 1, 2, 3,}
2, 4, 6, 8, 10, 12, 14, 16,
t is a subsequence of s


Sigma notation

If {a
n
} is a sequence, then the sum

m
E a
k
= a
1
+ a
2
+ + a
m
k

= 1
This is called the sigma notation, where the
Greek letter E indicates a sum of terms
from the sequence


Pi notation

If {a
n
} is a sequence, then the product

m
H a
k
= a
1
a
2
a
m
k=1

This is called the pi notation, where the
Greek letter H indicates a product of terms
of the sequence
Strings

Let X be a nonempty set. A string over X is a
finite sequence of elements from X.
Example: if X = {a, b, c}
Then o = bbaccc is a string over X
Notation: bbaccc = b
2
ac
3
The length of a string o is the number of elements of
o and is denoted by |o|. If o = b
2
ac
3
then |o| = 6.
The null string is the string with no elements and
is denoted by the Greek letter (lambda). It has
length zero.
More on strings
Let X* = {all strings over X including }
Let X
+
= X* - {}, the set of all non-null strings
Concatenation of two strings o and | is the
operation on strings consisting of writing o
followed by | to produce a new string o|
Example: o = bbaccc and | = caaba,
then o| = bbaccccaaba = b
2
ac
4
a
2
ba
Clearly, |o|| = | o| + |||
2.3 Number systems
Binary digits: 0 and 1, called bits.
In this section we study: binary, hexadecimal
and octal number systems.
Review of decimal system:
Example: 45,238 is equal to
8 ones 8 x 1 = 8
3 tens 3 x 10 = 30
2 hundreds 2 x 100 = 200
5 thousands 5 x 1000 = 5000
4 ten thousands 4 x 10000 = 40000
Binary number system
From binary to decimal:
The number 1101011 is equivalent to
1 one 1 x2
0
= 1
1 two 1x2
1
= 2
0 four 0x2
2
= 0
1 eight 1x2
3
= 8
0 sixteen 0x2
4
= 0
1 thirty-two 1x2
5
= 32
1 sixty-four 1x2
6
= 64
107 in decimal base
From decimal to binary
The number 73
10
is equivalent to
73 = 2 x 36 + remainder 1
36 = 2 x 18 + remainder 0
18 = 2 x 9 + remainder 0
9 = 2 x 4 + remainder 1
4 = 2 x 2 + remainder 0
2 = 2 x 1 + remainder 0
73
10
= 1001001
2
(write the remainders in reverse order preceded by
the quotient)
Binary addition table
0 1
0 0 1
1 1 10
Adding binary numbers
Example: add 100101
2
+ 110011
2

1 1 1
carry ones
100101
2
110011
2
1011000
2
Hexadecimal number system





Decimal system
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 1 2 3 4 5 6 7 8 9 A B C D E F
Hexadecimal system
Hexadecimal to decimal

The hexadecimal number 3A0B
16
is
11 x 16
0
= 11
0 x 16
1
= 0
10 x 16
2
= 2560
3 x 16
3
= 12288
14859
10
Decimal to hexadecimal
Given the number 2345
10


16 )2345 remainder = 9 (least significant digit)
16 )146 remainder = 2
16 )9 remainder = 9 (most significant)

2345
10
is equivalent to the hexadecimal number 929
16
Hexadecimal addition

Add 23A
16
+ 8F
16

Lets color-code Hex and Decimal as seen
Since A = 10 and F = 15 Add, then A+F = 25 = 19


23A
16


+ 8F
16
2C9
16
2.4 Relations
Given two sets X and B, its Cartesian product
XxY is the set of all ordered pairs (x,y) where
xeX and yeY
In symbols XxY = {(x, y) | xeX and yeY}

A binary relation R from a set X to a set Y is a
subset of the Cartesian product XxY
Example: X = {1, 2, 3} and Y = {a, b}
R = {(1,a), (1,b), (2,b), (3,a)} is a relation between X
and Y
Domain and range
Given a relation R from X to Y,
The domain of R is the set
Dom(R) = { xeX | (x, y) eR for some yeY}
The range of R is the set
Rng(R) = { yeY | (x, y) eR for some x eX}
Example:
if X = {1, 2, 3} and Y = {a, b}
R = {(1,a), (1,b), (2,b)}
Then: Dom(R)= {1, 2}, Rng(R) = (a, b}
Also, since (1,b) e R, we may write 1 R b
Example-1
Let X = {1, 2, 3} and Y = {a, b, c, d}.
Define R = {(1,a), (1,d), (2,a), (2,b), (2,c)}
The relation can be pictured by a graph:
Example-2
Let X = {1, 3, 4, 7, 9, 12, 16} and
Y = {1, 2, 4, 8, 9}

Define R
1
= {(x, y) | x e X, y e Y, and x = y
2
}
Then R
1
= {(?, ?), }

Define R
2
= {(x, y) | x e X, y e Y, and x
2
= y}
Then R
2
= ?

Example-2
Let X = {1, 3, 4, 7, 9, 12, 16} and
Y = {1, 2, 4, 8, 9}

Define R
1
= {(x, y) | x e X, y e Y, and x = y
2
}
Then R
1
= {(1, 1), (4, 2), (16, 4)}

Define R
2
= {(x, y) | x e X, y e Y, and x
2
= y}
Then R
2
= {(1, 1), (3, 9)}

Properties of relations
Let R be a relation on a set X
i.e. R is a subset of the Cartesian product XxX
R is reflexive if (x,x) eR for every xeX
R is symmetric if for all x, y e X such that (x,y)
eR then (y,x) eR
R is transitive if (x,y) eR and (y,z)eR imply
(x,z)eR
R is antisymmetric if for all x,yeX such that
x=y, if (x,y) eR then (y,x) eR

Order relations
Let X be a set and R a relation on X
R is a partial order on X if R is reflexive,
antisymmetric and transitive.

Is (x, y) eR in partial order if x >= y?

Relation R on set {1, 2, 3, 4, 5} is defined
by (x, y)eR where x + y <= 6. Is R
reflexive, symmetric, anti-symmetric,
transitive, and/or a partial order?


Order relations
Is (x, y) eR in partial order if x >= y?


Yes, since:

Reflexive: (x, x) e R
Anti-symmetric: If (x, y) e R and x = y, then
(y, x) eR
Transitive: If (x, y) e R and (y, z) e R, then
(x, z) e R


Order relations
Relation R on set {1, 2, 3, 4, 5} is defined by (x, y)eR
where x + y <= 6. Is R reflexive, symmetric, anti-
symmetric, transitive, and/or a partial order?

Well, lets write the relations numerically and see what we
get:

(1, 1), (1, 2), (1, 3), (1, 4), (1, 5)
(2, 1), (2, 2), (2, 3), (2, 4)
(3, 1), (3, 2), (3, 3)
(4, 1), (4, 2)
(5, 1)

reflexive, symmetric, anti-symmetric, transitive, PO

Order relations
Let x,yeX

If (x,y) or (y,x) are in R, then x and y are
comparable
If (x,y) eR and (y,x) eR, then x and y are
incomparable
If every pair of elements in X are
comparable, then R is a total order on X
How about the >= relationship?
How about the divides relationship?

Inverse of a relation
Given a relation R from X to Y, its inverse R
-1

is the relation from Y to X defined by
R
-1
= { (y,x) | (x,y) e R }
Example: if R = {(1,a), (1,d), (2,a), (2,b), (2,c)}
then R
-1
= {(a,1), (d,1), (a,2), (b,2), (c,2)}



Composition of 2 Relations
Let R
1
be a relation from X to Y
Let R
2
be a relation from Y to Z

The composition of R
1
and R
2
, denoted
R
2
o R
1
is a relation from X to Z defined by
{(x, z) | (x, y)e R
1
and (y, z)e R
2
for some y e Y}
Note how y plays the role of range and then domain in
this transitive relationship

Example:
Let R
1
= {(1, 2), (3, 6)}
Let R
2
= {(2, u), (6, v)}
Then R
2
o R
1
= {(1, u), (3, v)}
2.5 Equivalence relations
Suppose we have a set X of 10 balls,
which are either red, green, or blue
If we divide the balls into sets R, B, G
according to color, the family {R, B, G} is
a partition on X
Theorem 2.5.1: Let S be a partition of a
set X. Define x R y to mean that for
some set S in S, both x and y belong to
S. Then R is reflexive, symmetric, and
transitive.
Example-1
Consider the partition S = {{1,3,5},{2,4}}
of X = {1,2,3,4,5}. The relation R on X
given by the Theorem 2.5.1 contains the
ordered pairs (1,1), (1,3), and (1,5)
because {1,3,5} is in S. The complete
relation is

R = {(1,1), (1,3), (1,5),
(3,1), (3,3), (3,5),
(5,1), (5,3), (5,5), (2,2), (2,4),
(4,2), (4,4)}
Example-2
Consider from the previous example
R = {(1,1), (1,3), (1,5), (3,1), (3,3), (3,5), (5,1), (5,3), (5,5),
(2,2), (2,4), (4,2), (4,4)}
The equivalence class [1] containing 1
consists of all x s.t. (x,1) e R. Therefore,
[1] = {1,3,5}.
The remaining equivalence classes are
found similarly:
[3] = [5] = {1,3,5}
[2] = [4] = {2,4}

Example-3
Consider set X = {1,2,,13}. Define xRy as
5 divides x y (i.e., x y = k n, for some int k).
We can verify that R is reflexive, symmetric,
and transitive. Here is how.
Determine the number of equivalence classes.
The equivalence class [1] consists of all x with
xR1. Thus:
[1] = {x e X | 5 divides x 1}
= {1, 6, 11}
[2] = {2, 7, 12}
[3] = {3, 8, 13}
[4] = {4, 9}
[5] = {5, 10}

Example-3
Thus:
[1] = {1, 6, 11}
[2] = {2, 7, 12}
[3] = {3, 8, 13}
[4] = {4, 9}
[5] = {5, 10}

These 5 sets partition X. Note that:
[1] = [6] = [11]
[2] = [7] = [12]
[3] = [8] = [13]
[4] = [9]
[5] = [10]

For this relation, equivalence is has the same reminder
when divided by 5.

Partitions, Formally speaking
A partition S on a set X is a family
{A
1
, A
2
,, A
n
} of subsets of X, such
that
A
1
A
2
A
3
A
n
= X
A
j
A
k
= C for every j, k with j = k,
1 < j, k < n.
Example: if X = {integers}, E = {even
integers) and O = {odd integers}, then
S = {E, O} is a partition of X.

Equivalence classes
Let X be a set and let R be an equivalence
relation on X. Let a e X.
Define [a] ={ xeX | xRa } ([a] is read class a)
Then S = { [a] | a e X }. That is, S is a
partition on X.
This is stated in Theorem 2.5.9
The sets [a] are called equivalence classes
of X induced by the relation R.
Given a, b e X, then [a] = [b] or [a][b] = C
Set of equivalence classes

Theorem 2.5.16: Let R be an equivalence relation on a
finite set X. If each equivalence class has k elements,
there are |X|/k equivalence classes.

See proof in textbook. Its really a trivially proven
theorem that applies when all partitions are of equal
length

As an example, Let X = {1,2,,15} in Example 3 and
see how this theorem applies.
2.6 Matrices of relations
Let X, Y be sets and R a relation from X to Y
Write the matrix A = (a
ij
) of the relation as
follows:
Rows of A = elements of X
Columns of A = elements of Y
Element a
i,j
= 0 if the element of X in row i and
the element of Y in column j are not related
Element a
i,j
= 1 if the element of X in row i and
the element of Y in column j are related
The matrix of a relation (1)
Example:
Let X = {1, 2, 3}, Y = {a, b, c, d}
Let R = {(1,a), (1,d), (2,a), (2,b), (2,c)}
The matrix A of the relation R is


A =
a b c d
1 1 0 0 1
2 1 1 1 0
3 0 0 0 0
The matrix of a relation (2)
If R is a relation from a set X to itself and A is the
matrix of R, then A is a square matrix.
Example: Let X = {2,3,4,5} and R = {(x,y) | x+y
divides 3}. Then :


A = fill it.
2 3 4 5
2
3
4
5
The matrix of a relation (2)

Example: Let X = {2,3,4,5} and R = {(x,y) | x+y
divides 3}. Then :


A =
2 3 4 5
2 0 0 1 0
3 0 1 0 0
4 1 0 0 1
5 0 0 1 0
The matrix of a relation on a set X
Let A be the square matrix of a relation R
from X to itself. Let A
2
= the matrix product
AA.
R is reflexive All terms a
ii
in the main
diagonal of A are 1.
R is symmetric a
ij
= a
ji
for all i and j,
i.e. R is a symmetric relation on X if A is a
symmetric matrix
R is transitive whenever c
ij
in C = A
2
is
nonzero then entry a
ij
in A is also nonzero.
2.8 Functions
A function f from X to Y (in
symbols f : X Y) is a
relation from X to Y such that
Dom(f) = X and if two pairs
(x,y) and (x,y) e f, then y = y

Example:
Dom(f) = X = {a, b, c, d},
Rng(f) = {1, 3, 5}
f(a) = f(b) = 3, f(c) = 5, f(d) = 1.
Domain and Range
Domain of f = X
Range of f =
{ y | y = f(x) for some x eX}
A function f : X Y assigns to
each x in Dom(f) = X a unique
element y in Rng(f) _ Y.
Therefore, no two pairs in f have
the same first coordinate.


Algebraically speaking
Note that such definitions on functions are consistent
with what you have seen in your Calculus courses.

violations when > 1
function
not a function
1 intersection
Modulus operator
Let x be a nonnegative integer and y a positive
integer
r = x mod y is the remainder when x is divided
by y
Examples:
1 = 13 mod 3
6 = 234 mod 19
4 = 2002 mod 111
Basically, remove the complete ys and count
whats left
mod is called the modulus operator
One-to-one functions
A function f : X Y is one-to-one
for each y e Y there exists at most one x e X
with f(x) = y. (therefore, f(x) = c is out of play)
Alternative definition: f : X Y is one-to-one
for each pair of distinct elements x
1
, x
2
e X there
exist two distinct elements y
1
, y
2
e Y such that
f(x
1
) = y
1
and f(x
2
) = y
2
.
Examples:
1. The function f(x) = 2
x
from the set of real numbers to itself is
one-to-one
2. The function f : R R defined by f(x) = x
2
is not one-to-one,
since for every real number x, f(x) = f(-x).


Onto functions
A function f : X Y is onto (or, subjective)
for each y e Y there exists at least one x e X with f(x) = y,
i.e. Rng(f) = Y.

Example: The function f={1,a),(2,c),(3,b)} from X={1,2,3} to Y={a,b,c} is
1-to-1 and onto. If Y={a,b,c,d}, then still 1-to-1, but not onto.

Example: The function f(x) = e
x
from the set of real numbers to itself is
not onto Y = the set of all real numbers. However, if Y is restricted to
Rng(f) = R
+
, the set of positive real numbers, then f(x) is onto. Why?

You need to look at the several visual examples illustrated in the
textbook
Bijective functions

A function f : X Y is bijective
f is one-to-one and onto
Examples:
1. Is A linear function f(x) = ax + b a bijective function from
the set of real numbers to itself. Why?

2. Is the function f(x) = x
3
a bijective from the set of real
numbers to itself. Why?

Inverse function
Given a function y = f(x), the inverse f
-1
is the
set {(y, x) | y = f(x)}.
The inverse f
-1
of f is not necessarily a
function.
Example: if f(x) = x
2
, then f
-1
(4) = \4 = 2, not a
unique value and therefore f is not a function.
However, if f is a bijective function, it can be
shown that f
-1
is a function. See Example
2.8.32.
Exponential and
logarithmic functions
Let f(x) = 2
x
and g(x) = log
2
x = lg x

f g(x) = f(g(x)) = f(lg x) = 2
lg x
= x
g f(x) = g(f(x)) = g(2
x
) = lg 2
x
= x

Therefore, the exponential and logarithmic
functions are inverses of each other.
Composition of functions
Given two functions g : X Y and f : Y Z,
the composition f g is defined as follows:
f g (x) = f(g(x)) for every x e X.
Example: g(x) = x
2
-1, f(x) = 3x + 5. Then
f g(x) = f(g(x)) = f(3x + 5) = (3x + 5)
2
- 1
Composition of functions is associative:
f (g h) = (f g) h,
But, in general, it is not commutative:
f g = g f.
Binary operators
A binary operator on a set X is a function f that
associates a single element of X to every pair of
elements in X, i.e. f : X x X X and f(x
1
, x
2
) e X
for every pair of elements x
1
, x
2
.

Examples of binary operators are addition,
subtraction and multiplication of real numbers, taking
unions or intersections of sets, concatenation of two
strings over a set X, etc.
Unary operators
A unary operator on a set X associates to
each single element of X one element of X.
Examples:
1. Let X = U be a universal set and P(U) the power
set of U. Define f : P(U) P(U) the function
defined by f (A) = A', the set complement of A in U,
for every A _ U. Then f defines a unary operator
on P(U). (The operator here is the complement
itself).

You might also like