Lecture Notes On Discrete Mathematics: Eusebius Doedel
Lecture Notes On Discrete Mathematics: Eusebius Doedel
on
DISCRETE MATHEMATICS
Eusebius Doedel
LOGIC
EXAMPLES :
1
A function (or “map”, or “operator”) is a rule that associates to every
element of a set one element in another set.
EXAMPLES :
a 7→ 2, b 7→ 1, c 7→ 2,
f : S1 −→ S2 .
2
EXAMPLE :
Let Pn denoet the infinite set of all polynomial functions p(x) of degree
n or less with integer coefficients.
D : x3 + 2x + 1 7→ 3x2 + 2 ,
i.e.,
D(x3 + 2x + 1) = 3x2 + 2 .
3
EXAMPLE :
f (x, y) = x + y ,
We write
f : Z+ × Z+ −→ Z+ .
4
Basic logical operators.
∧ (“and” , “conjunction”)
∨ (“or” , “disjunction”)
¬ (“not” , “negation”)
p q p∨q p q p∧q
p ¬p T T T T T T
T F T F T T F F
F T F T T F T F
F F F F F F
5
Let B ≡ {T , F }. Then we can view ¬, ∨, and ∧, as functions
¬ : B −→ B, ∨ : B × B −→ B , ∧ : B × B −→ B .
− : Z −→ Z, + : Z × Z −→ Z, ∗ : Z × Z −→ Z,
x −x
· ·
-2 2
-1 1
0 0
1 -1
2 -2
· ·
6
Logical expressions.
P : B × B × · · · × B −→ B .
For example,
Here
P1 : B × B −→ B ,
and
P2 : B × B × B −→ B .
7
The values of a logical expression can be listed in a truth table .
EXAMPLE :
p q ¬q p ∨ (¬q)
T T F T
T F T T
F T F F
F F T T
8
Analogously, arithmetic expressions such as
A1 : R × R −→ R, and A2 : R × R × R −→ R ,
or, equivalently,
A1 : R2 −→ R, and A2 : R3 −→ R .
9
Two propositions are equivalent if they always have the same values.
EXAMPLE :
¬(p ∨ q) is equivalent to ¬p ∧ ¬q ,
p q p∨q ¬(p ∨ q) ¬p ¬q ¬p ∧ ¬q
T T T F F F F
T F T F F T F
F T T F T F F
F F F T T T T
10
NOTE :
In arithmetic
11
The three basic logical operators ¬ , ∨ , and ∧ , are all we need.
⊕ “exclusive or”
→ “conditional” , “if then”
↔ “biconditional” , “if and only if” , “iff”
defined as :
p q p⊕q p→q p↔q
T T F T T
T F T F F
F T T T F
F F F T T
12
EXAMPLE :
13
Let p denote “P did it” and let q denote “Q did it”.
Then p and q are logical variables.
Our problem is to find for what values of p and q this is the case.
14
As an analogy from arithmetic, consider the problem of finding the values
of x and y in Z so that
x2 + y = 5 , x+y =3 .
15
For the “crime problem” we have the truth table
p q ¬ p ∨ q → (p ∧q) ∧ q ∨ (p ∧ q)
T T F T T T F T T
T F F T T F F F F
F T T F F F T T F
F F F T T F F F F
(1) (2) (6) (5) (4) (3) (9) (8) (7)
The order of evaluation has been indicated at the bottom of the table.
16
EXERCISE :
(It must have precisely the same values as listed in column “(9)”.)
17
EXERCISE :
18
EXERCISE :
(p ∧ (¬(¬p ∨ q))) ∨ (p ∧ q) .
19
A contradiction is a logical expression whose value is always False .
For example p ∧ ¬p is a contradiction :
p ¬p p ∧ ¬p
T F F
F T F
20
EXERCISE :
(p → q) ∧ p → q ,
(p → q) ∧ ¬q → ¬p .
21
NOTATION :
(p → q) ∧ p ⇒ q , (”modus ponens”) ,
(p → q) ∧ ¬q ⇒ ¬p , (”modus tollens”) .
22
As another example we show that
(p → q) ∧ (¬p → r) ∧ (q → r) → r
is a tautology.
p q r (p → q) ∧ (¬p → r) ∧ (q → r) → r
T T T T T F T T T T T
T T F T T F T F F T F
T F T F F F T F T T T
T F F F F F T F T T F
F T T T T T T T T T T
F T F T F T F F F T F
F F T T T T T T T T T
F F F T F T F F T T F
(1) (2) (3) (5) (9) (6) (7) (10) (8) (11) (4)
The last column (11) consist of True values only. Therefore we can write
(p → q) ∧ (¬p → r) ∧ (q → r) ⇒ r
P (p, q, r) ⇐⇒ (p → q) ∧ (¬p → r) ∧ (q → r) .
24
So suppose that P (p, q, r) is True , while r is False .
So indeed, not all three, (a), (b), and (c) can have value True .
25
NOTE :
26
EXERCISE :
(p → q) ∧ p ⇒ q ,
(p → q) ∧ ¬q ⇒ ¬p .
27
EXERCISE :
(p → q) ∧ p ⇒ q ,
(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 :
P1 (p, q, · · ·) ↔ P2 (p, q, · · ·)
is a tautology.
P1 (p, q, · · ·) ⇐⇒ P2 (p, q, · · ·) .
29
EXAMPLE :
¬(p ∧ q) is equivalent to ¬p ∨ ¬q ,
i.e.,
p q ¬ (p ∧ q) ↔ (¬p ∨ ¬q)
T T F T T F F F
T F T F T F T T
F T T F T T T F
F F T F T T T T
30
The operators
⊕ , → , and ↔ ,
¬ , ∧ , and ∨ ,
as verified below :
p q (p ⊕ q) ↔ (p ∨ q) ∧ ¬ (p ∧ q)
T T F T T F F T
T F T T T T T F
F T T T T T T F
F F F T F F T F
31
p q (p → q) ↔ (q ∨ ¬p)
T T T T T F
T F F T F F
F T T T T T
F F T T T T
p q (p ↔ q) ↔ (q ∨ ¬p) ∧(p ∨ ¬q)
T T T T T T T F
T F F T F F T T
F T F T T F F F
F F T T T T T T
32
Thus we can write
p ⊕ q ⇐⇒ (p ∨ q) ∧ ¬(p ∧ q) ,
p → q ⇐⇒ q ∨ ¬p ,
p ↔ q ⇐⇒ (q ∨ ¬p) ∧ (p ∨ ¬q) .
p ↔ q ⇐⇒ (p → q) ∧ (q → p) .
33
Basic logical equivalences.
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
Some useful additional laws are :
¬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
35
Some more laws are :
(p ∨ q) ∨ r ⇐⇒ p ∨ (q ∨ r) (p ∧ q) ∧ r ⇐⇒ p ∧ (q ∧ r) associative law
p → q ⇐⇒ ¬q → ¬p contrapositive
36
• All laws of logic can in principle be proved using truth tables.
37
EXAMPLE : Proof of the idempotent law
p ∨ p ⇐⇒ p
⇐⇒ (p ∨ p) ∧ T complement law
38
NOTE :
39
Simplification of logical expressions.
x3 + 3x2 y + 3xy 2 + y 3
is equivalent to
(x + y)3 .
40
EXAMPLE : Reconsider the logical expression
¬ p ∨ q → (p ∧ q) ∧ q ∨ (p ∧ q)
p q ¬p ¬p ∧ q
T T F F
T F F F
F T T T
F F T F
41
One way to simplify a logical expression is by using
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 :
(p ∧ (¬(¬p ∨ q))) ∨ (p ∧ q) .
EXERCISE :
45
EXERCISE :
(p → q) ∧ (¬p → r) ∧ (q → r) → r ,
(p → q) ∧ (¬p → r) ∧ (q → r) ⇒ r .
46
Predicate Calculus.
Let S be a set.
P : S −→ {T , F } ,
or
P : S × S × · · · × S −→ {T , F } .
or
P : S1 × S2 × · · · × Sn −→ {T , F } .
47
EXAMPLE : Let Z+ denote the set of all positive integers.
Define
P : Z+ −→ {T , F }
by
P (x) = T if x ∈ Z+ is even ,
P (x) = F if x ∈ Z+ is odd .
“x is an even integer”,
48
EXAMPLE :
P (x) ⇐⇒ x ∈ S .
Then
P : U −→ {T , F } .
49
EXAMPLE :
P (x, y) ⇐⇒ x + y = 5 .
P : Z+ × Z+ −→ {T , F } .
50
Quantifiers.
∀, ∃, and ∃!
Then we define :
51
If it is clear from the context what S is, then one often simply writes
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
Let S be a set and
P : S × S −→ {T , F } .
Then
∀x, y P (x, y) and ∀x∀y P (x, y)
both mean
∀x ∀yP (x, y) .
53
Similarly,
both mean
∃x ∃yP (x, y) .
54
EXAMPLE :
Let
P : S × S −→ {T , F } ,
where
S = {1, 2} .
Then
while
55
EXERCISE : Let
P : Z × Z −→ {T , F } ,
“ x + y = 5 ”.
∀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 } ,
∀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
EXERCISE : ( see preceding example · · · ):
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
P, Q : S −→ {T , F } ,
where
S = {1, 2} ,
then
∃x P (x) ∧ Q(x) ⇐⇒ P (1) ∧ Q(1) ∨ P (2) ∧ Q(2) .
EXAMPLE : If again
P, Q : S −→ {T , F } ,
and
S = {1, 2} ,
then
∀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) ⇐⇒
6 ∀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” .
61
EXERCISE :
Show that
∃xP (x) ∧ ∃xQ(x) 6
⇐⇒ ∃x P (x) ∧ Q(x)
by giving an example where LHS and RHS have a different logical value.
62
Some equivalences (Valid for any propositions P and Q) :
(1) ¬ ∃xP (x) ⇐⇒ ∀x ¬P (x)
(2) ∀xP (x) ∧ ∀xQ(x) ⇐⇒ ∀x P (x) ∧ Q(x)
(3) ∀xP (x) ∧ ∀xQ(x) ⇐⇒ ∀x∀y P (x) ∧ Q(y)
(4) ∀xP (x) ∨ ∀xQ(x) ⇐⇒ ∀x∀y P (x) ∨ Q(y)
63
EXAMPLE : Proof of Equivalence (1) when the set S is finite .
¬ ∃xP (x) ⇐⇒ ¬ P (x1 ) ∨ P (x2 ) ∨ · · · ∨ P (xn )
⇐⇒ ¬ P (x1 ) ∨ P (x2 ) ∨ · · · ∨ P (xn )
⇐⇒ ¬P (x1 ) ∧ ¬ P (x2 ) ∨ · · · ∨ P (xn )
⇐⇒ ···
⇐⇒ ∀x¬P (x)
64
EXERCISES :
• Prove Equivalence 2 :
∀xP (x) ∧ ∀xQ(x) ⇐⇒ ∀x P (x) ∧ Q(x)
• Prove Equivalence 3 :
∀xP (x) ∧ ∀xQ(x) ⇐⇒ ∀x∀y P (x) ∧ Q(y)
65
EXAMPLE : Proof of Equivalence (4) .
∀xP (x) ∨ ∀xQ(x) ⇐⇒ ∀x∀y P (x) ∨ Q(y)
or equivalently
66
PROOF :
(i) ∀xP (x) ∨ ∀xQ(x) ⇒ ∀x∀y P (x) ∨ Q(y)
h i
(ii) ¬ ∀xP (x) ∨ ∀xQ(x) ⇒ ¬∀x∀y P (x) ∨ Q(y)
can be rewritten as
∃x¬P (x) ∧ ∃x¬Q(x) ⇒ ∃x∃y ¬P (x) ∧ ¬Q(y)
67
EXERCISE :
∀xP (x) ∧ ∃xQ(x) ⇐⇒ ∀x∃y P (x) ∧ Q(y)
Hint : This proof can be done along the lines of the preceding proof.
68
More equivalences (Valid for any propositions P and Q) :
(5) ¬ ∀xP (x) ⇐⇒ ∃x¬P (x)
(6) ∃xP (x) ∨ ∃xQ(x) ⇐⇒ ∃x P (x) ∨ Q(x)
(7) ∃xP (x) ∨ ∃xQ(x) ⇐⇒ ∃x∃y P (x) ∨ Q(y)
(8) ∃xP (x) ∧ ∃xQ(x) ⇐⇒ ∃x∃y P (x) ∧ Q(y)
69
Equivalences (5)-(8) follow from
• replacing P by ¬P and Q by ¬Q ..
70
EXAMPLE : Proof of Equivalence (6), using Equivalence (2)
(2) ∀xP (x) ∧ ∀xQ(x) ⇐⇒ ∀x P (x) ∧ Q(x)
¬ ∀xP (x) ∧ ∀xQ(x) ⇐⇒ ¬∀x P (x) ∧ Q(x)
∃x¬P (x) ∨ ∃x¬Q(x) ⇐⇒ ∃x ¬P (x) ∨ ¬Q(x)
(6) ∃xP (x) ∨ ∃xQ(x) ⇐⇒ ∃x P (x) ∨ Q(x)
71
EXERCISE :
72
EXAMPLE (of negating a logical expression) :
¬∃x∀y∀zP (x, y, z) ⇐⇒ ∀x¬ ∀y ∀zP (x, y, z)
⇐⇒ ∀x∃y¬ ∀zP (x, y, z)
⇐⇒ ∀x∃y∃z¬P (x, y, z)
73
EXAMPLE (of transforming a logical expression) :
∃x P (x) → Q(x) ⇐⇒ ∃x ¬P (x) ∨ Q(x)
⇐⇒ ∃x¬P (x) ∨ ∃xQ(x) ⋆
⇐⇒ ¬∀xP (x) ∨ ∃xQ(x)
⇐⇒ ∀xP (x) → ∃xQ(x)
74
EXAMPLE : (from Rosen’s book: in detail)
Let
O(x) ,, “x is an officer”
75
Statement logic equivalent
Ducks never waltz ¬∃x D(x) ∧ W (x) ∀x (D(x) → ¬W (x)
Officers always waltz ¬∃x (O(x) ∧ ¬W (x) ∀x (O(x) → W (x)
All my poultry are ducks ∀x (D(x) ∨ ¬P (x) ∀x (P (x) → D(x)
My poultry are not officers ∀x¬ O(x) ∧ P (x) ∀x (P (x) → ¬O(x)
76
Do the first three statements imply the last one, i.e., is
h 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))
⇒ ∀x(P (x) → ¬O(x))
77
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)
If, for arbitrary z, P (z) is True then, using (1,2,3), ¬O(z) is True .
78
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)
79
EXERCISE (from Rosen):
80
REVIEW EXERCISES.
81
Problem 5. Verify the following basic tautologies, which are known as
“laws of inference”, and which are useful in proofs:
Tautology Name
82
Problem 6. Express the following statements in predicate logic:
NOTE :
83
Problem 7.
x2 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+ .
85
Problem 9.
Give an example that shows that
∀x∃yP (x, y) ⇐⇒
6 ∃y∀xP (x, y) .
Problem 10.
Prove that
Problem 11.
Prove that
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+ .)
88
Direct proofs.
“ if P then Q ”
i.e.,
P ⇒ Q,
or, more often,
∀x P (x) → Q(x) ,
89
PROPOSITION : If n ∈ Z+ is odd then n2 is odd.
REMARK :
This proposition is of the form P ⇒ Q or, more specifically,
∀n ∈ Z+ : P (n) → Q(n) ,
P, Q : Z+ −→ {T , F } ,
namely,
90
If n ∈ Z+ is odd then n2 is odd.
PROOF :
By computation we find
91
PROPOSITION : If n ∈ Z+ is odd then 8 | (n − 1)(n + 1) .
By computation we find
Clearly
4 | 4k(k + 1) .
Note, however, that either k is even or k + 1 is even, i.e.,
2|k or 2 | (k + 1) .
Thus
8 | 4k(k + 1) . QED !
92
LEMMA (Needed in the following example · · ·) For x ∈ R , x 6= 0, 1 :
n
X 1 − xn+1
xk = , ∀n ≥ 0 , ( Geometric sum ) .
k=0
1−x
Let n
X
Sn = xk .
k=0
Then
Sn = 1 + x + x2 + · · · + xn−1 + xn ,
x · Sn = x + x2 + · · · + xn−1 + xn + xn+1 ,
so that
Sn − x · Sn = (1 − x) · Sn = 1 − xn+1 ,
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 :
94
PROPOSITION : Let m ∈ Z+ , m > 1.
95
The sum is then
m−1 m−2
X
k m
X
k 1 − 2m m 1 − 2m−1
2 + (2 − 1) 2 = + (2 − 1)
k=0 k=0
1−2 1−2
= (2m − 1) (1 + 2m−1 − 1)
96
Proving the contrapositive.
p→q ⇐⇒ ¬q → ¬p .
EXAMPLE :
The statement
i.e., it is equivalent to
n odd ⇒ n2 odd .
97
This equivalence justifies the following :
If we must prove
P ⇒ Q,
¬Q ⇒ ¬P .
98
PROPOSITION : Let n ∈ Z+ , with n ≥ 2.
99
Some specific contrapositives.
(p ∧ q) → r ⇐⇒ ¬r → (¬p ∨ ¬q)
(p ∨ q) → r ⇐⇒ ¬r → (¬p ∧ ¬q)
∀xP (x) → q ⇐⇒ ¬q → ∃x¬P (x)
∃xP (x) → q ⇐⇒ ¬q → ∀x¬P (x)
p → ∀xQ(x) ⇐⇒ ∃x¬Q(x) → ¬p
p → ∃xQ(x) ⇐⇒ ∀x¬Q(x) → ¬p
100
PROPOSITION : Let n ∈ Z+ , with n ≥ 2.
101
PROPOSITION : Let n ∈ Z+ . Then
5|n2 ⇒ 5|n ,
102
Proof by contradiction.
• assume P = T and Q = F ,
(a “contradiction”).
103
PROPOSITION :
PROOF :
104
√ + m
√
PROPOSITION : 2 is irrational, i.e., if m, n ∈ Z then n
6= 2.
+ m
√
PROOF : Suppose m, n ∈ Z and n = 2.
We may assume m and n are relatively prime (cancel common factors).
√
Then m = 2n ⇒ m2 = 2n2 *
⇒ m2 even
⇒ m even (proved earlier)
⇒ ∃k ∈ Z+ (m = 2k)
⇒ 2n2 = m2 = (2k)2 = 4k2 (using * above)
⇒ n2 = 2k2
⇒ n2 even
⇒ n even
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 state-
ment is implied by the preceding statement(s).
105
EXERCISE :
(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
PROOF : (by contradiction)
1 + 2 + 3 + · · · + 10 = 55 .
108
Proof by cases (another example) :
6 | n(n + 1)(n + 2) .
For some k ∈ Z+ , k ≥ 0 :
n = 3k : Then 3|n ,
n = 3k + 1 : Then 3|(n + 2) ,
n = 3k + 2 : Then 3|(n + 1) .
QED !
109
FACT : Any real number x can be uniquely written as
x = n + r,
where
n ∈ Z and r ∈ R , with 0 ≤ r < 1 .
110
⌊2x⌋ = ⌊x⌋ + ⌊x + 21 ⌋ , x = n + r , 0 ≤ r < 1
PROOF :
1
Case 1 : 0 ≤ r < 2
: Then
1 1
0 ≤ 2r < 1 and ≤ r+ < 1.
2 2
RHS : ⌊x⌋ = ⌊n + r⌋ = n
1 1
⌊x + ⌋ = ⌊n + r + ⌋ = n
2 2
111
⌊2x⌋ = ⌊x⌋ + ⌊x + 21 ⌋ , x = n + r , 0 ≤ r < 1
PROOF : (continued · · · )
1
Case 2 : 2
≤ r < 1 : Then
1 1
1 ≤ 2r < 2 and 1 ≤ r+ < 1 + .
2 2
RHS : ⌊x⌋ = ⌊n + r⌋ = n
1 1
⌊x + ⌋ = ⌊n + r + ⌋ = n + 1
2 2
112
Existence proofs.
113
EXAMPLE : For any positive integer n there exists a sequence
of n consecutive composite integers , i.e.,
∀n ∈ Z+ ∃m ∈ Z+ : m + i is composite , i = 1, · · · , n .
For example,
114
∀n ∈ Z+ ∃m ∈ Z+ : m + i is composite , i = 1, · · · , n .
PROOF :
Let m = (n + 1)! + 1.
115
PROPOSITION : There are infinitely many prime numbers.
116
PROOF :
p1 , p2 , · · · , pn .
Let
N = p1 p2 · · · pn + 1
117
NOTE :
118
NOTE :
¬∃x, y, z, n ∈ Z+ , n ≥ 3 : xn + y n = z n .
119
NOTE :
“Every even integer greater than 2 is the sum of two prime numbers”.
120
REVIEW EXERCISES.
121
Problem 3. Let n be an integer. Show that
3|n2 ⇒ 3|n ,
The sum of the squares of any two rational numbers is a rational number.
122
Problem 5.
123
FACT : Any real number x can be uniquely written as
x = n − r,
where
n ∈ Z and r ∈ R , with 0 ≤ r < 1 .
Problem 7.
Is the following equality valid for all positive integers n and m ?
n+m n m
⌊ ⌋ = ⌈ ⌉ + ⌊ ⌋.
2 2 2
124
SET THEORY
Basic definitions.
125
Let A , B , and C be sets.
x∈
/A ⇐⇒ ¬(x ∈ A)
A⊆B ⇐⇒ ∀x ∈ U : x ∈ A ⇒ x ∈ B subset
A=B ⇐⇒ (A ⊆ B) ∧ (B ⊆ A) equality
126
The following are set-valued :
A∪B ≡ { x ∈ U : (x ∈ A) ∨ (x ∈ B) } union
A∩B ≡ { x ∈ U : (x ∈ A) ∧ (x ∈ B) } intersection
Ā ≡ {x∈U : x∈
/A} complement
A−B ≡ { x ∈ U : (x ∈ A) ∧ (x ∈
/ B) } difference
127
Venn diagram.
This is a useful visual aid for proving set theoretic identities.
(A ∩ B) − C = A ∩ (B − C)
C C
A B A B
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 :
A − (B ∪ C) = (A − B) ∩ (A − C)
C C
A B A B
130
The actual proof of the identity is as follows :
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 ∧ x∈A ∧ x∈
/C commut.+assoc.
⇐⇒ x ∈ (A − B) ∧ x ∈ (A − C)
⇐⇒ x ∈ (A − B) ∩ (A − C)
131
EXAMPLE : A ∩ B = A ∪ B ⇒ A=B
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.
132
Subsets.
133
EXAMPLE :
Let
U = {1 , 2 , 3} .
Then
n o
P (U ) = {}, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3} .
134
Basic set theoretic identities :
A ∪ (B ∩ C) = A ∩ (B ∪ C) =
(A ∪ B) ∩ (A ∪ C) (A ∩ B) ∪ (A ∩ C) distributive laws
A ∪ Ā = U A ∩ Ā = ∅ complement laws
135
Some additional identities :
Ū = ∅ ∅¯ = U
A ∪ (A ∩ B) = A A ∩ (A ∪ B) = A absorption laws
136
Some more identities :
(A ∪ B) ∪ C = (A ∩ B) ∩ C =
A ∪ (B ∪ C) A ∩ (B ∩ C) associative law
A ∪ B = Ā ∩ B̄ A ∩ B = Ā ∪ B̄ de Morgan’s laws
¯ =A
Ā involution law
All the preceding identities can be proved using the definitions of set
theory and the laws of logic.
137
NOTE : One can also proceed axiomatically by only assuming :
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 :
(A ∪ A) ∩ U complement law
139
EXAMPLE :
A ∪ (A ∩ B) = A
∀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
a(x) ⇐⇒ x ∈ A , b(x) ⇐⇒ x ∈ B .
a ∨ (a ∧ b) ⇐⇒ a .
141
REVIEW EXERCISES.
(1) A ∩ (B ∪ A) = A
(2) A ∪ (B ∩ C) = (A ∪ B) ∩ C
(3) (A ∩ B) ∪ (C ∩ D) = (A ∩ D) ∪ (C ∩ B)
(4) (A ∩ B) ∪ (A ∩ B̄) = A
(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
Then f is called
a function from A to B
We write
f : A −→ B
143
We say that f is :
iff f (A) = B
144
EXAMPLE :
Let
A = {a, b, c} , B = {1, 2} ,
f : a 7→ 1 , f : b 7→ 2 , f : c 7→ 1 .
2
c
145
EXAMPLE :
Let
A = {a, b} , B = {1, 2, 3} ,
f : a 7→ 1 , f : b 7→ 3 .
2
b
3
146
EXAMPLE :
f : Z+ −→ Z+
be defined by
n(n + 1)
f : n 7→ ,
2
i.e.,
n(n + 1)
f (n) = .
2
147
f (n) ≡ n(n + 1)/2
Here
f (Z+ ) = { 1 , 3 , 6 , 10 , 15 , 21 , · · · } ,
148
(2) f is one-to-one : Assume that f (n1 ) = f (n2 ).
⇐⇒ n21 + n1 = n22 + n2
⇐⇒ n1 = n2 or n1 + n2 = − 1
149
EXAMPLE :
Define
f : Z × Z −→ Z × Z
or equivalently
f : Z2 −→ Z2
by
f (m, n) = (m + n , m − n) ,
150
PROOF :
(i) One-to-one :
Suppose
f (m1 , n1 ) = f (m2 , n2 ) .
Then
(m1 + n1 , m1 − n1 ) = (m2 + n2 , m2 − n2 ) ,
i.e.,
m1 + n1 = m2 + n2 ,
and
m1 − n1 = m2 − n2 .
151
(ii) Not onto :
Let (s, d) ∈ Z2 be arbitrary. Can we solve
f (m, n) = (s, d) ,
152
Given two functions
f : A −→ B and g : B −→ C ,
go f
f g
a f(a) g(f(a))
A B C
153
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
• Let h2 (n) ≡ g f (n) . Then
• Let h3 (n) ≡ g g(n) . Then
154
Inverses. Let
f : A −→ B ,
and
g : B −→ A .
f is invertible ,
and we write f −1 for g .
155
EXAMPLE :
• f is one-to-one :
• f is onto :
Easy: n = m + 1 !
156
f (n) = n − 1 , f : Z −→ Z
f −1 (m) = m + 1 .
Check :
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 :
• f is one-to-one :
• f is onto :
Easy: x = (1 − y)/2 !
1−y
( We actually constructed the inverse in this step : f −1 (y) = 2
.)
158
f (x) = 1 − 2x , f : R −→ R
1 − (1 − 2x)
f −1
f (x) = f (1 − 2x) =
−1
= x.
2
159
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 .
161
(1b) Now we show that if f is invertible then f is onto.
f (a) 6= b0 , ∀a ∈ A .
In particular
f g(b0 ) = b0 , where g(b0 ) ∈ A .
162
(2a) Next we show that if f is 1 − 1 and onto then f is invertible.
g(b) = a .
163
(2b) We still must show that ∀a ∈ A : g f (a) = a .
By contradiction : Suppose g f (a0 ) 6= a0 for some a0 ∈ A .
i.e.,
f g(b0 ) 6= b0 .
164
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 1 2 3 4 5 6 7 ···
f (n) 7 4 1 4 19 52 109 · · ·
165
• Now let
S = f (Z+ ) = {1, 4, 7, 19, 52, 109, · · ·} ,
f : Z+ −→ S .
• Finally let
D = Z+ − {2} ,
and consider f as a function
f : D −→ S .
166
EXAMPLE : The floor and ceiling functions.
FACT :
x = n + r.
⌊x⌋ = n .
EXAMPLES :
where e = 2.71828 · · · .
167
FACT :
x = n − r.
⌈x⌉ = n .
EXAMPLES :
168
We see that
⌊·⌋ : R −→ Z ,
and
⌈·⌉ : R −→ Z .
EXERCISE :
169
EXAMPLE : Let p , k ∈ Z+ .
Then
p p+k
⌈ ⌉ < .
k k
PROOF :
Hence
p p p p+k
⌈ ⌉ = + r < + 1 = . QED !
k k k k
170
EXAMPLE : Show that the linear function
f : R2 −→ R2
defined by
f (x, y) = (x + y , x − y) ,
or, in matrix form,
x 1 1 x
f : 7→ ,
y 1 −1 y
• One-to-one : Exercise!
Hint : See the earlier example where this function was considered as
f : Z2 −→ Z2 .
171
• Onto :
x 1 1 x
f (x, y) = (x + y , x − y) or f : 7→
y 1 −1 y
f (x, y) = (s, d) ,
that is, by solving
x+y = s , x−y = d ,
for x, y ∈ R :
s+d s−d
x = , y = .
2 2
Thus the inverse is
1
s+d s−d s 2
1
2 s
g(s, d) = ( , ) or g : 7→ 1 .
2 2 d 2 − 21 d
172
f (x, y) = (x + y , x − y) , g(s, d) = ( s+d
2
, s−d
2
)
s+d s−d
f (g(s, d)) = f ( , )
2 2
s+d s−d s+d s−d
= ( + , − ) = (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 :
f : R2 −→ R2
174
x a11 a12 x
f : R2 −→ R2 , f : 7→
y a21 a22 y
175
Now consider the same linear function
n a11 a12 n
f : 7→ ,
m a21 a22 m
f : Z2 −→ Z2 .
Is
s 1 a22 −a12 s
f −1 : 7→ .
d D −a21 a11 d
176
ANSWER : Not in general !
and
• ∀i, j : D | aij .
s 1 a22 −a12 s
f −1 : 7→ .
d D −a21 a11 d
177
EXERCISE : Show that
n 3 2 n
f : 7→ ,
m 4 3 m
is invertible as a function f : Z2 −→ Z2 .
178
REVIEW EXERCISES.
Problem 1.
Define
f : R −→ R
by
1/x if x 6= 0 ,
f (x) ≡
0 if x=0.
• Is f one-to-one?
• Is f onto?
• What is f −1 ?
179
Problem 2. Consider a function
f : A −→ B .
• A = {1, 2, 3} , B = {1, 2}
• A = {1, 2} , B = {1, 2, 3}
180
Problem 3.
f : Sn −→ Sn
181
Problem 5. Let f : A −→ B and g : B −→ C be functions.
182
Problem 6.
p(x) = a x2 + b x + c , a, b, c ∈ R , x ∈ R .
p(x) = d x + e , d, e ∈ R , x ∈ R .
D : P2 −→ P1 .
183
For example,
D : 3x2 + 7x − 4 7→ 6x + 7 ,
and
D : 5x − 2π 7→ 5.
QUESTIONS :
• Is D one-to-one ?
• Is D onto ?
184
Problem 7. If A and B are sets, and if
f : A −→ B ,
• f (S ∪ T ) = f (S) ∪ f (T ) ,
• f (S ∩ T ) ⊆ f (S) ∩ f (T ) .
185
Problem 8. If A and B are sets, and if
f : A −→ B ,
f −1 (S) ≡ {a ∈ A : f (a) ∈ S} .
• f −1 (S ∪ T ) = f −1 (S) ∪ f −1 (T ) ,
• f −1 (S ∩ T ) = f −1 (S) ∩ f −1 (T ) .
186
THE DIVISION THEOREM :
∀n ∈ Z, ∀d ∈ Z+ , ∃! q, r ∈ Z : ( 0 ≤ r < d , n = qd + r ) .
n = 2·d + 5 .
187
EXAMPLES :
n = 14 , d = 5 : 14 = 2 · d + 4 , so
188
Let d ∈ Z+ and n, q, r ∈ Z .
189
PROPERTY 4 : Let a, b ∈ Z and d ∈ Z+ . Then
PROOF :
By the Division Theorem
QED !
190
PROPERTY 5 : Let a ∈ Z and d ∈ Z+ . Then
EXAMPLE :
191
PROPERTY 6 :
EXAMPLE :
192
PROOF :
Thus
(a + b) mod d = (qa d + ra + qb d + rb ) mod d
= (qa + qb )d + ra + rb mod d
193
DEFINITION :
If a, b ∈ Z , d ∈ Z+ , and if
a mod d = b mod d ,
then we also write
a ≡ b (mod d) ,
and we say
“a is congruent to b modulo d”.
EXAMPLE :
83 ≡ 31 (mod 26) .
26 | (83 − 31) .
194
PROPOSITION : Let a, b ∈ Z , and d ∈ Z+ . Then
PROOF :
a mod d = b mod d .
It follows that
a − b = (qa − qb ) d ,
so that d | (a − b).
195
a ≡ b (mod d) if and only if d | (a − b)
a − b = qd ,
i.e. ,
a = b + qd ,
for some q ∈ Z .
It follows that
196
PROPOSITION : If a, b ∈ Z , and c, d ∈ Z+ , then
PROOF :
a ≡ b (mod d) if and only if d | (a − b) ,
i.e.,
a − b = qd , for some q ∈ Z .
197
PROPOSITION : Let a, b ∈ Z and d ∈ 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) (Check!) .
198
a ≡ b (mod 2d) ⇒ a2 ≡ b2 (mod 4d)
199
PROPOSITION : If n > 3 then not all of
n , n+2 , n+4 ,
can be primes.
200
THE FACTORIZATION THEOREM :
∀n ∈ (Z+ − {1}) , ∃! m, {pi }m m
i=1 , {ni }i=1 :
m ∈ Z+ ,
∀i (i = 1, · · · , m) : pi , ni ∈ Z+ ,
∀i (i = 1, · · · , m) : pi is a prime number ,
EXAMPLE : 252 = 22 32 71 .
201
PROPOSITION : log2 3 is irrational.
PROOF : By contradiction:
Suppose log2 3 is rational, i.e., ∃p, q ∈ Z+ , such that
log2 3 = p/q .
By definition of the log function it follows that
2p/q = 3 ,
from which
2 p = 3q .
Let n = 2p . Then n ∈ Z+ , with n ≥ 2 .
Then n has two different prime factorizations, namely
n = 2p and n = 3q .
202
REMARK :
2p 6= 3q ,
203
DEFINITION :
∃k ∈ Z+ : n = k2 .
FACT :
If
k = pn1 1 pn2 2 · · · pnmm ,
then
n = k2 = p12n1 p22n2 · · · pm
2nm
.
204
PROPOSITION :
+
√
If n ∈ Z is not a perfect square then n is irrational.
PROOF :
By contradiction :
√
Suppose n is not a perfect square, but n is rational.
Thus
√ p
n = ,
q
i.e.,
p2 = n q 2 ,
for some p, q ∈ Z+ .
205
p2 = n q 2
206
DEFINITION :
k = gcd(n, m) ,
if
207
REMARK :
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
THE EUCLIDEAN THEOREM :
Then
gcd(d , r) if r > 0,
gcd(n, d) =
d if r = 0.
209
EXAMPLE :
= 3.
210
EXAMPLE :
= 1.
211
LEMMA :
Let a, b, c ∈ Z , and d ∈ Z+ .
Then
212
(1) ( a = b + c , d|a , d|b ) ⇒ d|c
PROOF of (1) :
d|a ⇐⇒ ∃qa ∈ Z : a = d qa ,
and
d|b ⇐⇒ ∃qb ∈ Z : b = d qb .
Thus
c = a − b = d qa − d qb = d (qa − qb ) .
Hence d|c .
213
gcd(d, r) if r>0
gcd(n, d) =
d if r=0
Case 1 : r = 0 .
Hence d = gcd(n, d) .
214
gcd(d, r) if r>0
gcd(n, d) =
d if r=0
Case 2 : r > 0:
Let k = gcd(n, d) .
215
gcd(d, r) if r>0
gcd(n, d) =
d if r=0
k = gcd(n, d) , n = q · d + r.
By contradiction :
Suppose k1 > k and k1 = gcd(d, r) .
Thus k1 |d and k1 |r
By Lemma (3) k1 |qd .
By Lemma (2) k1 |n .
Thus k1 divides both n and d .
Since k1 > k this contradicts that k = gcd(n, d) . QED !
216
REVIEW EXERCISES.
Problem 1.
√
Prove that a composite number n has a factor k ≤ n .
217
Problem 3. Find all integer solutions of
2x ≡ 7(mod 17) .
4x ≡ 5(mod 9) .
Problem 5.
218
Problem 6. Let
S = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } ,
and define
f : S −→ S ,
by
f (k) = (5k + 3) mod 10 .
Is f invertible?
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 ,
220
THE PRINCIPLE OF INDUCTION
Let
S = { s1 , s2 , s3 , · · · }
Suppose P is a predicate,
P : S −→ { T , F } ,
such that :
(i) P (s1 ) = T ,
221
EXAMPLE :
n
X n(n + 1)
k = , ∀n ∈ Z+ .
k=1
2
Here S = Z+ and
n
X n(n + 1)
P (n) = T if k = ,
k=1
2
and n
X n(n + 1)
P (n) = F if k 6= .
k=1
2
222
PROOF :
(i) “By inspection” the formula holds if n = 1 , i.e., P (1) = T .
223
EXAMPLE :
n
X n(n + 1)(2n + 1)
k2 = , ∀n ∈ Z+ .
k=1
6
PROOF :
(ii) Suppose
n
X
2 n(n + 1)(2n + 1)
k = ,
k=1
6
for some arbitrary n ∈ Z+ .
224
Pn 2 n(n+1)(2n+1) Pn+1 (n+1) ((n+1)+1) (2(n+1)+1)
k=1 k = 6
⇒ k=1 k2 = 6
n+1
X n
X
To do this : k2 = k2 + (n + 1)2
k=1 k=1
= (n + 1) (2n2 + 7n + 6)/6
= (n + 1) (n + 2) (2n + 3)/6
= (n + 1) (n + 1) + 1 2(n + 1) + 1 /6 . QED !
225
EXAMPLE :
(n3 − n) mod 3 = 0 , ∀n ∈ Z+ .
PROOF :
226
(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
227
EXAMPLE :
Let P (n) denote the statement
PROOF :
(i) P (0) = T because the empty set has one subset, namely itself.
228
To do this write
Sn+1 = { s1 , s2 , · · · , sn , sn+1 } = Sn ∪ {sn+1 } .
Now count the subsets of Sn+1 :
229
EXAMPLE :
3n < n!
CLAIM :
P (n) = T for all integers n with n > 6 .
230
PROOF :
i.e.,
3n < n! (n ≥ 7) .
231
3n < n! ⇒ 3n+1 < (n + 1)!
To do this :
3n+1 = 3 · 3n
< (n + 1) n! (since n ≥ 7)
= (n + 1)!
232
EXERCISE : For which nonnegative integers is
n2 ≤ n! ?
n 2 ≤ 2n ?
233
EXAMPLE :
Let m
X 1
Hm ≡ . (”Harmonic numbers.”)
k=1
k
Let P (n) denote the statement
n
H2n ≥ 1 + .
2
PROOF :
(i) It is clear that P (1) = T , because
2
X 1 1
H21 = = 1+ .
k=1
k 2
234
(ii) Assume that
P (n + 1) = T ,
i.e.,
n+1
H2n+1 ≥ 1 + .
2
235
To do this :
n+1
2X n
2 n+1
2X
1 X 1 1
H2n+1 = = +
k=1
k k=1
k k=2n +1
k
n
2 n +2n
2X
X 1 1
= +
k=1
k k=2n +1
k
n n 1
≥ (1 + ) + 2 n
2 2 + 2n
n 1
= (1 + ) +
2 2
n+1
= 1+ . QED !
2
236
REMARK :
It follows that
∞
X 1
diverges ,
k=1
k
i.e.,
n
X 1
−→ ∞ as n −→ ∞ .
k=1
k
237
EXAMPLE : (The Binomial Formula.)
For n ≥ 0 , a, b nonzero,
n
X n
(a + b)n = an−k bk ,
k
k=0
where
n n!
≡ .
k k! (n − k)!
238
PROOF :
We must show that the formula is also valid for n + 1 , i.e., that
n+1
X n+1
(a + b)n+1 = an+1−k bk .
k
k=0
239
This can be done as follows :
n
X n
(a + b)n+1 = (a + b)(a + b)n = (a + b) an−k bk
k
k=0
n n−1
X n X n
= an+1 + an−k+1 bk + an−k bk+1 + bn+1
k k
k=1 k=0
n n
X n X n
= an+1 + an−k+1 bk + an−k+1 bk + bn+1
k k−1
k=1 k=1
n n o
n+1
X n n
= a + + an−k+1 bk + bn+1
k k−1
k=1
n
X n+1
= an+1 + an−k+1 bk + bn+1
k
k=1
n+1
X n+1
= an+1−k bk . QED !
k
k=0
240
REMARK :
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 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
1 6 15 20 15 6 1
1 7 21 35 35 21 7 1
1 8 28 56 70 56 28 8 1
. . . . . . . . . .
242
Observe that every entry can be obtained by summing the closest entries
in the preceding row.
n n
1 ········· ········· 1
k−1 k
n+1
1 ········· ········· 1
k
243
REMARKS :
244
EXAMPLE : For x ∈ R , x 6= 0, 1 :
n
X
k 1 − xn+1
x = , ∀n ≥ 0 , ( Geometric sum ) .
k=0
1−x
Let n
X
Sn = xk .
k=0
Then
Sn = 1 + x + x2 + · · · + xn−1 + xn ,
x · Sn = x + x2 + · · · + xn−1 + xn + xn+1 ,
so that
Sn − x · Sn = (1 − x) · Sn = 1 − xn+1 ,
245
ALTERNATE PROOF ( by induction ) :
1−xn+1
(ii) Suppose that Sn = 1−x
, for some arbitary n, ( n ≥ 0 ) .
1−x(n+1)+1
Show Sn+1 = 1−x
:
n+1 1 − xn+1
Sn+1 = Sn + x = + xn+1
1−x
(1 − xn+1 ) + xn+1 (1 − x)
=
1−x
1 − xn+1 + xn+1 − xn+2
=
1−x
1 − x(n+1)+1
= . QED !
1−x
246
EXERCISE :
21 | (4n+1 + 52n−1 ) ,
EXERCISE :
3 | f4n ,
for all n ≥ 1 .
247
Variations on the Principle of Induction.
VARIATION 2 :
h i
P (s1 ) ∧ P (s2 ) ∧ ∀n ≥ 2 : P (sn−1 ) ∧ P (sn ) ⇒ P (sn+1 ) ⇒ ∀n : P (sn ) .
VARIATION · · ·
STRONG INDUCTION :
h i
P (s1 ) ∧ ∀n ≥ 1 : P (s1 ) ∧ P (s2 ) ∧ · · · ∧ P (sn ) ⇒ P (sn+1 ) ⇒ ∀n : P (sn ) .
248
EXAMPLE : The Fibonacci Numbers.
f1 = 1 ,
f2 = 1 ,
249
f1 = 1 f11 = 89 f21 = 10946
250
PROPERTY :
√ √ i
1 h 1+ 5 n 1− 5 n
fn = √ − .
5 2 2
251
We can also write
√ √ i
1 h 1+ 5 n 1− 5 n
fn = √ −
5 2 2
1 1 + √5 n h 1 − √5 n i
= √ 1 − √
5 2 1+ 5
1 1 + √5 n h 1 − 2.236 n i
≈ √ 1 −
5 2 1 + 2.236
1 1 + √5 n h n i
= √ 1 + (−1)n+1 0.3819
5 2
1 1 + √5 n
≈ √ .
5 2
252
f1 = 1 ≈ 0.72361 f11 = 89 ≈ 88.99775
253
h √ n √ n i
fn = √1 1+ 5
− 1− 5
5 2 2
254
Inductively, assume that we have
√ √
1 h 1 + 5 n−1 1 − 5 n−1 i
fn−1 = √ − ,
5 2 2
and
√ √ i
1 h 1+ 5 n 1− 5 n
fn = √ − .
5 2 2
√ √
1 h 1 + 5 n+1 1 − 5 n+1 i
fn+1 = √ − .
5 2 2
255
Using the inductive hypothesis for n and n − 1 we have
256
Direct solution of the Fibonacci recurrence relation.
f1 = 1 , f2 = 1 ,
This gives
257
z2 − z − 1 = 0
fn = c1 z1n + c2 z2n .
258
fn = c1 z1n + c2 z2n
259
fn = c1 z1n + c2 z2n
We found that
√ √
1 + 5 1 − 5
z1 = , z2 = .
2 2
and
1 1
c1 = √ and c2 = − √ . (Check!)
5 5
from which
√ √
1 1 + 5 n 1 1 − 5 n
fn = √ − √ .
5 2 5 2
260
REVIEW EXERCISES.
Problem 1.
Pn
• k=1 f2k−1 = f2n , for n ∈ Z+ .
261
Problem 2. The recurrence relation
xn+1 = c xn (1 − xn ) , 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
xn+1 = 3 xn − 2 xn−1 , n = 1, 2, 3, · · · ,
with x1 = 1 and x2 = 3 .
262
RELATIONS
EXAMPLE :
≤ : Z × Z −→ {T , F } .
263
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
265
We can now equivalently define :
DEFINITION :
NOTATION :
If R ⊆ A × B, and
(a, b) ∈ R ,
then we say that
“a is R-related to b”,
and we also write
aRb .
266
EXAMPLE :
Then
1R3 , 1R5 , 1R9 , 3R3 , and 3R9 .
Thus
R = { (1, 3) , (1, 5) , (1, 9) , (3, 3) , (3, 9) } .
267
We can represent R by the following diagram
A B
1
5
9
3
3
268
REMARK :
269
A finite relation from a set A into itself can be represented
by an ordinary directed graph.
EXAMPLE :
Let
A = {1 , 2 , 3 , 4 , 5 , 6} ,
270
2 3
1 4
6 5
271
We can compose relations as follows :
R S
A B C
S oR
272
EXAMPLE :
Let
Define
T = S◦R .
273
Then from the diagram below we see that
R S
A B C
1 1
2
2 9
6
3 15
S oR = T
274
Let A, B, C, and D be sets, and let R S, and T be relations :
R : A −→ B , S : B −→ C , T : C −→ D .
PROPOSITION :
(T ◦ S) ◦ R = T ◦ (S ◦ R) .
R S T
A B C D
S oR ToS
To S oR
275
R S T
A B C D
S oR ToS
To S oR
(T ◦ S) ◦ R = T ◦ (S ◦ R) .
⇐⇒ ∃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
EXAMPLE : Let the relation R on
A = { 2, 3, 4, 8, 9, 12 } ,
be defined by
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 R R
21
0
0
1 21
0
0
1 0
1
21
0 1
0
02
1
31
0 31 11
00
0
1 31
0
0
1 0
10 00
11
003
11
4
4 1
0 1
0 1
0 1
0
0
1 0
1 0
1 0
1 4
4
81
0
0
1 1
0
08
1 1
0
08
1 1
0
0
1 8
91
0
0
1 1
0
09
1 1
0
09
1 1
0
0
1 9
00
11 0
1 1
0 1
0
12
00
11 12 1
0 0 12
1 0 12
1
R2
R3
278
EXAMPLE :
Then
xR2 z ⇐⇒ ∃y : xRy and yRz
⇐⇒ ∃y : xy = 1 and yz = 1
⇐⇒ x = z and x 6= 0 . (Why ?)
279
The last equivalence in detail:
∃y : xy = 1 and yz = 1 .
Thus x = z and x 6= 0 .
280
∃y : xy = 1 and yz = 1 if and only if x = z and x 6= 0 .
(⇐)
x=z and x 6= 0 .
Let y = 1/x.
Then xy = 1 and yz = 1.
QED !
281
Similarly
⇐⇒ ∃y : x = y and x 6= 0 and yz = 1
⇐⇒ xz = 1 (Why ?)
Thus
R3 = R ,
R4 = R3 ◦ R = R ◦ R = R2 ,
R5 = R4 ◦ R = R2 ◦ R = R3 = R,
and so on · · ·
282
EXAMPLE :
Then
xR2 z ⇐⇒ ∃y : xRy and yRz
⇐⇒ ∃y : x2 + y 2 ≤ 1 and y 2 + z 2 ≤ 1
⇐⇒ x2 ≤ 1 and z 2 ≤ 1 (Why ?)
⇐⇒ | x | ≤ 1 and | z | ≤ 1 .
283
y z
1
−1 1
1
x x
R R2
−1
284
Similarly
⇐⇒ ∃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 · · ·
Rn = R2 for all n ≥ 2 .
286
The relation matrix.
0 if (ai , bj ) 6∈ R ,
Rij =
1 if (ai , bj ) ∈ R .
287
EXAMPLE :
R S
A B C
1 1
2
2 9
6
3 15
S oR = T
288
R S
A B C
1 1
2
2 9
6
3 15
S oR = T
2 6 1 9 15
1 1 1
2 1 1 1
R = 2 1 1 and S = .
6 1 0 0
3 0 1
289
We found that
R S
A B C
1 1
2
2 9
6
3 15
S oR = T
290
R S
A B C
1 1
2
2 9
6
3 15
S oR = T
The relation matrices of R and S were found to be
1 1
1 1 1
R = 1 1 , S = .
1 0 0
0 1
The relation matrix of T = S ◦ R is
1 1 1
T = 1 1 1 .
1 0 0
291
PROPOSITION :
Let T = S ◦ R.
292
PROOF :
Tij = 1 ⇐⇒ ai T cj
PnB
⇐⇒ ℓ=1 Riℓ Sℓj 6= 0
⇐⇒ [RS]ij 6= 0 . QED !
293
REMARK :
EXAMPLE :
294
The inverse of a relation.
295
EXAMPLE :
A
B
1 a
2
b
3
Here
R = {(1, a), (1, b), (2, a), (3, b)} ,
and
R−1 = {(a, 1), (a, 2), (b, 1), (b, 3)} .
296
Note that
R−1 = RT (transpose) .
bj R−1 ai ⇐⇒ ai Rbj .
297
EXERCISE : Let R be the relation on the set
A = {1, 2, 3, 4},
defined by
a1 Ra2 if and only if a1 < a2 .
298
DEFINITION : Let R be a relation on A (i.e., from A to A).
• R is called reflexive if
∀a ∈ A : (a, a) ∈ R, i .e., ∀a ∈ A : aRa ,
EXAMPLES :
299
• R is symmetric if
∀a, b ∈ A : aRb → bRa ,
or, equivalently,
aRb ⇒ bRa ,
EXAMPLES :
300
• R is antisymmetric if for all a, b ∈ A we have
aRb ∧ bRa ⇒ a = b ,
or equivalently,
a 6= b ⇒ ¬(aRb) ∨ ¬(bRa) ,
EXAMPLES :
301
• R is transitive if
aRb ∧ bRc ⇒ aRc .
in Boolean arithmetic
EXAMPLES :
302
EXERCISE : Let A be a set of n elements.
• symmetric ?
• antisymmetric ?
(∗)
Hint : Search the web for “the number of transitive relations” !
303
• An equivalence relation is a relation that is
- reflexive
- symmetric
- transitive.
EXAMPLE :
(Here m ≥ 2 is fixed.)
304
• A partial order is a relation that is
- reflexive
- antisymmetric
- transitive.
EXAMPLES :
The “divides” relation on Z+ .
305
• A relation R on a set A is called a total order if
EXAMPLES :
306
Equivalence classes.
Let a1 ∈ A.
Define
[a1 ] = {a ∈ A : aRa1 } ,
that is
307
EXAMPLE :
For example
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] .
309
EXAMPLE :
Define a relation R on Z × Z by
(Z × Z) × (Z × Z) .
310
(a1 , b1 )R(a2 , b2 ) if and only if a1 − b1 = a2 − b2
R is an equivalence relation :
• 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
Ak = { (a, b) : a − b = k } .
For example,
Z×Z = ∪∞
k=−∞ Ak .
312
b A −3 A −2 A −1
A0
A1
A
2
A3
313
DEFINITION :
314
EXAMPLE :
111
00
00
11
00
11
11
00
00
11
2
00
11
11
00 11
00
00
11 00
11
00
11
4
00
11
3
315
The reflexive closure of R is :
1 1010 2
1
0
0
1
0
1
1
0 1
0
4
0
1 0
1
3
316
The symmetric closure of R is :
111
00
00
11
00
11
2
11
00
00
11
00
11
11
00 11
00
00
11
4
00
11
3
317
To get the transitive closure of R :
111
00
00
11
00
11
2
11
00
00
11
00
11
11
00 11
00
00
11
4
00
11
3
318
To get the transitive closure of R :
111
00
00
11
00
11
2
11
00
00
11
00
11
11
00 11
00
00
11
4
00
11
3
319
To get the transitive closure of R :
111
00
00
11
00
11
2
11
00
00
11
00
11
11
00 11
00
00
11
4
00
11
3
320
The transitive closure of R is :
111
00
00
11
2
1
0
0
1
11
00 1
0
00
11 0
1
00
11
4
0
1
3
321
PROPERTY : The transitive closure R∗ of a relation R is given by
k
R∗ = ∪∞
k=1 R .
PROOF : Later · · ·
322
EXAMPLE : In the preceding example,
1 1010 1
0
0
1
2
0
1
1
0 1
0
4
0
1 0
1
3
323
Thus, using Boolean arithmetic,
0 0 0 1 0 0 0 1 1 0 0 0
1 1 0 0
R2 1 1 0 0 = 1 1 0 1
= R · R =
0
,
1 0 0 0 1 0 0 1 1 0 0
1 0 0 0 1 0 0 0 0 0 0 1
0 0 0 1 1 0 0 0 0 0 0 1
1 1 0 0 1 1 0 1 1 1 0 1
R3 = R · R2
=
0
= ,
1 0 0 1 1 0 0 1 1 0 1
1 0 0 0 0 0 0 1 1 0 0 0
0 0 0 1 0 0 0 1 1 0 0 0
1 1 0 0 1 1 0 1
R4 = R · R3 = 1 1 0 1
=
0
.
1 0 0 1 1 0 1 1 1 0 1
1 0 0 0 1 0 0 0 0 0 0 1
324
Therefore
4
X
R∗ = Rk = R + R2 + R3 + R4 =
k=1
0 0 0 1 1 0 0 0 0 0 0 1 1 0 0 0
1 1 0 0 + 1 1 0 1 + 1 1 0 1 + 1 1 0 1
0 1 0 0 1 1 0 0 1 1 0 1 1 1 0 1
1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1
1 0 0 1
1 1 0 1
=
1
.
1 0 1
1 0 0 1
325
The graph of R∗ (shown before) is :
111
00
00
11
2
1
0
0
1
11
00 1
0
00
11
4
0
1
3
326
RECALL : The transitive closure R∗ of a relation R is given by
k
R∗ = ∪∞
k=1 R (to be proved later · · · )
327
EXAMPLE : Again consider the relation R on the real numbers
that is,
328
EXERCISE : Let R be the relation on the real numbers given by
• Is R reflexive?
• Is R symmetric?
• Is R antisymmetric?
• Is R transitive?
• What is R3 ?
329
EXERCISE : Let R be the relation on the real numbers given by
• Is R reflexive?
• Is R symmetric?
• Is R antisymmetric?
• Is R transitive?
• What is R2 ?
• What is R3 ?
330
EXERCISE : Let R be the relation on the real numbers given by
• Is R reflexive?
• Is R symmetric?
• Is R antisymmetric?
• Is R transitive?
• What is R2 ?
• What is R3 ?
331
xRy if and only if x2 ≤ y
Then
xR2 z ⇐⇒ ∃y : xRy and yRz
⇐⇒ ∃y : x2 ≤ y and y 2 ≤ z
⇐⇒ x4 ≤ z .
Similarly
xR3 z ⇐⇒ ∃y : xR2 y and yRz
⇐⇒ ∃y : x4 ≤ y and y 2 ≤ z
⇐⇒ x8 ≤ z .
By induction one can prove that
n 2n
xR z ⇐⇒ x ≤ z.
332
We see that
333
The transitive closure is
k
R∗ = ∪∞
k=1 R .
(to be proved later · · · )
(Check!)
334
Let R be a relation on a set A .
Recursively define
R1 = R , Rn+1 = Rn ◦ R , n = 1, 2, 3, · · · .
PROPERTY 1 : Rn ◦ R = R ◦ Rn
335
PROPERTY 1 : Rn ◦ R = R ◦ Rn , for all n ∈ Z+
336
PROPERTY 2 : R symmetric ⇒ Rn is symmetric
337
Let R be a relation on a set A and let n ∈ Z+ .
PROOF :
Let R be transitive.
Obviously R1 is transitive.
338
Given R and Rn are transitive. Show Rn+1 is transitive
· · · continuation of proof · · ·
aRn+1 b ∧ bRn+1 c
⇒ aRn ◦ Rb ∧ bRn ◦ Rc (power)
339
Given R and Rn are transitive. Show Rn+1 is transitive.
· · · continuation of proof · · ·
aR ◦ Rn q ∧ qRc
⇒ aR ◦ Rn c (composition)
340
Let R and S be relations on a set A .
Recall that we can also think of R as a subset of A × A .
We have:
PROPERTY 4 : R ⊆ S ⇒ Rn ⊆ S n
Inductive step:
Given R ⊆ S and Rn ⊆ S n . Show Rn+1 ⊆ S n+1
To do this :
Suppose that (x, z) ∈ Rn+1 .
Then ∃y : (x, y) ∈ R and (y, z) ∈ Rn .
By the assumptions (x, y) ∈ S and (y, z) ∈ S n .
Hence (x, z) ∈ S n+1 . QED !
341
Let S be a relation on a set A .
PROOF :
Hence S is transitive.
342
(⇒) S is transitive ⇒ ∀n ∈ Z+ : S n ⊆ S
By induction :
Clearly S n ⊆ S if n = 1 .
343
Given (1): S is transitive, and (2): S n ⊆ S . Show S n+1 ⊆ S
344
THEOREM :
k
R∗ = ∪∞
k=1 R .
k
PROOF : Let U = ∪∞
k=1 R .
(1) U is transitive.
If so, then R∗ = U .
345
k
U = ∪∞
k=1 R ⋆
By definition of composition
(x, z) ∈ Rn+m .
346
k
U = ∪∞
k=1 R ⋆
R
U
347
k
U = ∪∞
k=1 R ⋆
R ⊆ S ⇒ Rn ⊆ S n Property 4
S is transitive ⇐⇒ ∀n ∈ Z+ : S n ⊆ S Property 5
By Property 4 : (x, y) ∈ S n .
348
REVIEW PROBLEMS
and
349
Review Problem 1.
n5 − n ≡ 0 (mod 30)
350
Review Problem 2.
351
Review Problem 3. If A and B are sets, and if
f : A −→ B ,
f −1 (S) ≡ {a ∈ A : f (a) ∈ S} .
Prove that
f −1 (S ∩ T ) = f −1 (S) ∩ f −1 (T )
352
Review Problem 4.
then
gcd(a, m) = gcd(b, m) .
353
Review Problem 5.
21 | (4n+1 + 52n−1 ) ,
354
Review Problem 6.
for all n ≥ 2 .
355
Review Problem 7.
356