COMP 232 Lecture Notes
COMP 232 Lecture Notes
on
DISCRETE MATHEMATICS
Eusebius Doedel
LOGIC
Introduction. First we introduce some basic concepts needed in our
discussion of logic. These will be covered in more detail later.
A set is a collection of objects (or elements).
EXAMPLES :
the infinite set of all integers : Z { , 2, 1, 0, 1, 2, 3, }.
the infinite set of all positive integers : Z+ {1, 2, 3, }.
the infinite set R of all real numbers.
the finite set {T , F }, where T denotes True and F False .
the finite set of alphabetic characters : {a, b, c, , z}.
1
b 7 1,
c 7 2,
EXAMPLE :
Let Pn denoet the infinite set of all polynomial functions p(x) of degree
n or less with integer coefficients.
The derivative operator D restricted to elements of Pn can be
viewed as a function from Pn to Pn1 ,
D : Pn Pn1 ,
dp
D : p 7
.
dx
EXAMPLE :
We can also define functions of several variables, e.g.,
f (x, y) = x + y ,
can be viewed as a function from Z+ cross Z+ into Z+ .
We write
f : Z+ Z+ Z+ .
(and
, conjunction)
(or
, disjunction)
(not
, negation)
p
T
F
p
F
T
p
T
T
F
F
pq
T
T
T
F
q
T
F
T
F
p
T
T
F
F
q pq
T T
F
F
T F
F
F
: B B B ,
: B B B .
+ : Z Z Z,
-2 2
-1 1
0
0
1 -1
2 -2
: Z Z Z,
Logical expressions.
A logical expression (or proposition) P (p, q, ) is a function
P : B B B B .
For example,
P1 (p, q) p q
P2 (p, q, r) p (q r)
and
EXAMPLE :
p
T
T
F
F
q
T
F
T
F
q
F
T
F
T
p (q)
T
T
F
T
and
A2 (x, y, z) x (y + z)
and
A2 : R R R R ,
A1 : R R R,
or, equivalently,
A1 : R2 R,
and
A2 : R3 R .
Two propositions are equivalent if they always have the same values.
EXAMPLE :
(p q)
is equivalent to p q ,
p
T
T
F
F
q
T
F
T
F
pq
T
T
T
F
(p q)
F
F
F
T
10
p
F
F
T
T
q
F
T
F
T
p q
F
F
F
T
NOTE :
In arithmetic
(x + y) is equivalent to (x) + (y) ,
i.e., we do not have that
(x + y) is equivalent to (x) (y) .
11
exclusive or
conditional , if then
biconditional , if and only if , iff
defined as :
p
T
T
F
F
q
T
F
T
F
pq
F
T
T
F
12
pq
T
F
T
T
pq
T
F
F
T
EXAMPLE :
Suppose two persons, P and Q, are suspected of committing a crime.
p q (p q)
is False .
Our problem is to find for what values of p and q this is the case.
14
x+y =3 .
15
T
T
T
F
F
T
F
F
(1) (2)
p
F
F
T
F
(6)
q
T
T
F
T
(5)
T
T
F
T
(4)
(p q)
T
F
F
F
(3)
q
F
F
T
F
(9)
T
F
T
F
(8)
(p q)
T
F
F
F
(7)
The order of evaluation has been indicated at the bottom of the table.
The values of the entire expression are in column (9).
We observe that the expression is True only if p = F and q = T .
Therefore Q was involved in the crime, but P was not.
16
EXERCISE :
(It must have precisely the same values as listed in column (9).)
17
EXERCISE :
Suppose three persons, P, Q, and R, are suspects in a crime.
EXERCISE :
(p ((p q))) (p q) .
19
p
F
T
p p
F
F
p
F
T
p p
T
T
EXERCISE :
(p q) p
(p q) q
p .
21
NOTATION :
We use the symbol to indicate that a conditional statement is a
tautology.
(p q) p
(p q) q
p ,
22
(modus ponens) ,
(modus tollens) .
T
T
T
T
F
F
F
F
(1)
T
T
F
F
T
T
F
F
(2)
T
F
T
F
T
F
T
F
(3)
(p q)
T
T
F
F
T
T
T
T
(5)
T
T
F
F
T
F
T
F
(9)
(p
F
F
F
F
T
T
T
T
(6)
r)
T
T
T
T
T
F
T
F
(7)
T
F
F
F
T
F
T
F
(10)
(q r)
T
F
T
T
T
F
T
T
(8)
T
T
T
T
T
T
T
T
(11)
r
T
F
T
F
T
F
T
F
(4)
The last column (11) consist of True values only. Therefore we can write
(p q) (p r) (q r) r
QUESTION : Does it matter which of the two s is evaluated first?
23
EXAMPLE :
Here we illustrate another technique that can sometimes be used to show
that a conditional statement is a tautology.
Consider again the logical expression
P (p, q, r) (p q) (p r) (q r) .
We want to show that
P (p, q, r) r ,
i.e., that
P (p, q, r) r
24
(b) p F
and
(c) q F
NOTE :
26
EXERCISE :
(p q) p
(p q) q
p .
27
EXERCISE :
Also use a direct proof to prove that
(p q) p
(p q) q
p .
(In a direct proof one assumes that the LHS is True and then one shows
that the RHS must be True also.)
28
NOTATION :
From the definition of the operator we see that logical expressions
P1 (p, q, )
and
P2 (p, q, ) ,
29
EXAMPLE :
(p q) is equivalent to p q ,
i.e.,
(p q) (p q) ,
as seen in the truth table
p
T
T
F
F
q
T
F
T
F
F
T
T
T
(p q)
T
F
F
F
30
T
T
T
T
(p
F
F
T
T
F
T
T
T
q)
F
T
F
T
The operators
,
and
and
as verified below :
T
T
F
F
T
F
T
F
(p q)
F
T
T
F
T
T
T
T
(p q)
31
T
T
T
F
F
T
T
F
F
T
T
T
(p q)
T
F
F
F
p
T
T
F
F
T
T
F
F
T
F
T
F
q
T
F
T
F
(p q)
T
F
F
T
(p q)
T
F
T
T
T
T
T
T
(q
T
T
T
T
(q p)
T
F
T
T
32
T
F
T
T
p)
F
F
T
T
(p
T
F
F
T
T
T
F
T
q)
F
T
F
T
33
p q q p
p q q p
commutative law
p (q r)
p (q r)
(p q) (p r)
(p q) (p r) distributive law
p F p
p T p
identity law
p p T
p p F
complement law
34
T F
F T
negation law
p p p
p p p
idempotent law
p T T
p F F
domination law
p (p q) p p (p q) p absorption law
(p q) r p (q r) (p q) r p (q r) associative law
(p q) p q
(p q) p q
de Morgan
(p) p
double negation
p q q p
contrapositive
36
37
pF
identity law
p (p p)
complement law
(p p) (p p)
distributive law
(p p) T
complement law
pp
identity law
38
NOTE :
39
40
q
T
F
T
F
p
F
F
T
T
41
p q
F
F
T
F
42
p q (p q)
q (p q)
p q (p q)
q (q p)
commutative law
p q (p q)
q
absorption law
p (p q) q
q
equivalence of
p (p q) q q
associative law
p q q
absorption law
43
p q q
p q q
de Morgan
p q q
double negation
p q q
associative law
p q
idempotent law
44
EXERCISE :
Use logical equivalences to simplify the logical expression
(p ((p q))) (p q) .
(This example was already considered before, using a truth table.)
EXERCISE :
Use logical equivalences to verify the following equivalence:
(p q) (q p) (p q) (p q) .
(This was considered before in connection with the operator.)
45
EXERCISE :
Use logical equivalences to show that the logical expression
(p q) (p r) (q r) r ,
is a tautology, i.e., show that
(p q) (p r) (q r) r .
46
Predicate Calculus.
Let S be a set.
47
P : Z+ {T , F }
P (x) = T
if x Z+ is even ,
P (x) = F
if x Z+ is odd .
EXAMPLE :
Then
P : U {T , F } .
49
EXAMPLE :
50
Quantifiers.
For a more compact notation we introduce the quantifiers
,
and
x S P (x)
means
x S P (x)
means
!x S P (x) means
If it is clear from the context what S is, then one often simply writes
x P (x) ,
x P (x) ,
!x P (x) .
x P (x)
and
!x P (x)
P (x1 ) P (x2 ) P (x3 ) P (xn )
P (x1 ) P (x2 ) P (x3 ) P (xn )
P (x1 ) P (x2 ) P (x3 ) P (xn )
52
and
xy P (x, y)
both mean
x yP (x, y) .
53
Similarly,
x, y P (x, y)
and
xy P (x, y)
both mean
x yP (x, y) .
54
EXAMPLE :
Let
P
: S S {T , F } ,
where
S = {1, 2} .
Then
x, y P (x, y) P (1, 1) P (1, 2) P (2, 1) P (2, 2) ,
while
x, y P (x, y) P (1, 1) P (1, 2) P (2, 1) P (2, 2) .
55
EXERCISE : Let
P : Z Z {T , F } ,
where P (x, y) denotes
x + y = 5 .
What are the values of the following propositions ?
x, y P (x, y)
x, y P (x, y)
x !y P (x, y)
x y P (x, y)
56
EXERCISE : Let
P : Z+ Z+ Z+ {T , F } ,
where P (x, y, z) denotes the statement
x2 + y 2 = z .
What are the values of the following propositions?
x, y, z P (x, y, z)
x, y, z P (x, y, z)
x, y z P (x, y, z)
x, z y P (x, y, z)
z x, y P (x, y, z)
57
EXAMPLE :
Let
P, Q : S {T , F } ,
where
S = {1, 2} .
Then
x P (x) Q(x) P (1) Q(1) P (2) Q(2) ,
while
x, y P (x) Q(y)
P (1)Q(1) P (1)Q(2) P (2)Q(1) P (2)Q(2) .
58
Show that
x P (x) Q(x)
is not equivalent to
x, y P (x) Q(y)
Hint: Take S = {1, 2} , and find predicates P and Q so that one of the
propositions is True and the other one False .
59
EXAMPLE : If
where
P, Q : S {T , F } ,
S = {1, 2} ,
then
x P (x) Q(x) P (1) Q(1) P (2) Q(2) .
EXAMPLE : If again
and
then
P, Q : S {T , F } ,
S = {1, 2} ,
x P (x) Q(x) P (1) Q(1) P (2) Q(2)
P (1) Q(1) P (2) Q(2) .
60
EXAMPLE :
xP (x) xQ(x)
x P (x) Q(x)
i.e., there are predicates P and Q for which the equivalence not valid.
As a counterexample take
P, Q : Z+ {T , F } ,
where
P (x) x is even ,
and
Q(x) x is odd .
EXERCISE :
Show that
xP (x) xQ(x)
x P (x) Q(x)
by giving an example where LHS and RHS have a different logical value.
62
(1) xP (x)
(2)
xP (x) xQ(x)
(3)
xP (x) xQ(x)
(4)
xP (x) xQ(x)
63
x P (x)
x P (x) Q(x)
xy P (x) Q(y)
xy P (x) Q(y)
xP (x)
P (x1 ) P (x2 ) P (xn )
P (x1 ) P (x2 ) P (xn )
P (x1 ) P (x2 ) P (xn )
xP (x)
64
EXERCISES :
These equivalences are easily seen to be valid:
Prove Equivalence 2 :
xP (x) xQ(x) x P (x) Q(x)
Prove Equivalence 3 :
xP (x) xQ(x) xy P (x) Q(y)
65
xP (x) xQ(x)
xy P (x) Q(y)
and
RHS LHS
or equivalently
LHS RHS
and
66
LHS RHS
PROOF :
(i) xP (x) xQ(x) xy P (x) Q(y)
is easily seen to be True by a direct proof (with 2 cases).
(ii)
h
i
xP (x) xQ(x)
xy P (x) Q(y)
can be rewritten as
xP (x) xQ(x) xy P (x) Q(y)
P and Q being arbitrary, we may replace them by P and Q :
xP (x) xQ(x) xy P (x) Q(y)
which is easily seen to be True by a direct proof.
QED !
67
EXERCISE :
Prove that the equivalence
xP (x) xQ(x)
xy P (x) Q(y)
Hint : This proof can be done along the lines of the preceding proof.
68
(5) xP (x)
(6)
xP (x) xQ(x)
(7)
xP (x) xQ(x)
(8)
xP (x) xQ(x)
69
xP (x)
x P (x) Q(x)
xy P (x) Q(y)
xy P (x) Q(y)
replacing P by P and Q by Q ..
70
(2)
xP (x) xQ(x)
xP (x) xQ(x)
xP (x) xQ(x)
(6)
xP (x) xQ(x)
71
x P (x) Q(x)
x P (x) Q(x)
x P (x) Q(x)
x P (x) Q(x)
EXERCISE :
72
xyzP (x, y, z)
x y zP (x, y, z)
xy zP (x, y, z)
xyzP (x, y, z)
73
x P (x) Q(x)
x P (x) Q(x)
xP (x) xQ(x)
xP (x) xQ(x)
xP (x) xQ(x)
Let
D(x)
P (x)
,,
x is one of my poultry
O(x)
,,
x is an officer
W (x)
,,
x is willing to waltz
75
x is a duck
Statement
logic
equivalent
x D(x) W (x)
x (D(x) W (x)
x (O(x) W (x)
x (O(x) W (x)
x (D(x) P (x)
x (P (x) D(x)
x O(x) P (x)
x (P (x) O(x)
76
i
x(D(x) W (x)) x(O(x) W (x)) x(P (x) D(x))
i
x(D(x) W (x)) x(O(x) W (x)) x(P (x) D(x))
x(P (x) O(x))
h
i
x(D(x) W (x)) x(O(x) W (x)) x(P (x) D(x))
(1)
(2)
(3)
x(P (x) O(x))
(4)
h
i
x(D(x) W (x)) x(O(x) W (x)) x(P (x) D(x))
(1)
(2)
(3)
x(P (x) O(x))
(4)
QED !
80
REVIEW EXERCISES.
Problem 1. By truth table check if the operator is associative:
(p q) r
p (q r) .
Name
(p (p q)) q
modus ponens
(q (p q)) p
modus tollens
((p q) (q r)) (p r)
hypothetical syllogism
((p q) p) q
disjunctive syllogism
((p q) (p r)) (q r)
resolution
82
NOTE :
- Let P (x, y) denote y is a parent of x .
- You may use the predicates x y , x > y , and x 6= y .
83
Problem 7.
Let P (x, y, z) denote the statement
x2 y = z ,
where the universe of discourse of all three variables is the set Z.
y, zxP (x, y, z)
P (0, 7, 0)
x, y, zP (x, y, z)
x, yzP (x, y, z)
x, y, zP (x, y, z)
xy, zP (x, y, z)
84
Problem 8.
Let P (x, y, z, n) denote the statement
xn + y n = z n ,
where x, y, z, n Z+ .
What is the truth value of each of the following:
P (1, 1, 2, 1)
x, y!zP (x, y, z, 1)
P (3, 4, 5, 2)
zx, yP (x, y, z, 1)
x, yzP (x, y, z, 2)
!x, y, zP (x, y, z, 2)
x, y, zP (x, y, z, 3)
Problem 9.
Give an example that shows that
xyP (x, y)
6
yxP (x, y) .
Problem 10.
Prove that
x[P (x) Q(x)] [xP (x) xQ(x)].
Problem 11.
Prove that
xy(P (x) Q(y)) xP (x) xQ(x) .
86
MATHEMATICAL PROOFS.
87
DEFINITIONS : Let n, m Z+ .
We call n odd if k Z : k 0, n = 2k + 1.
We call n even if n is not odd. (Then n = 2k for some k Z+ .)
We say m divides n, and write m|n, if n = qm for some q Z+ .
In this case we call m a divisor of n.
If m|n then we also say that n is divisible by m.
n (n 2) is a prime number if its only positive divisors are 1 and n.
n (n 2) composite if it is not prime.
n and m are relatively prime if 1 is their only common divisor.
88
Direct proofs.
Many mathematical statements have the form
if P then Q
i.e.,
or, more often,
P Q,
x P (x) Q(x) ,
Q(n) n2 is odd .
QED !
2 | (k + 1) .
or
Thus
8 | 4k(k + 1) .
QED !
92
xk =
k=0
1 xn+1
,
1x
n 0 ,
( Geometric sum ) .
n
X
xk .
k=0
Then
Sn
x Sn
1 + x + x2 + + xn1 + xn ,
x + x2 + + xn1 + xn + xn+1 ,
so that
Sn x Sn = (1 x) Sn = 1 xn+1 ,
from which the formula follows.
QED !
93
DEFINITION :
A perfect number is a number that equals the sum of all of its divisors,
except the number itself.
EXAMPLES :
6 is perfect :
6 = 3 + 2 + 1,
and 28 is perfect :
28 = 14 + 7 + 4 + 2 + 1 ,
and so is 496 :
496 = 248 + 124 + 62 + 31 + 16 + 8 + 4 + 2 + 1 .
94
1, 2, 22 , 23 , , 2m1 ,
(2m 1), 2(2m 1), 22 (2m 1), , 2m2 (2m 1), 2m1 (2m 1) .
The last divisor is equal to n , so we do not include it in the sum.
95
2 + (2 1)
m2
X
k=0
1 2m
1 2m1
m
=
+ (2 1)
12
12
= (2m 1) + (2m 1)(2m1 1)
= (2m 1) (1 + 2m1 1)
= (2m 1) 2m1 = n.
QED !
q p .
EXAMPLE :
The statement
n2 even n even,
proved earlier is equivalent to
(n even) (n2 even),
i.e., it is equivalent to
n odd n2 odd .
97
If we must prove
P Q,
then we may equivalently prove the contrapositive
Q P .
98
QED !
(p q) r
r (p q)
(p q) r
r (p q)
q xP (x)
q xP (x)
xQ(x) p
xQ(x) p
xP (x) q
xP (x) q
p xQ(x)
p xQ(x)
100
n is prime .
QED !
101
5|n ,
So suppose 5 6 |n.
n2
n2
n2
n2
= 25k2 + 10k + 1 =
= 25k2 + 20k + 4 =
= 25k2 + 30k + 9 =
= 25k2 + 40k + 16 =
QED !
102
5(5k2 + 2k) + 1 ,
5(5k2 + 4k) + 4 ,
5(5k2 + 6k + 1) + 4 ,
5(5k2 + 8k + 3) + 1 ,
Proof by contradiction.
To prove a statement P Q by contradiction :
assume P = T
and Q = F ,
103
PROPOSITION :
If a prime number is the sum of two prime numbers
then one of these equals 2.
PROOF :
Let p1 , p2 , and p be prime numbers, with p1 + p2 = p.
Suppose that neither p1 nor p2 is equal to 2.
Then both p1 and p2 must be odd ( and greater than 2 ) .
Hence p = p1 + p2 is even, and greater than 2.
This contradicts that p is prime.
QED !
104
m
+
PROOF : Suppose m, n Z and n = 2.
PROPOSITION :
m
n
6=
2.
2n
m2 = 2n2
m2 even
m even
k Z+ (m = 2k)
2n2 = m2 = (2k)2 = 4k2
n2 = 2k2
n2 even
n even
*
(proved earlier)
(using * above)
Thus both n and m are even and therefore both are divisible by two.
This contradicts that they are relatively prime.
QED !
NOTATION : The means that the immediately following statement is implied by the preceding statement(s).
105
EXERCISE :
Use a proof by contradiction to show the following:
(p q) (p r) (q r) r .
(p q) (q r) p r .
106
PROPOSITION :
If the integers
1, 2, 3, , 10,
are placed around a circle, in any order, then there exist three integers
in consecutive locations around the circle that have a sum greater than
or equal to 18.
107
QED !
108
: Then 3|n ,
n = 3k + 1
: Then 3|(n + 2) ,
n = 3k + 2
: Then 3|(n + 1) .
QED !
109
(Why ?)
with 0 r < 1 .
2x = x + x + 21
x = n + r
0 r < 1
PROOF :
Case 1 :
0 r <
1
2
Then
0 2r < 1
and
1
1
r+
< 1.
2
2
LHS :
2x = 2n + 2r = 2n
RHS :
x = n + r = n
1
1
x + = n + r + = n
2
2
2x = x + x + 21
x = n + r
0 r < 1
PROOF : (continued )
Case 2 :
1
2
r < 1 : Then
1 2r < 2
and
1
1
< 1 +
.
1 r+
2
2
LHS :
2x = 2n + 2r = 2n + 1
RHS :
x = n + r = n
1
1
x + = n + r + = n + 1
2
2
QED !
112
Existence proofs.
113
n Z+ m Z+ : m + i is composite , i = 1, , n .
PROOF :
Let m = (n + 1)! + 1.
(n + 1)! + 1 + 2,
(Why ?)
(n + 1)! + 1 + n ,
QED !
116
PROOF :
Suppose the total number of primes is finite , say,
p1 , p2 , , pn .
Let
N = p1 p2 pn + 1
(Why not ?)
(i = 1, , n) .
QED !
NOTE :
118
NOTE :
NOTE :
There are many mathematical statements that are thought to be
correct, but that have not yet been proved (open problems ),
e.g., the Goldbach Conjecture :
Every even integer greater than 2 is the sum of two prime numbers.
Indeed, proving mathematical results is as much an art as it is
a science, requiring creativity as much as clarity of thought.
An essential first step is always to fully understand the problem.
Where possible, experimentation with simple examples may help
build intuition and perhaps suggest a possible method of proof.
120
REVIEW EXERCISES.
Problem 1. Use a direct proof to show the following:
(p q) (q r)
(p s) t q (u s) r t .
121
3|n ,
122
Problem 5.
Show that for all positive real x
if x is irrational then
x is irrational .
123
x = n r,
n Z and r R ,
with 0 r < 1 .
= + .
2
2
2
If Yes then give a proof. If No then give a counterexample.
124
SET THEORY
Basic definitions.
125
xA
x is an element (a member) of A.
x
/A
(x A)
AB
x U : x A x B
subset
A=B
(A B) (B A)
equality
AB
{ x U : (x A) (x B) }
union
AB
{ x U : (x A) (x B) }
intersection
{xU : x
/A}
complement
{ x U : (x A) (x
/ B) }
difference
AB
127
Venn diagram.
This is a useful visual aid for proving set theoretic identities.
EXAMPLE : For the two sides of the identity
(A B) C = A (B C)
we have the following Venn diagrams :
C
128
The actual proof of the identity, using the above definitions and the laws
of logic, is as follows :
x (A B) C
x (A B) x
/C
(x A x B) x
/C
x A (x B x
/ C) associative law
x A x (B C)
x A (B C)
129
EXAMPLE :
For the two sides of the identity
A (B C) = (A B) (A C)
we have the following Venn diagrams :
C
130
x A (B C)
x A x
/ (B C)
x A (x (B C))
x A (x B x C)
x A x
/B x
/C
de Morgan
x A x A x
/ B x
/C
idempotent law
x A x
/B xA x
/C
commut.+assoc.
x (A B) x (A C)
x (A B) (A C)
131
EXAMPLE : A B = A B
A=B
and
(ii) show B A .
To show (i) :
Let x A. We must show that x B.
Since x A it follows that x A B.
Since (A B) = (A B) it follows that x (A B).
Thus x B also.
The proof of (ii) proceeds along the same steps.
132
Subsets.
133
EXAMPLE :
Let
U = {1 , 2 , 3} .
Then
P (U ) =
{}, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}
134
AB =BA
AB =BA
commutative laws
A (B C) =
A (B C) =
(A B) (A C)
(A B) (A C) distributive laws
A=A
AU =A
identity laws
A A = U
A A =
complement laws
135
U =
= U
AA=A
AA=A
idempotent laws
AU =U
A=
domination laws
A (A B) = A
A (A B) = A absorption laws
136
(A B) C =
(A B) C =
A (B C)
A (B C) associative law
A B = A B
A B = A B
= A
A
de Morgans laws
involution law
All the preceding identities can be proved using the definitions of set
theory and the laws of logic.
Note the close correspondence of these identities to the laws of logic.
137
Given this setup one can derive all other set theoretic identities.
Note the close correspondence between the above axiomatic setup and
the axiomatic setup of logic !
138
EXAMPLE :
Prove the idempotent law
AA=A
using only the basic set theoretic identities :
A =
identity law
A (A A)
complement law
distributive law
(A A) (A A)
(A A) U
complement law
AA
identity law
139
EXAMPLE :
( to illustrate the close relation between Set Theory and Logic )
Using another approach we prove the absorption law :
A (A B) = A
Thus we must prove
x U : x A (A B) x A
x U : x A x A B x A
x U : x A (x A x B) x A
140
x U : x A (x A x B) x A
Define logical predicates a(x) and b(x) :
a(x) x A
b(x) x B .
REVIEW EXERCISES.
For each of the following, determine whether it is valid or invalid.
If valid then give a proof. If invalid then give a counterexample.
(1)
A (B A) = A
(2)
A (B C) = (A B) C
(3)
(A B) (C D) = (A D) (C B)
(4)
= A
(A B) (A B)
(5)
A ((B C) A) = A
(6)
A (B C) = (A B) (A C)
(7)
B C A (B A) (C A) =
(8)
(A B) (A B) = A B =
142
FUNCTIONS
DEFINITIONS : Let A and B be sets.
Then f is called
a function from A to B
We write
: A B
We say that f is :
a1 , a2 A : a1 6= a2 f (a1 ) 6= f (a2 )
iff
a1 , a2 A : f (a1 ) = f (a2 ) a1 = a2
bijective iff
b B a A : f (a) = b
f (A) = B
144
EXAMPLE :
Let
A = {a, b, c}
B = {1, 2} ,
f : b 7 2 ,
f : c 7 1 .
B
a
b
2
c
145
EXAMPLE :
Let
A = {a, b} ,
B = {1, 2, 3} ,
f : b 7 3 .
B
a
1
2
b
3
146
EXAMPLE :
Let A = B = Z+ , and let
f : Z+ Z+
be defined by
n(n + 1)
,
f : n 7
2
i.e.,
n(n + 1)
f (n) =
.
2
147
n21 + n1 = n22 + n2
n1 = n2
or n1 + n2 = 1
QED !
149
EXAMPLE :
Define
f
: Z Z Z Z
or equivalently
f
: Z2 Z2
by
f (m, n) = (m + n , m n) ,
or equivalently, in matrix multiplication notation
f :
m
n
1 1
1 1
m
n
PROOF :
(i) One-to-one :
Suppose
Then
i.e.,
f (m1 , n1 ) = f (m2 , n2 ) .
(m1 + n1 , m1 n1 ) = (m2 + n2 , m2 n2 ) ,
m1 + n1 = m2 + n2 ,
and
m1 n1 = m2 n2 .
and n1 = n2 ,
(m1 , n1 ) = (m2 , n2 ) .
Thus f is one-to-one.
151
for m, n Z ?
and
sd
n =
.
2
QED !
152
and g : B C ,
f(a)
153
g(f(a))
EXAMPLE :
Let A = B = C = Z (all integers), and define f, g : Z Z by
f (n) n2 + 2n 1
g(n) 2n 1 .
Let h1 (n) f g(n) . Then
h1 (n) = f (2n 1) = (2n 1)2 + 2(2n 1) 1 = 4n2 2 .
Let h2 (n) g f (n) . Then
h2 (n) = g(n2 + 2n 1) = 2(n2 + 2n 1) 1 = 2n2 + 4n 3 .
Let h3 (n) g g(n) . Then
h3 (n) = g(2n 1) = 2(2n 1) 1 = 4n 3 .
154
Inverses. Let
f : A B ,
and
g : B A .
Then g is called the inverse of f if
and
a A : g f (a) = a ,
b B : f g(b) = b .
EXAMPLE :
Let f : Z Z be defined by f : n 7 n 1 , i.e.,
f (n) = n 1 (shift operator) .
f is one-to-one :
If f (n1 ) = f (n2 ) then n1 1 = n2 1 , i.e., n1 = n2 .
f is onto :
Given any m Z , can we find n such that f (n) = m ?
That is, can we find n such that n 1 = m ?
Easy: n = m + 1 !
156
f (n) = n 1 ,
f : Z Z
f f 1 (m) = f (m + 1) = (m + 1) 1 = m ,
f 1 f (n) = f 1 (n 1) = (n 1) + 1 = n .
157
EXAMPLE :
Let f : R R be defined by f : x 7 1 2x , i.e.,
f (x) = 1 2x .
f is one-to-one :
If f (x1 ) = f (x2 ) then 1 2x1 = 1 2x2 , i.e., x1 = x2 .
f is onto :
Given any y R , can we find x such that f (x) = y ?
That is, can we find x such that 1 2x = y ?
Easy: x = (1 y)/2 !
( We actually constructed the inverse in this step : f 1 (y) =
158
1y
2
.)
f (x) = 1 2x ,
f : R R
1y
(y) =
.
2
THEOREM :
REMARK :
It is not difficult to see that this theorem holds for finite sets.
160
PROOF :
(1a) First we show that if f is invertible then f is 1 1 .
By contradiction: Suppose f is invertible but not 1 1.
Since f is not 1 1 there exist a1 , a2 A, a1 6= a2 , such that
f (a1 ) = f (a2 ) b0 .
Since f is invertible there is a function g : B A such that
g (f (a) ) = a, a A .
In particular
i.e.,
g f (a1 ) = a1 ,
g(b0 ) = a1 ,
and g f (a2 ) = a2 ,
and g(b0 ) = a2 .
a A .
f g(b0 ) = b0 ,
where g(b0 ) A .
a A : g f (a) = a .
By contradiction : Suppose g f (a0 ) 6= a0 for some a0 A .
Define b0 = f (a0 ) .
Then b0 B and
g(b0 ) 6= a0 ,
f g(b0 ) 6= b0 .
QED !
EXAMPLE :
Define f : Z+ Z+ by
f (n) = n(n 2)(n 4) + 4 .
Then f is not one-to-one ; for example, f (2) = f (4) = 4 :
n
f (n)
1 2 3 4 5 6
7
7 4 1 4 19 52 109
Now let
Finally let
D = Z+ {2} ,
166
and
e = 2 ,
3 = 3 ,
where e = 2.71828 .
167
7/2 = 4 ,
FACT :
x R ! n Z
and
e = 3 ,
3 = 3 ,
168
7/2 = 3 .
We see that
R Z ,
R Z .
and
EXERCISE :
Is one-to-one?
onto?
invertible?
Is one-to-one?
onto?
invertible?
EXAMPLE : Let p , k Z+ .
Then
p
<
k
p+k
.
k
PROOF :
By definition of the ceiling function we can write
p
k
p
= r,
k
where 0 r < 1 .
Hence
p
=
k
p
+ r <
k
p
+ 1 =
k
170
p+k
.
k
QED !
x
y
1 1
1 1
x
y
One-to-one :
Exercise!
Hint : See the earlier example where this function was considered as
f : Z2 Z2 .
171
Onto :
f (x, y) = (x + y , x y)
or
f :
x
y
1 1
1 1
x
y
s+d
x =
2
Thus the inverse is
s+d sd
g(s, d) = (
,
)
2
2
xy = d ,
sd
y =
.
2
or
g :
172
s
d
1
2
1
2
1
2
21
s
d
f (x, y) = (x + y , x y)
g(s, d) = ( s+d
,
2
sd
)
2
) = (s, d) ,
2
2
2
2
and
g(f (x, y)) = g(x + y , x y)
= (
(x + y) + (x y) (x + y) (x y)
,
) = (x, y) .
2
2
173
EXAMPLE :
More generally, a function
f
: R2 R2
f : R2 R2
x
a11
, f :
7
a21
y
x
a12
y
a22
a12
s
.
a11
d
n
m
a11
a21
a12
a22
n
m
Is
f 1
1
s
a22
:
7
d
D a21
176
a12
s
.
a11
d
f 1
1
a22
s
:
7
d
D a21
177
a12
s
.
a11
d
REVIEW EXERCISES.
Problem 1.
Define
f
by
f (x)
: R R
1/x if
if
x 6= 0 ,
x=0.
Problem 2.
Consider a function
f : A B .
(ii) onto
A = {1, 2, 3}
B = {1, 2}
A = {1, 2}
B = {1, 2, 3}
Problem 3.
Can you find a function f : Z Z+ that is one-to-one and onto ?
Can you find a function g : Z+ Z that is one-to-one and onto ?
Problem 4.
181
Problem 5.
Problem 6.
Let P2 denote the set of all polynomials of degree 2 or less ,
i.e., polynomials of the form
p(x) = a x2 + b x + c ,
a, b, c R , x R .
p(x) = d x + e ,
For example,
D
3x2 + 7x 4
6x + 7 ,
5x 2
5.
and
D
QUESTIONS :
Is D indeed a function from P2 to P1 ?
Is D one-to-one ?
Is D onto ?
Does D have an inverse ?
184
Problem 7.
: A B ,
Problem 8.
: A B ,
we write q = n div d ,
we write r = n mod d .
187
EXAMPLES :
n = 14 , d = 5 :
14 = 2 d + 4 ,
14 div 5 = 2
n = 14 , d = 5 :
and
so
14 mod 5 = 4 .
14 = (3) d + 1 ,
14 div 5 = 3
and
188
so
14 mod 5 = 1 .
Let d Z+ and n, q, r Z .
From the definitions of div and mod it follows that :
PROPERTY 1 :
Example :
PROPERTY 2 :
n = (n div d) d + n mod d
23 = (23 div 7) 7 + 23 mod 7
If
Example :
PROPERTY 3 :
Example :
where
EXAMPLE :
EXAMPLE :
(59 mod 7) mod 7 = 59 mod 7 .
191
PROPERTY 6 :
Let a, b Z and d Z+ . Then
(a + b) mod d = (a mod d + b mod d) mod d .
EXAMPLE :
(5 + 8) mod 3 = 1 = (5 mod 3 + 8 mod 3) mod 3 .
192
PROOF :
By the Division Theorem
a = qa d + ra ,
where ra = a mod d ,
with 0 ra < d ,
b = qb d + rb ,
where rb = b mod d ,
with 0 rb < d .
(a + b) mod d
= (qa d + ra + qb d + rb ) mod d
Thus
=
(qa + qb )d + ra + rb mod d
= (ra + rb ) mod d
(using Property 4)
193
QED !
DEFINITION :
If a, b Z , d Z+ , and if
a mod d = b mod d ,
then we also write
and we say
a b (mod d) ,
a is congruent to b modulo d.
EXAMPLE :
83 31 (mod 26) .
Note that 83 31 = 52 , which is divisible by 26 , i.e.,
26 | (83 31) .
194
if and only if
d | (a b) .
PROOF :
() First, if a b (mod d) then, by definition,
a mod d = b mod d .
Hence there exist qa , qb , r Z , with 0 r < d , such that
a = qa d + r
and b = qb d + r
It follows that
a b = (qa qb ) d ,
so that d | (a b).
195
(same remainder).
a b (mod d)
()
if and only if
d | (a b)
Conversely, if d | (a b) then
a b = qd ,
i.e. ,
a = b + qd ,
for some q Z .
It follows that
a mod d = (b + qd) mod d = b mod d .
196
for some q Z .
Then
13 7 (mod 2 3) ,
i.e.,
13 (mod 6) = 7 (mod 6) ,
and
132 72 (mod 4 3) ,
i.e.,
169 (mod 12) = 49 (mod 12)
198
(Check!) .
QED !
n , n+2 , n+4 ,
If n mod 3 = 1
or
then
n + 2 = 3k + 3 ,
Case 2 :
If n mod 3 = 2
(Why ?)
n mod 3 = 2 .
then
n + 4 = 3k + 6 ,
200
n = 3k + 1 and
i.e.,
3|(n + 2) .
n = 3k + 2 and
i.e.,
3|(n + 4) .
Contradiction !
EXAMPLE :
252 = 22 32 71 .
201
and
n = 3q .
QED !
REMARK :
203
DEFINITION :
We call n Z+ a perfect square if
k Z+ : n = k2 .
FACT :
The factorization of a perfect square has only even powers :
If
k = pn1 1 pn2 2 pnmm ,
then
2nm
.
n = k2 = p12n1 p22n2 pm
204
PROPOSITION :
+
If n Z
n is irrational.
PROOF :
By contradiction :
p
n =
,
q
i.e.,
p2 = n q 2 ,
for some p, q Z+ .
205
p2 = n q 2
The prime factorization of p2 has even powers only.
The prime factorization of q 2 has even powers only.
The prime factorization of n must have an odd power,
(otherwise n would be a perfect square).
Thus the factorization of nq 2 must have an odd power.
Thus p2 has two distinct factorizations:
one with even powers and one with at least one odd power.
This contradicts the uniqueness in the Factorization Theorem.
QED !
206
DEFINITION :
k Z+ is the greatest common divisor of n, m Z+ ,
k = gcd(n, m) ,
if
207
REMARK :
One can determine
gcd( n , m )
from the minimum exponents in the prime factorizations of n and m.
EXAMPLE : If
n = 168 ,
m = 900 ,
then
n = 23 3 1 7 1 ,
m = 22 3 2 5 2 ,
and
gcd(168, 900) = 22 31 = 12 .
208
r = n mod d ,
Then
gcd(n, d) =
(the remainder)
gcd(d , r)
209
if
r > 0,
if
r = 0.
EXAMPLE :
= gcd(6 , 15 mod 6)
= 3.
210
= gcd(6 , 3)
EXAMPLE :
gcd(2008 , 1947) = gcd(1947 , 2008 mod 1947) = gcd(1947 , 61)
= gcd(61 , 56)
= gcd(56 , 5)
= gcd(5 , 56 mod 5)
= gcd(5 , 1)
= 1.
Thus 2008 and 1947 are relatively prime .
211
LEMMA :
Let a, b, c Z , and d Z+ .
Then
(1) ( a = b + c , d|a , d|b )
d|c ,
d|a ,
(3) ( a = bc , d|c )
d|a .
212
(1)
( a = b + c , d|a , d|b )
d|c
PROOF of (1) :
and
d|a qa Z : a = d qa ,
d|b qb Z : b = d qb .
Thus
c = a b = d qa d qb = d (qa qb ) .
Hence d|c .
gcd(n, d) =
gcd(d, r)
d
if
if
r>0
r=0
n = q d + r,
q = n div d and r = n mod d .
Case 1 : r = 0 .
Then clearly d|n .
Also d|d and no greater number than d divides d .
Hence d = gcd(n, d) .
214
gcd(n, d) =
Case 2 :
gcd(d, r)
d
if
if
r > 0:
Let k = gcd(n, d) .
Then k|n and k|d .
By the Division Theorem
n = q d + r,
By Lemma (3)
k|qd .
By Lemma (1)
k|r .
r>0
r=0
gcd(n, d) =
gcd(d, r)
d
k = gcd(n, d) ,
if
if
r>0
r=0
n = q d + r.
k1 |qd .
By Lemma (2)
k1 |n .
QED !
REVIEW EXERCISES.
Problem 1.
k = 2, 3, , n .
217
and
218
x 3(mod 9) ?
Problem 6.
Let
S = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } ,
and define
f
by
: S S ,
Problem 7.
and
f (k) = (7k + 3) mod 10 .
219
Problem 8.
Let n 2 ,
Sn = { 0 , 1 , 2 , 3 , , n 1 } ,
and define
f
: Sn Sn ,
by
f (k) = (pk + s) mod n ,
where p is prime, with p > n , and s Sn .
220
Suppose P is a predicate,
P
: S { T , F } ,
such that :
(i)
P (s1 ) = T ,
(ii)
P (sn ) = T
P (sn+1 ) = T .
Then
P (s) = T ,
221
for all s S .
EXAMPLE :
n
X
k=1
n(n + 1)
k =
,
2
n Z+ .
Here S = Z+ and
P (n) = T
if
n
X
n(n + 1)
k =
,
2
n
X
n(n + 1)
.
k 6=
2
k=1
and
P (n) = F
if
k=1
for all n .
222
PROOF :
(i) By inspection the formula holds if n = 1 , i.e., P (1) = T .
for some arbitrary n Z+ , i.e.,
n
X
n(n + 1)
k =
.
2
k=1
k =
(n + 1) (n + 1) + 1
2
k=1
n(n + 1)
+ (n + 1)
2
k=1
(n + 1) (n + 1) + 1
2
223
QED !
EXAMPLE :
n
X
k2 =
k=1
n(n + 1)(2n + 1)
,
6
n Z+ .
PROOF :
(i) Again the formula is valid if n = 1 .
(ii) Suppose
n
X
k=1
n(n + 1)(2n + 1)
,
=
6
k2 =
(n + 1) (n + 1) + 1
2(n + 1) + 1
6
k=1
224
Pn
k=1
To do this :
n(n+1)(2n+1)
6
n+1
X
k=1
k2 =
n
X
k=1
k2
Pn+1
k=1
k2 =
+ (n + 1)2
EXAMPLE :
(n3 n) mod 3 = 0 ,
n Z+ .
PROOF :
(i) By inspection P (1) = T .
(n3 n) mod 3 = 0
( (n + 1)3 (n + 1) ) mod 3 = 0
To do this :
(n + 1)3 (n + 1) mod 3 = (n3 + 3n2 + 3n n) mod 3
= 3(n2 + n) + n3 n mod 3
= (n3 n) mod 3 = 0 . QED !
227
EXAMPLE :
Let P (n) denote the statement
A set Sn of n elements has 2n subsets.
CLAIM : P (n) = T
for all n 0 .
PROOF :
(i) P (0) = T
To do this write
Sn+1 = { s1 , s2 , , sn , sn+1 } = Sn {sn+1 } .
Now count the subsets of Sn+1 :
QED !
EXAMPLE :
Let P (n) denote the statement
3n < n!
CLAIM :
P (n) = T
230
(Check!)
PROOF :
i.e.,
3n < n!
(n 7) .
231
3n < n!
To do this :
3n+1 = 3 3n
< 3 n!
< (n + 1) n!
(since n 7)
= (n + 1)!
232
233
EXAMPLE :
Let
Hm
m
X
1
.
k
k=1
(Harmonic numbers.)
n
1 +
.
2
for all n Z+ .
PROOF :
(i) It is clear that P (1) = T , because
H21
2
X
1
k
k=1
234
1
= 1+ .
2
2n
n
1 +
.
2
n+1
.
1 +
2
235
To do this :
H2n+1 =
n+1
2X
k=1
1
k
2
X
1
+
k
k=1
1
k
n +2n
2X
1
k
k=2n +1
2
X
1
+
k
k=1
n+1
2X
k=2n +1
1
n
n
(1 + ) + 2 n
2
2 + 2n
1
n
(1 + ) +
2
2
n+1
1+
.
2
236
QED !
REMARK :
It follows that
X
1
k
k=1
diverges ,
i.e.,
n
X
1
k
k=1
as
237
n .
(a + b)n =
k=0
ank bk ,
where
n
k
n!
.
k! (n k)!
n
n
n
= an +
an1 b +
an2 b2 + +
abn1 + bn .
1
2
n1
238
PROOF :
The formula holds if n = 0 .
(Check!)
n
X
n
k=0
ank bk .
We must show that the formula is also valid for n + 1 , i.e., that
(a + b)n+1 =
n+1
X
n+1
k=0
239
an+1k bk .
n
X
n
k=0
= an+1 +
n
X
n
k=1
= an+1 +
n
X
n
k=1
n+1
= a
n+1
X
n+1
k=0
ank+1 bk +
n
X
k=1
n
X
n+1
k=1
n1
X
n
k=0
n n
X
n
k=1
= an+1 +
ank+1 bk +
n
k1
ank bk
n
k1
240
ank+1 bk + bn+1
o
ank+1 bk + bn+1
ank+1 bk + bn+1
an+1k bk .
QED !
REMARK :
In the proof we used the fact that
n!
n!
n
n
+
=
+
k
k1
k! (n k)!
(k 1)! (n k + 1)!
n! (n k + 1) + n! k
=
k! (n k + 1)!
(n + 1)!
=
k! (n k + 1)!
=
n+1
k
241
REMARK :
1
1
1
1
1
1
1
1
1
.
8
.
10
21
1
4
10
20
35
56
3
6
15
28
1
5
15
35
70
.
242
6
21
56
.
1
1
7
28
1
8
1
.
Observe that every entry can be obtained by summing the closest entries
in the preceding row.
1
1
n
k1
n
k
n+1
k
1
1
REMARKS :
244
EXAMPLE : For x R , x 6= 0, 1 :
n
X
1 xn+1
k
x =
,
n 0 ,
1x
k=0
( Geometric sum ) .
n
X
xk .
k=0
Then
Sn
x Sn
1 + x + x2 + + xn1 + xn ,
x + x2 + + xn1 + xn + xn+1 ,
so that
Sn x Sn = (1 x) Sn = 1 xn+1 ,
QED !
1xn+1
1x
1x(n+1)+1
1x
n+1
Sn+1 = Sn + x
1 xn+1
+ xn+1
=
1x
(1 xn+1 ) + xn+1 (1 x)
=
1x
1 xn+1 + xn+1 xn+2
=
1x
1 x(n+1)+1
QED !
.
=
1x
246
EXERCISE :
Use mathematical induction to prove that
21 | (4n+1 + 52n1 ) ,
whenever n is a positive integer.
EXERCISE :
The Fibonacci numbers are defined as: f1 = 1 , f2 = 1 , and
fn = fn1 + fn2 ,
Use a proof by induction to show that
3 | f4n ,
for all n 1 .
247
for n 3 .
: S { T , F } .
f1 = 1 ,
f2 = 1 ,
fn = fn1 + fn2 ,
249
for n 3 .
f1 = 1
f11 =
89
f21 = 10946
f2 = 1
f12 = 144
f22 = 17711
f3 = 2
f13 = 233
f23 = 28657
f4 = 3
f14 = 377
f24 = 46368
f5 = 5
f15 = 610
f25 = 75025
f6 = 8
f16 = 987
f26 = 121393
f7 = 13
f17 = 1597
f27 = 196418
f8 = 21
f18 = 2584
f28 = 317811
f9 = 34
f19 = 4181
f29 = 514229
f10 = 55
f20 = 6765
f30 = 832040
250
PROPERTY :
fn
i
h
n
1
1 5 n
1+ 5
2
2
5
251
fn
i
h
n
1
1 5 n
1+ 5
=
2
2
5
1
=
5
1 + 5 n h
1
5
1 + 5 n h
1
=
5
1 + 5 n h
1
5
1 + 5 n
1 5 n i
1
1+ 5
1
1 2.236 n i
1 + 2.236
1 + (1)n+1
252
n i
0.3819
f1 =
0.72361
f11 =
89
88.99775
f2 =
1.17082
f12 =
144
144.00139
f3 =
1.89443
f13 =
233
232.99914
f4 =
3.06525
f14 =
377
377.00053
f5 =
4.95967
f15 =
610
609.99967
f6 =
8.02492
f16 =
987
987.00020
f7 = 13
12.98460
f17 = 1597
1596.99987
f8 = 21
21.00952
f18 = 2584
2584.00008
f9 = 34
33.99412
f19 = 4181
4180.99995
f10 = 55
55.00364
f20 = 6765
6765.00003
253
fn =
1
5
h
n
1+ 5
2
n
1 5
2
h
1 5
1
1+ 5
= 1 .
2
2
5
i
h
1
1+ 5 2
1 5 2
2
2
5
254
5 = 1 .
5
(Check!)
fn1
h
1
1 5 n1 i
1 + 5 n1
2
2
5
and
fn
i
h
1
1 5 n
1+ 5 n
.
2
2
5
fn+1
h
1 5 n+1 i
1 + 5 n+1
1
2
2
5
255
fn1 + fn
(by definition)
i
h
n1
n1
n
1
1+ 5
1 5
1+ 5
1 5 n
2
2
2
2
5
i
h
1
1+ 5
1 5
1 5 n1
1 + 5 n1
1+
1+
2
2
2
2
5
i
h
n1
n1
3+ 5
1 5
3 5
1
1+ 5
2
2
2
2
5
i
h
n1
2
n1
1 5
1
1+ 5
1 5 2
1+ 5
2
2
2
2
5
h
1
1 + 5 n+1
1 5 n+1 i
=
.
QED !
2
2
5
256
f2 = 1 ,
for k 3 .
fk = fk1 + fk2 ,
or
z n z n1 z n2 = 0 ,
z2 z 1 = 0
1 1 + 4
z =
,
2
that is,
z1 =
1 +
2
z2 =
1
2
258
fn = c1 z1n + c2 z2n
The constants c1 and c2 are determined by the initial conditions :
f1 = 1
c1 z1 + c2 z2 = 1 ,
f2 = 1
c1 z12 + c2 z22 = 1 ,
and
that is,
1 5
1+ 5
+ c2
= 1,
c1
2
2
and
1 + 5 2
1 5 2
c1
+ c2
= 1,
2
2
from which we find
1
1
c1 =
and
c2 = .
(Check!)
5
5
259
fn = c1 z1n + c2 z2n
We found that
1 +
z1 =
2
1
z2 =
2
and
c1 =
and
c2 =
1
.
5
(Check!)
from which
fn =
1
1
1 + 5 n
1 5 n
.
2
2
5
5
260
REVIEW EXERCISES.
Problem 1.
Prove that the Fibonacci numbers satisfy the following relations:
Pn
k=1
261
n = 1, 2, 3, ,
known as the logistic equation, models population growth when there are
limited resources.
Write a small computer program (using real arithmetic) to see what
happens to the sequence xn , n = 1, 2, 3, , with 0 < x1 < 1 , for
each of the following values of c :
(a) 0.5
, (b) 1.5
, (c) 3.2
, (d) 3.5
, (e) 3.9
n = 1, 2, 3, ,
RELATIONS
EXAMPLE :
The operator relates elements of Z to elements of Z. e.g.,
2 5,
and
33,
but
Z Z {T , F } .
263
7 6 2 .
RECALL :
Let
A = {a1 , a2 , , anA } and B = {b1 , b2 , , bnB } .
The product set A B is the set of all ordered pairs from A and B.
More precisely,
A B {(a, b) : a A, b B} .
264
NOTE :
EXAMPLE :
If
A = {!, ?}
and
B = {, ,
},
then
A B = { (!, ) , (!, ) , (!, ) , (?, ) , (?, ) , (?, ) } .
265
DEFINITION :
A binary relation R from A to B is a subset of A B.
NOTATION :
If R A B, and
(a, b) R ,
266
EXAMPLE :
Let A = {1, 3} and B = {3, 5, 9}.
if and only if
a|b .
Then
1R3 , 1R5 , 1R9 , 3R3 , and 3R9 .
Thus
R = { (1, 3) , (1, 5) , (1, 9) , (3, 3) , (3, 9) } .
267
B
1
5
9
3
3
REMARK :
269
EXAMPLE :
Let
A = {1 , 2 , 3 , 4 , 5 , 6} ,
and let R denote the relation divides from A to A .
We say that R is a relation on A .
271
S
C
S oR
if and only if
272
b B : aRb bSc .
EXAMPLE :
Let
A = {1, 2, 3},
B = {2, 6},
if and only if
a|b ,
and
bSc
if and only if
b + c is prime .
Define
T = SR .
273
R
A
S
B
2
2
3
S oR = T
274
15
S : B C ,
T : C D .
PROPOSITION :
The composition of relations is associative, i.e.,
(T S) R = T (S R) .
R
A
S
B
T
D
ToS
S oR
To S oR
275
R
A
S
B
T
D
ToS
S oR
To S oR
(T S) R = T (S R) .
PROOF : Let a A and d D. Then
a(T S) Rd
b B : (aRb bT Sd)
b B, c C : (aRb bSc cT d)
c C, b B : (aRb bSc cT d)
c C : (aS Rc cT d)
aT (S R)d .
QED !
276
be defined by
A = { 2, 3, 4, 8, 9, 12 } ,
(a, b) R
if and only if
(a|b a 6= b) .
Then
R = { (2, 4) , (2, 8) , (2, 12) , (3, 9) , (3, 12) , (4, 8) , (4, 12) } ,
and
R2 R R = { (2, 8) , (2, 12) } ,
R3 R2 R = R R R = { } .
277
R
0
0
1
21
0
21
0
1
0
21
0
31
0
1
0
0
1
31
31
0
1
0
0
1
1
0
0
1
1
0
0
1
0
81
0
1
1
0
08
1
1
0
08
1
0
0
1
91
1
0
09
1
1
0
09
1
1
0
0
1
0
1
1
0
0 12
1
1
0
0 12
1
00
11
00
11
12
0
1
1
0
02
1
11
00
00
11
003
11
0
1
0
12 1
1
0
0
1
1
0
0
1
R2
R3
278
4
8
9
EXAMPLE :
Let R be the relation on the set of all real numbers defined by
xRy
if and only if
xy = 1
Then
xR2 z
y : xy = 1 and yz = 1
x = z and x 6= 0 .
279
(Why ?)
y : xy = 1 and yz = 1
PROOF : ()
if and only if
x = z and x 6= 0 .
1
y =
x
1
and y =
.
z
y : xy = 1 and yz = 1
if and only if
x = z and x 6= 0 .
()
Conversely, suppose x and z are real numbers with
x=z
and x 6= 0 .
Let y = 1/x.
Then xy = 1 and yz = 1.
QED !
281
Similarly
xR3 z
y : x = y and x 6= 0 and yz = 1
xz = 1
(Why ?)
Thus
R3 = R ,
R4 = R3 R
R5 = R4 R
=
=
R R = R2 ,
R2 R = R3
and so on
Thus we see that
Rn = R2
if n is even ,
Rn = R
if n is odd .
and
282
R,
EXAMPLE :
Let R be the relation on the real numbers defined by
xRy
if and only if
x2 + y 2 1 .
Then
xR2 z
y : x2 + y 2 1 and y 2 + z 2 1
x2 1 and z 2 1
| x | 1 and | z | 1 .
283
(Why ?)
z
1
R2
1
284
Similarly
xR3 z
y : | x | 1 and | y | 1 and y 2 + z 2 1
y : | x | 1 and y 2 + z 2 1
(Why ?)
| x | 1 and | z | 1
(Why ?)
Thus R3 = R2 .
285
Similarly
R4
R3 R
R2 R
R3
R2 ,
R5
R4 R
R2 R
R3
R2 ,
and so on
for all n 2 .
286
Rij =
0 if
1 if
(ai , bj ) 6 R ,
(ai , bj ) R .
287
EXAMPLE :
Reconsider the example where
A = {1, 2, 3},
B = {2, 6},
and
R
A
S
B
2
2
3
S oR = T
288
15
R
A
S
B
2
6
15
S oR = T
The relation matrices of R and S are
2
1 1
R = 2 1
3 0
6
1
1
1
and
289
1 9 15
2 1 1 1
S =
.
6 1 0 0
We found that
T = S R = { (1, 1) , (1, 9) , (1, 15) , (2, 1) , (2, 9) , (2, 15) , (3, 1) } .
R
A
S
B
2
2
3
S oR = T
290
15
R
A
B
2
2
3
15
S oR = T
1
R = 1
0
1
1 1 1
1
,
S =
.
1 0 0
1
1
T = 1
1
is
291
1 1
1 1 .
0 0
PROPOSITION :
Let A, B, and C be finite sets.
Let R be a relation from A to B.
Let S be a relation from B to C.
Let T = S R.
292
PROOF :
Tij = 1
ai T cj
PnB
[RS]ij 6= 0 .
=1
Ri Sj 6= 0
293
QED !
REMARK :
If we use Boolean arithmetic, then T = RS .
EXAMPLE :
The matrix product RS in the preceding example
1 1
2 1
1 1 1
1 1
= 2 1
1 0 0
0 1
1 0
Using Boolean arithmetic the matrix product is
1 1 1
T = 1 1 1 .
1 0 0
294
is
1
1 .
0
if and only if
aRb,
if and only if
(a, b) R .
EXAMPLE :
A
a
2
b
Here
and
1 1
R = 1 0,
0 1
R1 =
296
1 1 0
1 0 1
Note that
R1 = RT
(transpose) .
B = {b1 , b2 , , bnB } ,
297
defined by
A = {1, 2, 3, 4},
a1 Ra2
if and only if a1 a2 .
if and only if a1 + a2 = 5 .
i .e., a A : aRa ,
R is symmetric if
a, b A : aRb bRa ,
or, equivalently,
aRb bRa ,
i.e., if the relation matrix (for finite A) is symmetric :
i, j : Rij = Rji .
EXAMPLES :
The relation on the real numbers defined by
xRy
is symmetric.
if and only if x2 + y 2 1 ,
R is transitive if
Rk = R
k=1
in Boolean arithmetic
EXAMPLES :
The divides relation on Z+ is transitive.
The relation on Z is transitive.
The relation on a power set 2S is transitive.
The relation aRb a + b is prime on Z+ is not transitive.
302
()
EXAMPLE :
The following relation on Z is an equivalence relation :
aRb
if and only if
(Here m 2 is fixed.)
304
a mod m = b mod m .
305
306
Equivalence classes.
Let A be a set and let R be an equivalence relation on A .
Let a1 A.
Define
[a1 ] = {a A : aRa1 } ,
that is
[a1 ] =
307
EXAMPLE :
Let R be the relation congruence modulo 3 on Z+ , i.e.,
aRb
if and only if
a mod 3 = b mod 3 .
For example
1R1 , 1R4 , 1R7 , 1R10 , ,
2R2 , 2R5 , 2R8 , 2R11 , ,
3R3 , 3R6 , 3R9 , 3R12 , .
308
Thus
[1] = { 1 , 4 , 7 , 10 , 13 , } ,
[2] = { 2 , 5 , 8 , 11 , 14 , } ,
[3] = { 3 , 6 , 9 , 12 , 15 , } .
We see that
Z+ = [1] [2] [3] .
The relation R has partitioned Z+ into the subsets [1] , [2] , [3] .
Any member of a subset can represent the subset, e.g.,
[11] = [2] .
309
EXAMPLE :
Define a relation R on Z Z by
(a1 , b1 )R(a2 , b2 )
if and only if
a1 b1 = a2 b2 .
(a1 , b1 )R(a2 , b2 )
if and only if
a1 b1 = a2 b2
R is an equivalence relation :
R is reflexive : (a, b)R(a, b) ,
R is symmetric : (a1 , b1 )R(a2 , b2 ) (a2 , b2 )R(a1 , b1 ) ,
R is transitive:
(a1 , b1 )R(a2 , b2 ) (a2 , b2 )R(a3 , b3 ) (a1 , b1 )R(a3 , b3 ) .
.
311
(a1 , b1 )R(a2 , b2 )
if and only if
a1 b1 = a2 b2
k= Ak .
312
A 3
A 2
A 1
A0
A1
A
A3
313
DEFINITION :
The reflexive closure of R is the smallest relation containing R that
is reflexive.
314
EXAMPLE :
Let A = {1, 2, 3, 4} , and let R be the relation on A defined by
R = { (1, 4) , (2, 1) , (2, 2) , (3, 2) , (4, 1) } .
Then R is not reflexive, not symmetric, and not transitive :
00
00
11
111
00
11
11
00
00
11
00
11
11
00
00
11
00
11
11
00
00
11
00
11
315
1 1010
1
0
0
1
0
1
1
0
0
1
1
0
0
1
316
00
00
11
111
00
11
11
00
00
11
00
11
11
00
00
11
11
00
00
11
317
00
00
11
111
00
11
11
00
00
11
00
11
11
00
00
11
11
00
00
11
318
00
00
11
111
00
11
11
00
00
11
00
11
11
00
00
11
11
00
00
11
319
00
00
11
111
00
11
11
00
00
11
00
11
11
00
00
11
11
00
00
11
320
00
111
00
11
1
0
0
1
11
00
00
11
00
11
1
0
0
1
0
1
321
PROOF :
Later
n
X
Rk
k=1
1 1010
1
0
0
1
0
1
1
0
0
1
1
0
0
1
0
1
R =
0
1
0
1
1
0
323
0
0
0
0
1
0
.
0
0
R2
0
1
= R R =
0
1
R3 = R R2
R4 = R R3
0
1
1
0
0
0
0
0
1
0 0 0
0
1 1 0
0 0 1 0
0
1 0 0
1
1 0
0
= 1 1
1 1
0
0
0 0
0
0
0
0
0
1
,
0
1
0
1
1
0
0
0
0
0
1
1 0
0
1 1
0 1 1
0
0 0
0
0
0
0
0
1
0
1
0
1
1
0
0
0
0
0
1
1
,
1
0
0
1
1
0
0
0
0
0
1
0
0
0
0
0
0
0
1
1 0
1
= 1 1
1 1
1
0
0 0
0
0
0
0
0
1
.
1
1
0
1
=
0
1
0
1
=
0
1
0
1
1
1
324
0
1
1
0
0
1
=
1
1
Therefore
4
X
Rk
= R + R2 + R3 + R4
k=1
0
1
0
1
0
1
1
0
0
0
0
0
1
1 0
0
+ 1 1
1 1
0
0
0 0
0
0
0
0
0
0 0
1
+ 1 1
1 1
0
1
1 0
1
1
1
1
0
1
1
0
325
0
0
0
0
0
0
0
0
1
1
.
1
1
1
1 0
1
+ 1 1
1 1
1
0
0 0
0
0
0
0
0
1
1
1
00
111
00
11
1
0
0
1
11
00
00
11
1
0
0
1
4
X
Rk =
k=1
326
1
1
1
1
0
1
1
0
0
0
0
0
1
1
.
1
1
if and only if
xy = 1 .
and
if and only if x = y x 6= 0 ,
R = R3 = R5 =
R2 = R4 = R6 =
if and only if
xy = 1 (x = y x 6= 0) .
327
if and only if
x2 + y 2 1 .
if and only if
and
|x| 1
Rn = R2 ,
|y| 1,
for n 2 .
if and only if
x2 + y 2 1 ( | x | 1 | y | 1 ) ,
that is,
xR y
if and only if
|x| 1
328
|y| 1.
(Why ?)
if and only if x2 + y 2 = 1 .
(Be careful!)
What is R3 ?
What is the transitive closure of R ?
329
if and only if xy 1 .
if and only if x2 y .
xRy
if and only if x2 y
Then
xR2 z
Similarly
xR3 z
y : x4 y and y 2 z
x8 z .
xR z
2n
x
332
z.
We see that
333
R
.
k=1
Rn+1 = Rn R ,
n = 1, 2, 3, .
Rn R = R Rn
PROPERTY 2 :
R symmetric Rn is symmetric
PROPERTY 1 :
Rn R = R Rn ,
for all n Z+
Rn+1 R = R Rn+1 .
To do this :
Rn+1 R
= (Rn R) R
(by definition)
= (R Rn ) R
(by definition).
336
QED !
PROPERTY 2 :
R symmetric Rn is symmetric
aRn Rb
p(aRp pRn b)
p(pRa bRn p)
p(bRn p pRa)
bR Rn a
bRn Ra
(by Property 1)
bRn+1 a
337
QED !
R transitive Rn is transitive
PROOF :
Let R be transitive.
Obviously R1 is transitive.
By induction assume that Rn is transitive for some n Z+ .
We must show that Rn+1 is transitive, i.e., we must show that
aRn+1 b bRn+1 c aRn+1 c .
338
aRn Rb bRn Rc
(power)
aRn Rb bR Rn c
(by Property 1)
(p, q: composition)
(inductive assumption)
aRn Rq qRc
(composition)
aR Rn q qRc
(by Property 1)
339
continuation of proof
aR Rn q qRc
(s: composition)
aRn s sRc
(since R is transitive)
aR Rn c
(composition)
aRn Rc
(by Property 1)
aRn+1 c
(power)
340
QED !
R S Rn S n
PROPERTY 4 :
To do this :
Suppose that (x, z) Rn+1 .
QED !
341
S is transitive
() S is transitive
n Z+ : S n S
By induction :
Clearly S n S if n = 1 .
343
Show S n+1 S
and
(y, z) S n .
QED !
THEOREM :
The transitive closure R of a relation R is given by
k
R =
R
.
k=1
k
PROOF : Let U =
R
.
k=1
U is transitive.
(2)
If so, then R = U .
345
R
k=1
and (y, z) Rn ,
for some m, n Z+ .
By definition of composition
(x, z) Rn+m .
Thus, using again, it follows that
(x, z) U .
346
(2)
R
k=1
U S .
R
U
S
347
R
k=1
R S Rn S n
S is transitive
To do:
n Z+ : S n S
Let (x, y) U .
Property 4
Show U S
Then, by we have
(x, y) Rn
for some n Z+ .
By Property 4 :
(x, y) S n .
By Property 5 :
(x, y) S .
348
QED !
Property 5
REVIEW PROBLEMS
and
349
Review Problem 1.
n5 n 0 (mod 30)
350
Review Problem 2.
351
: A B ,
352
Review Problem 4.
a b(mod m)
and
then
gcd(a, m) = gcd(b, m) .
353
Review Problem 5.
Use mathematical induction to prove that
21 | (4n+1 + 52n1 ) ,
whenever n is a positive integer.
354
Review Problem 6.
The Fibonacci numbers are defined as: f1 = 1 , f2 = 1 , and
fn = fn1 + fn2 ,
for n 3 .
355
Review Problem 7.
Let A and B be non-empty sets.
Let f be a 1 1 function from A to B .
Suppose S is an partial order on B .
Define a relation R on A as follows:
a1 , a2 R
a1 Ra2
356