LOGIC
Introduction. First weintroduce 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
3.
A function (or“map”, or “operator”) is a rule that associates to every
element of a set one element in another set.
EXAMPLES :
• If S1 = {a, b, c} and S2 = {1, 2} then the associations
a 7→ 2, b 7→ 1, c 7→ 2,
define a function f from S1 to S2 . We write
f : S1 −→ S2 .
• Similarly f(n) = n2
defines a function f : Z+
−→ Z+
.
• f(n) = n2
can also be viewed as a function f : Z −→ Z.
2
4.
EXAMPLE :
Let Pndenoet 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 Pn−1,
D : Pn −→ Pn−1, D : p 7→
dp
dx
.
For example, if p(x) = x3
+ 2x + 1, then
D : x3
+ 2x + 1 7→ 3x2
+ 2 ,
i.e.,
D(x3
+ 2x + 1) = 3x2
+ 2 .
3
5.
EXAMPLE :
• Wecan 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+
.
4
6.
Basic logical operators.
Thebasic logical operators
∧ (“and” , “conjunction”)
∨ (“or” , “disjunction”)
¬ (“not” , “negation”)
are defined in the tables below :
p ¬p
T F
F T
p q p ∨ q
T T T
T F T
F T T
F F F
p q p ∧ q
T T T
T F F
F T F
F F F
5
7.
Let B ≡{T , F }. Then we can view ¬, ∨, and ∧, as functions
¬ : B −→ B, ∨ : B × B −→ B , ∧ : B × B −→ B .
We can also view the arithmetic operators −, +, and ×, as functions
− : Z −→ Z, + : Z × Z −→ Z, ∗ : Z × Z −→ Z,
defined by value tables, for example,
x −x
· ·
-2 2
-1 1
0 0
1 -1
2 -2
· ·
6
8.
Logical expressions.
A logicalexpression (or “proposition”) P(p, q, · · ·) is a function
P : B × B × · · · × B −→ B .
For example,
P1(p, q) ≡ p ∨ ¬q and P2(p, q, r) ≡ p ∧ (q ∨ r)
are logical expressions.
Here
P1 : B × B −→ B ,
and
P2 : B × B × B −→ B .
7
9.
The values ofa 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
10.
Analogously, arithmetic expressionssuch as
A1(x, y) ≡ x + (−y) and A2(x, y, z) ≡ x × (y + z)
can be considered as functions
A1 : R × R −→ R, and A2 : R × R × R −→ R ,
or, equivalently,
A1 : R2
−→ R, and A2 : R3
−→ R .
9
11.
Two propositions areequivalent if they always have the same values.
EXAMPLE :
¬(p ∨ q) is equivalent to ¬p ∧ ¬q ,
(one of de Morgan’s laws), as can be seen in the table below :
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
12.
NOTE :
In arithmetic
−(x+ y) is equivalent to (−x) + (−y) ,
i.e., we do not have that
−(x + y) is equivalent to (−x) × (−y) .
Thus the analogy between logic and arithmetic is limited.
11
13.
The three basiclogical operators ¬ , ∨ , and ∧ , are all we need.
However, it is very convenient to introduce some additional operators,
much like in arithmetic, where we write x3
to denote x × (x × x).
Three such additional operators are
⊕ “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
14.
EXAMPLE :
Suppose twopersons, P and Q, are suspected of committing a crime.
• Let P denote the statement by P that
“Q did it, or we did it together”.
• Let Q denote the statement by Q that
“P did it, or if I did it then we did it together”.
• Suppose we know P always tells the truth and Q always lies.
Who committed the crime ?
NOTE : By “did it” we mean “was involved”.
13
15.
Let p denote“P did it” and let q denote “Q did it”.
Then p and q are logical variables.
We are given that the value of the logical expression
q ∨ (p ∧ q) is True ,
and that
p ∨
q → (p ∧ q)
is False .
Equivalently we have that the value of the logical expression
¬
p ∨
q → (p ∧ q)
∧
q ∨ (p ∧ q)
is True .
Our problem is to find for what values of p and q this is the case.
14
16.
As an analogyfrom arithmetic, consider the problem of finding the values
of x and y in Z so that
the value of the arithmetic expression x2
+ y is 5 ,
and such that
the value of x + y is 3 ,
i.e., we want to find all solutions of the the simultaneous equations
x2
+ y = 5 , x + y = 3 .
(How many solutions are there ?)
15
17.
For the “crimeproblem” 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.
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
18.
EXERCISE :
Consider thelogical expression in the preceding “crime” example.
Find a much simpler, equivalent logical expression.
(It must have precisely the same values as listed in column “(9)”.)
17
19.
EXERCISE :
Suppose threepersons, P, Q, and R, are suspects in a crime.
• P states that “Q or R, or both, were involved”.
• Q states that “P or R, or both, were involved”.
• R states that “P or Q, but not both, were involved”.
• Suppose P and Q always tell the truth, while R always lies.
Who were involved in the crime ?
NOTE : there may be more than one solution · · ·
18
20.
EXERCISE :
Construct atruth table for the logical expression
(p ∧ (¬(¬p ∨ q))) ∨ (p ∧ q) .
Based on the truth table find a simpler, equivalent logical expression.
19
21.
A contradiction isa logical expression whose value is always False .
For example p ∧ ¬p is a contradiction :
p ¬p p ∧ ¬p
T F F
F T F
A tautology is a logical expression that is always True .
For example p ∨ ¬p is a tautology :
p ¬p p ∨ ¬p
T F T
F T T
A logical expression that is neither a tautology nor a contradiction
is called a contingency.
20
22.
EXERCISE :
Verify bytruth table that the following expressions are tautologies :
(p → q) ∧ p
→ q ,
(p → q) ∧ ¬q
→ ¬p .
21
23.
NOTATION :
We usethe symbol “⇒” to indicate that a conditional statement is a
tautology.
For example, from the preceding exercise we have
(p → q) ∧ p
⇒ q , (”modus ponens”) ,
(p → q) ∧ ¬q
⇒ ¬p , (”modus tollens”) .
22
24.
As another examplewe 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
QUESTION : Does it matter which of the two ∧’s is evaluated first?
23
25.
EXAMPLE :
Here weillustrate 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 always has value True .
NOTE : We need only show that:
We can’t have that P(p, q, r) is True , while r is False .
24
26.
So suppose thatP(p, q, r) is True , while r is False .
(We must show that this cannot happen ! )
Thus all three of
(a) p → q (b) ¬p → F and (c) q → F
have value True .
(c) can only have value True if q = F .
(b) can only have value True if ¬p = F , i.e., if p = T .
But then (a) becomes T → F which has value F .
So indeed, not all three, (a), (b), and (c) can have value True .
QED ! (“quod erat demonstrandum”: “which was to be shown”)
25
27.
NOTE :
This wasan example of a proof by contradiction.
(We will give more examples later · · · )
26
28.
EXERCISE :
Use aproof “by contradiction” to prove the following:
(p → q) ∧ p
⇒ q ,
(p → q) ∧ ¬q
⇒ ¬p .
(Already done by truth table.)
27
29.
EXERCISE :
Also usea ”direct proof” to prove that
(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
30.
NOTATION :
From thedefinition of the ↔ operator we see that logical expressions
P1(p, q, · · ·) and P2(p, q, · · ·) ,
are equivalent if and only if
P1(p, q, · · ·) ↔ P2(p, q, · · ·)
is a tautology.
In this case we write
P1(p, q, · · ·) ⇐⇒ P2(p, q, · · ·) .
29
31.
EXAMPLE :
¬(p ∧q) is equivalent to ¬p ∨ ¬q ,
i.e.,
¬(p ∧ q) ⇐⇒ (¬p ∨ ¬q) ,
as seen in the truth table
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
32.
The operators
⊕ ,→ , and ↔ ,
can be expressed in terms of the basic operators
¬ , ∧ , 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
33.
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
34.
Thus we canwrite
p ⊕ q ⇐⇒ (p ∨ q) ∧ ¬(p ∧ q) ,
p → q ⇐⇒ q ∨ ¬p ,
p ↔ q ⇐⇒ (q ∨ ¬p) ∧ (p ∨ ¬q) .
It also follows that
p ↔ q ⇐⇒ (p → q) ∧ (q → p) .
33
35.
Basic logical equivalences.
Thefundamental logical equivalences (“laws”) are :
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
36.
Some useful additionallaws 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
NOTE : Remember the absorption laws : they can be very useful !
35
37.
Some more lawsare :
(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
38.
• All lawsof logic can in principle be proved using truth tables.
• To illustrate the axiomatic nature of the fundamental laws,
we prove an additional law using only the fundamental laws.
• At every step the fundamental law used will be indicated.
• Once proved, additional laws may be used in further proofs.
37
39.
EXAMPLE : Proofof the idempotent law
p ∨ p ⇐⇒ p
p ⇐⇒ p ∨ F identity law
⇐⇒ p ∨ (p ∧ ¬p) complement law
⇐⇒ (p ∨ p) ∧ (p ∨ ¬p) distributive law
⇐⇒ (p ∨ p) ∧ T complement law
⇐⇒ p ∨ p identity law
38
40.
NOTE :
• Provingadditional laws, using only the fundamental laws, is not as
easy as one might expect, because we have very few tools available.
• However after proving some of these additional equivalences we
have a more powerful set of laws.
39
41.
Simplification of logicalexpressions.
It is useful to simplify logical expressions as much as possible.
This is much like in arithmetic where, for example, the expression
x3
+ 3x2
y + 3xy2
+ y3
is equivalent to
(x + y)3
.
40
42.
EXAMPLE : Reconsiderthe logical expression
¬
p ∨
q → (p ∧ q)
∧
q ∨ (p ∧ q)
from the “crime example”.
It is equivalent to the much simpler logical expression
¬p ∧ q ,
because it has the same truth table values :
p q ¬p ¬p ∧ q
T T F F
T F F F
F T T T
F F T F
41
43.
One way tosimplify a logical expression is by using
• the fundamental laws of logic,
• known additional laws,
• the definitions of the additional logical operators.
For the “crime example” this can be done as follows :
42
44.
¬
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
45.
¬
p ∨ ¬q
∧q
⇐⇒
¬p ∧ ¬¬q
∧ q de Morgan
⇐⇒
¬p ∧ q
∧ q double negation
⇐⇒ ¬p ∧
q ∧ q
associative law
⇐⇒ ¬p ∧ q idempotent law
44
46.
EXERCISE :
Use logicalequivalences 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
47.
EXERCISE :
Use logicalequivalences 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 .
NOTE : Earlier we proved this by truth table and by contradiction.
46
48.
Predicate Calculus.
Let Sbe a set.
A predicate P is a function from S to {T , F } :
P : S −→ {T , F } ,
or
P : S × S × · · · × S −→ {T , F } .
or
P : S1 × S2 × · · · × Sn −→ {T , F } .
47
49.
EXAMPLE : LetZ+
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 .
We can think of P(x) as the statement
“x is an even integer”,
which can be either True or False .
• What are the values of P(12), P(37), P(-3) ?
48
50.
EXAMPLE :
Let Ube a set and S a subset of U.
Let P(x) denote the statement “x ∈ S”, i.e.,
P(x) ⇐⇒ x ∈ S .
Then
P : U −→ {T , F } .
49
51.
EXAMPLE :
Let P(x,y) denote the statement “x + y = 5”, i.e.,
P(x, y) ⇐⇒ x + y = 5 .
Then we can think of P as a function
P : Z+
× Z+
−→ {T , F } .
50
52.
Quantifiers.
For a morecompact notation we introduce the quantifiers
∀ , ∃ , and ∃!
DEFINITIONS : Let S be a set and P a predicate, P : S −→ {T , F } .
Then we define :
∀x ∈ S P(x) means “ P(x) = T for all x ∈ S ”.
∃x ∈ S P(x) means “ there exists an x ∈ S for which P(x) = T ”.
∃!x ∈ S P(x) means “ there is a unique x ∈ S for which P(x) = T ”.
51
53.
If it isclear from the context what S is, then one often simply writes
∀x P(x) , ∃x P(x) , ∃!x P(x) .
If S has a finite number of elements then
∀x P(x) ⇐⇒ P(x1) ∧ P(x2) ∧ · · · ∧ P(xn)
∃x P(x) ⇐⇒ P(x1) ∨ P(x2) ∨ · · · ∨ P(xn)
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
54.
Let S bea 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)
.
Thus ∀x, y P(x, y) means
“P(x, y) is True for any choice of x and y ”.
53
55.
Similarly,
∃x, y P(x,y) and ∃x∃y P(x, y)
both mean
∃x
∃yP(x, y)
.
Thus ∃x, y P(x, y) means
“There exist an x and y for which P(x, y) is True ”.
54
56.
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
57.
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
58.
EXERCISE : Let
P: Z+
× Z+
× Z+
−→ {T , F } ,
where P(x, y, z) denotes the statement
“ x2
+ y2
= 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
59.
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
60.
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
61.
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
62.
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” .
Then the RHS is True but the LHS is False .
61
EXERCISES :
These equivalencesare easily seen to be valid:
• 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
67.
EXAMPLE : Proofof Equivalence (4) .
∀xP(x)
∨
∀xQ(x)
⇐⇒ ∀x∀y
P(x) ∨ Q(y)
NOTE : A correct proof consist of verifying that
LHS ⇒ RHS and RHS ⇒ LHS
or equivalently
LHS ⇒ RHS and ¬ LHS ⇒ ¬ RHS
66
68.
PROOF :
(i)
∀xP(x)
∨
∀xQ(x)
⇒ ∀x∀y
P(x)∨ Q(y)
is easily seen to be True by a direct proof (with 2 cases).
(ii) ¬
h
∀xP(x)
∨
∀xQ(x)
i
⇒ ¬∀x∀y
P(x) ∨ Q(y)
can be rewritten as
∃x¬P(x)
∧
∃x¬Q(x)
⇒ ∃x∃y
¬P(x) ∧ ¬Q(y)
P and Q being arbitrary, we may replace them by ¬P and ¬Q :
∃xP(x)
∧
∃xQ(x)
⇒ ∃x∃y
P(x) ∧ Q(y)
which is easily seen to be True by a direct proof.
QED !
67
69.
EXERCISE :
Prove thatthe equivalence
∀xP(x)
∧
∃xQ(x)
⇐⇒ ∀x∃y
P(x) ∧ Q(y)
is valid for all propositions P and Q.
Hint : This proof can be done along the lines of the preceding proof.
68
EXERCISE :
• ProveEquivalence 7 using Equivalence 3.
• Prove Equivalence 8 using Equivalence 4.
72
74.
EXAMPLE (of negatinga 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
75.
EXAMPLE (of transforminga 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)
⋆ This step follows from the earlier Equivalence 6.
74
76.
EXAMPLE : (fromRosen’s book: in detail)
Let
D(x) denote the statement “x is a duck”
P(x) ,, “x is one of my poultry”
O(x) ,, “x is an officer”
W(x) ,, “x is willing to waltz”
75
77.
Statement logic equivalent
Ducksnever 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)
QUESTION : Do the first three statements imply the last one?
76
78.
Do the firstthree statements imply the last one, i.e., is
h
∀x(D(x) → ¬W(x))
∧
∀x(O(x) → W(x))
∧
∀x(P(x) → D(x))
i
→
∀x(P(x) → ¬O(x))
a tautology, i.e., do we have
h
∀x(D(x) → ¬W(x))
∧
∀x(O(x) → W(x))
∧
∀x(P(x) → D(x))
i
⇒
∀x(P(x) → ¬O(x))
The answer is YES .
In fact, it is a tautology for any predicates D, O, P, W.
77
79.
h
∀x(D(x) → ¬W(x))
∧
∀x(O(x)→ W(x))
∧
∀x(P(x) → D(x))
i
(1) (2) (3)
⇒
∀x(P(x) → ¬O(x))
(4)
To prove this, we must show that :
if (1) , (2) , and (3) are True then (4) is True .
To show (4) is True , we must show:
If, for arbitrary z, P(z) is True then, using (1,2,3), ¬O(z) is True .
78
80.
h
∀x(D(x) → ¬W(x))
∧
∀x(O(x)→ W(x))
∧
∀x(P(x) → D(x))
i
(1) (2) (3)
⇒
∀x(P(x) → ¬O(x))
(4)
PROOF : Let z be an arbitrary element from our set of objects.
Assume P(z) is True .
We must show that ¬O(z) is True , i.e., O(z) is False .
From (3) it follows D(z) is True .
From (1) follows ¬W(z) is True . i.e., W(z) is False .
From (2), since W(z) is False , it follows O(z) is False . QED !
79
81.
EXERCISE (from Rosen):
Expresseach of the following using predicates and quantifiers:
(1) All clear explanations are satisfactory.
(2) Some excuses are unsatisfactory.
(3) Some excuses are not clear explanations.
Question : Does (3) follow from (1) and (2) ?
Hint : See preceding example.
80
82.
REVIEW EXERCISES.
Problem 1.By truth table check if the ⊕ operator is associative:
(p ⊕ q) ⊕ r ⇐⇒ p ⊕ (q ⊕ r) .
Problem 2. Use logical equivalences to prove that
p → (q → r) ⇐⇒ (p ∧ q) → r .
Problem 3. By contradiction show that the following is a tautology:
[(p ∨ t) ∧ (p → q) ∧ (q → r) ∧ (r → s) ∧ (s → t)] → t .
Problem 4. Use logical equivalences to simplify
([(p ∧ q) ↔ p] → p) → (p → q) .
81
83.
Problem 5. Verifythe following basic tautologies, which are known as
“laws of inference”, and which are useful in proofs:
Tautology 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
84.
Problem 6. Expressthe following statements in predicate logic:
(a) “There is a unique x for which P(x) is True .”
(b) “There is no greatest integer.”
(c) “x0 is the smallest integer for which P(x) is True .”
(d) “Every person has exactly two parents.”
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
85.
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.
What is the truth value of each of the following?
P(1, 1, 1) ∀y, z∃xP(x, y, z)
P(0, 7, 0) ∃!y, z∀xP(x, y, z)
∀x, y, zP(x, y, z) ∀x, y∃zP(x, y, z)
∃x, y, zP(x, y, z) ∀x∃y, zP(x, y, z)
84
86.
Problem 8.
Let P(x,y, z, n) denote the statement
xn
+ yn
= zn
,
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) ∀z∃x, yP(x, y, z, 1)
P(7, 24, 25, 2) ∃x, y∀zP(x, y, z, 2)
∃!x, y, zP(x, y, z, 2) ∃x, y, zP(x, y, z, 3)
NOTE : One of the above is very difficult!
85
87.
Problem 9.
Give anexample that shows that
∀x∃yP(x, y) 6
⇐⇒ ∃y∀xP(x, y) .
Problem 10.
Prove that
∀x[P(x) → Q(x)] ⇒ [∀xP(x) → ∀xQ(x)].
Problem 11.
Prove that
∀x∃y(P(x) ∨ Q(y)) ⇐⇒ ∀xP(x) ∨ ∃xQ(x) .
86
88.
MATHEMATICAL PROOFS.
• Wewill illustrate some often used basic proof techniques .
(Some of these techniques we have already seen · · · )
• Several examples will be taken from elementary Number Theory.
87
89.
DEFINITIONS : Letn, 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
90.
Direct proofs.
Many mathematicalstatements have the form
“ if P then Q ”
i.e.,
P ⇒ Q ,
or, more often,
∀x
P(x) → Q(x)
,
where P and Q represent specific predicates .
RECALL : a direct proof consists of
• assuming that, for arbitrary x, P(x) is True
• demonstrating that Q(x) is then necessarily True also,
89
91.
PROPOSITION : Ifn ∈ 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) ,
where P and Q are predicates (functions)
P, Q : Z+
−→ {T , F } ,
namely,
P(n) ⇐⇒ ”n is odd ” , Q(n) ⇐⇒ ”n2
is odd ” .
NOTE : Actually Q(n) ⇐⇒ P(n2
) here !
90
92.
If n ∈Z+
is odd then n2
is odd.
PROOF :
Assume n ∈ Z+
is odd (i.e., assume P(n) = T ).
Then, by definition, n = 2k + 1 for some k ∈ Z, k ≥ 0.
By computation we find
n2
= (2k + 1)2
= 2(2k2
+ 2k) + 1 = 2m + 1 ,
where we have defined m ≡ 2k2
+ 2k.
Thus, by definition, n2
is odd, i.e., Q(n) = T . QED !
91
93.
PROPOSITION : Ifn ∈ Z+
is odd then 8 | (n − 1)(n + 1) .
PROOF : If n ∈ Z+
is odd then we can write
n = 2k + 1 for some integer k, k ≥ 0 .
By computation we find
(n − 1)(n + 1) = n2
− 1 = 4k2
+ 4k = 4k(k + 1) .
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
94.
LEMMA (Needed inthe following example · · ·) For x ∈ R , x 6= 0, 1 :
n
X
k=0
xk
=
1 − xn+1
1 − x
, ∀n ≥ 0 , ( Geometric sum ) .
PROOF ( a ”constructive proof” ) :
Let
Sn =
n
X
k=0
xk
.
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
,
from which the formula follows. QED !
93
95.
DEFINITION :
A perfectnumber 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
96.
PROPOSITION : Letm ∈ Z+
, m 1.
If 2m
− 1 is prime, then n ≡ 2m−1
(2m
− 1) is perfect,
or, using quantifiers,
∀m ∈ Z+
: 2m
− 1 is prime → 2m−1
(2m
− 1) is perfect .
PROOF : Assume 2m
− 1 is prime.
Then the divisors of n = 2m−1
(2m
− 1) are
1, 2, 22
, 23
, · · · , 2m−1
,
and
(2m
− 1), 2(2m
− 1), 22
(2m
− 1), · · · , 2m−2
(2m
− 1), 2m−1
(2m
− 1) .
The last divisor is equal to n , so we do not include it in the sum.
95
97.
The sum isthen
m−1
X
k=0
2k
+ (2m
− 1)
m−2
X
k=0
2k
=
1 − 2m
1 − 2
+ (2m
− 1)
1 − 2m−1
1 − 2
= (2m
− 1) + (2m
− 1)(2m−1
− 1)
= (2m
− 1) (1 + 2m−1
− 1)
= (2m
− 1) 2m−1
= n. QED !
NOTE : We used the formula
m
X
k=0
xk
=
1 − xm+1
1 − x
, (the geometric sum) ,
(valid for x 6= 0, 1).
96
98.
Proving the contrapositive.
Itis easy to see (by Truth Table) that
p → q ⇐⇒ ¬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
99.
This equivalence justifiesthe following :
If we must prove
P ⇒ Q ,
then we may equivalently prove the contrapositive
¬Q ⇒ ¬P .
(Proving the contrapositive is sometimes easier .)
98
100.
PROPOSITION : Letn ∈ Z+
, with n ≥ 2.
If the sum of the divisors of n is equal to n + 1 then n is prime.
PROOF : We prove the contrapositive :
If n is not prime then the sum of the divisors can not equal n + 1.
So suppose that n is not prime.
Then n has divisors
1, n, and m, for some m ∈ Z+
, m 6= 1, m 6= n ,
and possibly more.
Thus the sum of the divisors is greater than n + 1. QED !
99
101.
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
102.
PROPOSITION : Letn ∈ Z+
, with n ≥ 2.
∀a, b ∈ Z+
( n|a ∨ n|b ∨ n 6 |ab ) ⇒ n is prime .
PROOF : The contrapositive is
If n is not prime then ∃a, b ( n 6 |a ∧ n 6 |b ∧ n|ab ) .
Here the contrapositive is easier to understand and quite easy to prove :
Note that if n is not prime then
n = a b ,
for certain integers a and b, both greater than 1 and less than n.
Clearly n 6 |a , n 6 |b , and n|ab . QED !
101
103.
PROPOSITION : Letn ∈ Z+
. Then
5|n2
⇒ 5|n ,
PROOF : We prove the contrapositive , i.e.,
5 6 |n ⇒ 5 6 |n2
.
So suppose 5 6 |n.
Then we have the following cases :
n = 5k + 1 ⇒ n2
= 25k2
+ 10k + 1 = 5(5k2
+ 2k) + 1 ,
n = 5k + 2 ⇒ n2
= 25k2
+ 20k + 4 = 5(5k2
+ 4k) + 4 ,
n = 5k + 3 ⇒ n2
= 25k2
+ 30k + 9 = 5(5k2
+ 6k + 1) + 4 ,
n = 5k + 4 ⇒ n2
= 25k2
+ 40k + 16 = 5(5k2
+ 8k + 3) + 1 ,
for k ∈ Z, k ≥ 0.
This shows that 5 6 |n2
. QED !
102
104.
Proof by contradiction.
Toprove a statement P ⇒ Q by contradiction :
• assume P = T and Q = F ,
• show that these assumptions lead to an impossible conclusion
(a “contradiction”).
(We have already seen some proofs by contradiction.)
103
105.
PROPOSITION :
If aprime 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
106.
PROPOSITION :
√
2 isirrational, i.e., if m, n ∈ Z+
then m
n
6=
√
2.
PROOF : Suppose m, n ∈ Z+
and m
n
=
√
2.
We may assume m and n are relatively prime (cancel common factors).
Then m =
√
2 n ⇒ 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
107.
EXERCISE :
Use aproof by contradiction to show the following:
(p ∨ q) ∧ (p → r) ∧ (q → r) ⇒ r .
(p → q) ∧ (q → r) ⇒ p → r .
Hint : See a similar example earlier in the Lecture Notes.
106
108.
PROPOSITION :
If theintegers
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
109.
PROOF : (bycontradiction)
Suppose any three integers in consecutive locations around the circle
have sum less than 18, that is, less then or equal to 17.
Excluding the number 1, which must be placed somewhere, there remain
exactly three groups of three integers in consecutive locations.
The total sum is then less than or equal to 1 + 17 + 17 + 17 = 52.
However, we know that this sum must equal
1 + 2 + 3 + · · · + 10 = 55 .
Hence we have a contradiction. QED !
108
110.
Proof by cases(another example) :
PROPOSITION : Let n ∈ Z+
. Then
6 | n(n + 1)(n + 2) .
PROOF : We always have that 2|n or 2|(n + 1) . (Why ?)
There remain three cases to be considered :
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
111.
FACT : Anyreal number x can be uniquely written as
x = n + r ,
where
n ∈ Z and r ∈ R , with 0 ≤ r 1 .
DEFINITION : We then define the floor of x as
⌊x⌋ ≡ n .
EXAMPLES : ⌊7⌋ = 7 , ⌊−7⌋ = −7 , ⌊π⌋ = 3 , ⌊−π⌋ = −4 .
EXAMPLE : Use a proof by cases to show that
⌊2x⌋ = ⌊x⌋ + ⌊x +
1
2
⌋ .
110
112.
⌊2x⌋ = ⌊x⌋+ ⌊x + 1
2
⌋ , x = n + r , 0 ≤ r 1
PROOF :
Case 1 : 0 ≤ r 1
2
: Then
0 ≤ 2r 1 and
1
2
≤ r +
1
2
1 .
LHS : ⌊2x⌋ = ⌊2n + 2r⌋ = 2n
RHS : ⌊x⌋ = ⌊n + r⌋ = n
⌊x +
1
2
⌋ = ⌊n + r +
1
2
⌋ = n
so that the identity is satisfied.
111
113.
⌊2x⌋ = ⌊x⌋+ ⌊x + 1
2
⌋ , x = n + r , 0 ≤ r 1
PROOF : (continued · · · )
Case 2 : 1
2
≤ r 1 : Then
1 ≤ 2r 2 and 1 ≤ r +
1
2
1 +
1
2
.
LHS : ⌊2x⌋ = ⌊2n + 2r⌋ = 2n + 1
RHS : ⌊x⌋ = ⌊n + r⌋ = n
⌊x +
1
2
⌋ = ⌊n + r +
1
2
⌋ = n + 1
so that the identity is satisfied. QED !
112
114.
Existence proofs.
• Mathematicalproblems often concern the existence, or non-existence,
of certain objects.
• Such problems may arise from the mathematical formulation of
problems that arise in many scientific areas.
• A proof that establishes the existence of a certain object is called
an existence proof.
113
115.
EXAMPLE : Forany 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,
n = 2 : (8,9) are 2 consecutive composite integers (m = 7),
n = 3 : (8,9,10) are 3 three consecutive composite integers (m = 7),
n = 4 : (24,25,26,27) are 4 consecutive composite integers (m = 23),
n = 5 : (32,33,34,35,36) are 5 consecutive composite integers (m = 31).
114
116.
∀n ∈ Z+
∃m∈ Z+
: m + i is composite , i = 1, · · · , n .
PROOF :
Let m = (n + 1)! + 1.
Then, clearly, the n consecutive integers
(n + 1)! + 1 + 1, (n + 1)! + 1 + 2, · · · , (n + 1)! + 1 + n ,
are composite. (Why ?) QED !
NOTE : This is a constructive existence proof : We demonstrated
the existence of m by showing its value (as a function of n).
115
117.
PROPOSITION : Thereare infinitely many prime numbers.
The idea of the proof (by contradiction) :
• Assume there is only a finite number of prime numbers.
• Then we’ll show ∃N 1 ∈ Z+
that is neither prime nor composite .
• But this is impossible !
• Thus there must be infinitely many prime numbers !
116
118.
PROOF :
Suppose thetotal number of primes is finite , say,
p1, p2, · · · , pn .
Let
N = p1p2 · · · pn + 1
• Then N cannot be prime. (Why not ?)
• Also, none of the p1, p2, · · · , pn divide N,
since N divided by pi gives a remainder of 1 , (i = 1, · · · , n) .
• Thus N cannot be composite either ! QED !
117
119.
NOTE :
• Thisproof is a non-constructive existence proof.
• We proved the existence of an infinite number of primes
without actually showing them !
118
120.
NOTE :
• Thereis no general recipe for proving a mathematical statement
and often there is more than one correct proof.
• One generally tries to make a proof as simple as possible,
so that others may understand it more easily.
• Nevertheless, proofs can be very difficult, even for relatively simple
statements such as Fermat’s Last Theorem :
¬∃x, y, z, n ∈ Z+
, n ≥ 3 : xn
+ yn
= zn
.
119
121.
NOTE :
• Thereare 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
122.
REVIEW EXERCISES.
Problem 1.Use a direct proof to show the following:
(p ∨ q) ∧ (q → r) ∧
(p ∧ s) → t
∧
¬q → (u ∧ s)
∧ ¬r ⇒ t .
(Assuming the left-hand-side is True , you must show that t is True .)
Problem 2. Let n be a positive integer.
Prove the following statement by proving its contrapositive:
”If n3
+ 2n + 1 is odd then n is even ”.
121
123.
Problem 3. Letn be an integer. Show that
3|n2
⇒ 3|n ,
by proving its contrapositive.
Hint : There are two cases to consider.
Problem 4. Give a direct proof to show the following:
The sum of the squares of any two rational numbers is a rational number.
122
124.
Problem 5.
Show thatfor all positive real x
if x is irrational then
√
x is irrational .
by proving the contrapositive .
Problem 6. Use a proof by contradiction to prove the following:
If the integers 1, 2, 3, · · · , 7, are placed around a circle, in any order,
then there exist two adjacent integers that have a sum greater than or
equal to 9 .
(Can you also give a direct Proof ?)
123
125.
FACT : Anyreal number x can be uniquely written as
x = n − r ,
where
n ∈ Z and r ∈ R , with 0 ≤ r 1 .
DEFINITION : We then define the ceiling of x as
⌈x⌉ ≡ n .
EXAMPLES : ⌈7⌉ = 7 , ⌈−7⌉ = −7 , ⌈π⌉ = 4 , ⌈−π⌉ = −3 .
Problem 7.
Is the following equality valid for all positive integers n and m ?
⌊
n + m
2
⌋ = ⌈
n
2
⌉ + ⌊
m
2
⌋ .
If Yes then give a proof. If No then give a counterexample.
124
126.
SET THEORY
Basic definitions.
•Let U be the collection of all objects under consideration.
(U is also called the “universe” of objects under consideration.)
• A set is a collection of objects from U.
125
127.
Let A ,B , and C be sets.
x ∈ A ⇐⇒ “x is an element (a member) of A”.
x /
∈ A ⇐⇒ ¬(x ∈ A)
A ⊆ B ⇐⇒ ∀x ∈ U : x ∈ A ⇒ x ∈ B subset
A = B ⇐⇒ (A ⊆ B) ∧ (B ⊆ A) equality
The above take values in {T , F }.
126
128.
The following areset-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
129.
Venn diagram.
This isa 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 :
B B
C
C
A
A
128
130.
The actual proofof 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
131.
EXAMPLE :
For thetwo sides of the identity
A − (B ∪ C) = (A − B) ∩ (A − C)
we have the following Venn diagrams :
B B
C
C
A
A
130
132.
The actual proofof 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
133.
EXAMPLE : A∩ B = A ∪ B ⇒ A = B
PROOF : ( a direct proof · · · )
Assume (A ∩ B) = (A ∪ B). We must show that A = B.
This is done in two stages :
(i) show 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
134.
Subsets.
S ⊆ Umeans S is a subset of a universal set U .
The set of all subsets of U is denoted by 2U
or P(U) , the power set .
This name is suggested by the following fact :
If U has n elements then P(U) has 2n
elements (sets) .
133
135.
EXAMPLE :
Let
U ={1 , 2 , 3} .
Then
P(U) =
n
{}, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}
o
.
We see that P(U) has 23
= 8 elements .
NOTE : The empty set ∅ = {} and U itself are included in P(U).
134
136.
Basic set theoreticidentities :
A ∪ B = B ∪ A A ∩ B = B ∩ A commutative laws
A ∪ (B ∩ C) = A ∩ (B ∪ C) =
(A ∪ B) ∩ (A ∪ C) (A ∩ B) ∪ (A ∩ C) distributive laws
A ∪ ∅ = A A ∩ U = A identity laws
A ∪ Ā = U A ∩ Ā = ∅ complement laws
135
137.
Some additional identities:
Ū = ∅ ¯
∅ = U
A ∪ A = A A ∩ A = A idempotent laws
A ∪ U = U A ∩ ∅ = ∅ domination laws
A ∪ (A ∩ B) = A A ∩ (A ∪ B) = A absorption laws
136
138.
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.
Note the close correspondence of these identities to the laws of logic.
137
139.
NOTE : Onecan also proceed axiomatically by only assuming :
• the existence of a power set P(U) , where U is a universal set ,
• special elements U and ∅ ,
• a unary operator ¯ , and two binary operators ∪ and ∩ ,
• the basic set theoretic identities .
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
140.
EXAMPLE :
Prove theidempotent law
A ∪ A = A
using only the basic set theoretic identities :
A = A ∪ ∅ identity law
A ∪ (A ∩ Ā) complement law
(A ∪ A) ∩ (A ∪ Ā) distributive law
(A ∪ A) ∩ U complement law
A ∪ A identity law
139
141.
EXAMPLE :
( toillustrate 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
142.
∀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 .
Then we must prove
∀x ∈ U : a(x) ∨ (a(x) ∧ b(x)) ⇐⇒ a(x) .
It suffices to prove that, for arbitrary logical variables a and b ,
a ∨ (a ∧ b) ⇐⇒ a .
But this is the absorption law from logic !
141
143.
REVIEW EXERCISES.
For eachof 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 ∩ 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
144.
FUNCTIONS
DEFINITIONS : LetA and B be sets.
Then f is called
a function from A to B
if to each element of A it associates exactly one element of B .
We write
f : A −→ B
and we call A the domain of f and B the codomain of f .
We also define the range of f to be
f(A) ≡ {b ∈ B : b = f(a) for some a ∈ A} .
143
145.
We say thatf is :
one-to-one (or injective) iff ∀a1, a2 ∈ A : a1 6= a2 ⇒ f(a1) 6= f(a2)
iff ∀a1, a2 ∈ A : f(a1) = f(a2) ⇒ a1 = a2
onto (or surjective) iff ∀b ∈ B ∃a ∈ A : f(a) = b
iff f(A) = B
bijective iff f is one-to-one and onto
144
146.
EXAMPLE :
Let
A ={a, b, c} , B = {1, 2} ,
and let f : A −→ B be defined by
f : a 7→ 1 , f : b 7→ 2 , f : c 7→ 1 .
Then f not one-to-one, but f is onto.
a
b
c
1
2
A B
145
147.
EXAMPLE :
Let
A ={a, b} , B = {1, 2, 3} ,
and let f : A −→ B be defined by
f : a 7→ 1 , f : b 7→ 3 .
Then f is one-to-one but not onto.
a
1
b
2
3
A B
146
148.
EXAMPLE :
Let A= B = Z+
, and let
f : Z+
−→ Z+
be defined by
f : n 7→
n(n + 1)
2
,
i.e.,
f(n) =
n(n + 1)
2
.
Then f is one-to-one but not onto.
147
149.
f(n) ≡ n(n+ 1)/2
PROOF : (1) f is not onto :
Here
f(Z+
) = { 1 , 3 , 6 , 10 , 15 , 21 , · · · } ,
so it seems that f is not onto.
To be precise, we show that f(n) can never be equal to 2 :
f(n) = 2 ⇐⇒ n(n + 1)/2 = 2 ⇐⇒ n2
+ n − 4 = 0 .
But this quadratic equation has no integer roots.
148
150.
(2) f isone-to-one : Assume that f(n1) = f(n2).
We must show that n1 = n2 :
f(n1) = f(n2) ⇐⇒ n1(n1 + 1)/2 = n2(n2 + 1)/2
⇐⇒ n2
1 + n1 = n2
2 + n2
⇐⇒ n2
1 − n2
2 = − (n1 − n2)
⇐⇒ (n1 + n2)(n1 − n2) = − (n1 − n2)
⇐⇒ n1 = n2 or n1 + n2 = − 1
However n1, n2 ∈ Z+
. Thus n1 + n2 cannot be negative.
It follows that n1 = n2. QED !
149
151.
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
7→
1 1
1 −1
m
n
.
Then f is one-to-one, but not onto.
150
152.
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 .
Add and subtract the equations, and divide by 2 to find
m1 = m2 and n1 = n2 ,
that is,
(m1, n1) = (m2, n2) .
Thus f is one-to-one.
151
153.
(ii) Not onto:
Let (s, d) ∈ Z2
be arbitrary. Can we solve
f(m, n) = (s, d) ,
i.e., can we solve
m + n = s ,
m − n = d ,
for m, n ∈ Z ?
Add and subtract the two equations, and divide by 2 to get
m =
s + d
2
and n =
s − d
2
.
However, m and n need not be integers, e.g., take s = 1, d = 2.
Thus f is not onto. QED !
152
154.
Given two functions
f: A −→ B and g : B −→ C ,
we can compose them :
(g ◦ f)(a) ≡ g
f(a)
.
A B C
f g
f(a) g(f(a))
a
o
g f
153
155.
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
156.
Inverses. Let
f :A −→ B ,
and
g : B −→ A .
Then g is called the inverse of f if
∀a ∈ A : g
f(a)
= a ,
and
∀b ∈ B : f
g(b)
= b .
If f has an inverse g then we say
f is invertible ,
and we write f−1
for g .
155
157.
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
158.
f(n) = n− 1 , f : Z −→ Z
It follows that f is invertible, with inverse
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
159.
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) = 1−y
2
. )
158
160.
f(x) = 1− 2x , f : R −→ R
We found that f is invertible, with inverse
f−1
(y) =
1 − y
2
.
Check ( not really necessary · · · ) :
f
f−1
(y)
= f((1 − y)/2) = 1 − 2
(1 − y)/2
= y ,
f−1
f(x)
= f−1
(1 − 2x) =
1 − (1 − 2x)
2
= x .
NOTE : We constructed f−1
(y) by solving f(x) = y for x .
159
161.
THEOREM :
f :A −→ B is invertible if and only if f is 1 − 1 and onto .
REMARK :
• It is not difficult to see that this theorem holds for finite sets.
• However, the proof also applies to infinite sets.
160
162.
PROOF :
(1a) Firstwe 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
g
f(a1)
= a1 , and g
f(a2)
= a2 ,
i.e.,
g(b0) = a1 , and g(b0) = a2 .
Thus g is not single-valued (not a function). Contradiction !
161
163.
(1b) Now weshow that if f is invertible then f is onto.
By contradiction: Suppose f is invertible but not onto.
Since f is not onto there exists b0 ∈ B such that
f(a) 6= b0, ∀a ∈ A .
Since f is invertible there is a function g : B −→ A such that
f
g(b)
= b, ∀b ∈ B .
In particular
f
g(b0)
= b0 , where g(b0) ∈ A .
But this contradicts that f(a) 6= b0, ∀a ∈ A .
162
164.
(2a) Next weshow that if f is 1 − 1 and onto then f is invertible.
Define a function g : B −→ A as follows :
Since f is 1 − 1 and onto we have that for any b ∈ B
b = f(a) for some unique a ∈ A .
For each such a ∈ A set
g(b) = a .
Then g : B −→ A , and by construction
f
g(b)
= f(a) = b .
163
165.
(2b) We stillmust show that ∀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 ,
where both g(b0) and a0 lie in A .
Since f is one-to-one it follows that
f
g(b0)
6= f(a0) ,
i.e.,
f
g(b0)
6= b0 .
But this contradicts the result of (2a) ! QED !
164
166.
EXAMPLE :
• Definef : 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 · · ·
Using calculus one can show that f(n) is increasing for n ≥ 3.
Thus f is not onto ; for example,
∀n ∈ Z+
: f(n) 6= 2 .
165
167.
• Now let
S= f(Z+
) = {1, 4, 7, 19, 52, 109, · · ·} ,
and consider f as a function
f : Z+
−→ S .
Then f is onto, but still not one-to-one, since f(2) = f(4) = 4.
• Finally let
D = Z+
− {2} ,
and consider f as a function
f : D −→ S .
Now f is one-to-one and onto, and hence invertible.
166
168.
EXAMPLE : Thefloor and ceiling functions.
FACT :
∀x ∈ R ∃ ! n ∈ Z and ∃ ! r ∈ R with 0 ≤ r 1 such that
x = n + r .
We already defined the floor function, ⌊·⌋ , as
⌊x⌋ = n .
EXAMPLES :
⌊π⌋ = 3 , ⌊e⌋ = 2 , ⌊3⌋ = 3 , ⌊−7/2⌋ = − 4 ,
where e = 2.71828 · · · .
167
169.
FACT :
∀x ∈R ∃ ! n ∈ Z and ∃ ! r ∈ R with 0 ≤ r 1 such that
x = n − r .
We already defined the ceiling function, ⌈·⌉ , as
⌈x⌉ = n .
EXAMPLES :
⌈π⌉ = 4 , ⌈e⌉ = 3 , ⌈3⌉ = 3 , ⌈−7/2⌉ = − 3 .
168
170.
We see that
⌊·⌋: R −→ Z ,
and
⌈·⌉ : R −→ Z .
EXERCISE :
• Is ⌊·⌋ one-to-one? onto? invertible?
• Is ⌈·⌉ one-to-one? onto? invertible?
• Draw the graphs of ⌊·⌋ and ⌈·⌉ .
169
171.
EXAMPLE : Letp , k ∈ Z+
.
Then
⌈
p
k
⌉
p + k
k
.
PROOF :
By definition of the ceiling function we can write
p
k
= ⌈
p
k
⌉ − r ,
where 0 ≤ r 1 .
Hence
⌈
p
k
⌉ =
p
k
+ r
p
k
+ 1 =
p + k
k
. QED !
170
172.
EXAMPLE : Showthat the linear function
f : R2
−→ R2
defined by
f(x, y) = (x + y , x − y) ,
or, in matrix form,
f :
x
y
7→
1 1
1 −1
x
y
,
is one-to-one and onto.
• One-to-one : Exercise!
Hint : See the earlier example where this function was considered as
f : Z2
−→ Z2
.
171
173.
• Onto :
f(x,y) = (x + y , x − y) or f :
x
y
7→
1 1
1 −1
x
y
We can construct the inverse by solving
f(x, y) = (s, d) ,
that is, by solving
x + y = s , x − y = d ,
for x, y ∈ R :
x =
s + d
2
, y =
s − d
2
.
Thus the inverse is
g(s, d) = (
s + d
2
,
s − d
2
) or g :
s
d
7→
1
2
1
2
1
2 −1
2
s
d
.
172
174.
f(x, y) =(x + y , x − y) , g(s, d) = (s+d
2
, s−d
2
)
Check ( not really necessary · · · ) :
f(g(s, d)) = f(
s + d
2
,
s − d
2
)
= (
s + d
2
+
s − d
2
,
s + d
2
−
s − d
2
) = (s, d) ,
and
g(f(x, y)) = g(x + y , x − y)
= (
(x + y) + (x − y)
2
,
(x + y) − (x − y)
2
) = (x, y) .
173
175.
EXAMPLE :
More generally,a function
f : R2
−→ R2
is linear if it can be written as
f(x, y) = ( a11 x + a12 y , a21 x + a22 y ) ,
or equivalently, as matrix-vector multiplication ,
f :
x
y
7→
a11 a12
a21 a22
x
y
,
where aij ∈ R , (i, j = 1, 2) .
174
176.
f : R2
−→R2
, f :
x
y
7→
a11 a12
a21 a22
x
y
This function is invertible if the determinant
D ≡ a11a22 − a12a21 6= 0 .
In this case the inverse is given by
f−1
:
s
d
7→
1
D
a22 −a12
−a21 a11
s
d
.
EXERCISE : Check that
f−1
(f(x, y)) = (x, y) and f(f−1
(s, d)) = (s, d) .
175
177.
Now consider thesame linear function
f :
n
m
7→
a11 a12
a21 a22
n
m
,
but with aij ∈ Z , (i, j = 1, 2) , and as a function
f : Z2
−→ Z2
.
Is
f−1
:
s
d
7→
1
D
a22 −a12
−a21 a11
s
d
.
still the inverse?
176
178.
ANSWER : Notin general !
f is now invertible only if the determinant
• D = a11a22 − a12a21 6= 0,
and
• ∀i, j : D | aij .
In this case f−1
is still given by
f−1
:
s
d
7→
1
D
a22 −a12
−a21 a11
s
d
.
177
179.
EXERCISE : Showthat
f :
n
m
7→
3 2
4 3
n
m
,
is invertible as a function f : Z2
−→ Z2
.
What is the inverse?
EXERCISE : Show that
f :
n
m
7→
3 1
4 3
n
m
,
is not invertible as a function f : Z2
−→ Z2
.
178
180.
REVIEW EXERCISES.
Problem 1.
Define
f: R −→ R
by
f(x) ≡
1/x if x 6= 0 ,
0 if x = 0 .
• Draw the graph of f .
• Is f one-to-one?
• Is f onto?
• What is f−1
?
179
181.
Problem 2. Considera function
f : A −→ B .
For each of the following, can you find a function f that is
(i) one-to-one (ii) onto (iii) one-to-one and onto ?
• A = {1, 2, 3} , B = {1, 2}
• A = {1, 2} , B = {1, 2, 3}
• A = {all even positive integers} , B = {all odd positive integers}
180
182.
Problem 3.
Can youfind 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. Let Sn be a finite set of n elements.
Show that a function
f : Sn −→ Sn
is one-to-one if and only if it is onto.
181
183.
Problem 5. Letf : A −→ B and g : B −→ C be functions.
• Suppose f and g are one-to-one.
Is the composition g ◦ f necessarily one-to-one?
• Suppose the composition g ◦ f is one-to-one.
Are f and g necessarily one-to-one?
• Suppose f and g are onto.
Is the composition g ◦ f necessarily onto?
• Suppose the composition g ◦ f is onto.
Are f and g necessarily onto?
Justify your answers.
182
184.
Problem 6.
Let P2denote 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 .
Let P1 denote the set of all polynomials of degree 1 or less ,
i.e., polynomials of the form
p(x) = d x + e , d, e ∈ R , x ∈ R .
Consider the derivative function (or derivative operator )
D : P2 −→ P1 .
183
185.
For example,
D :3x2
+ 7x − 4 7→ 6x + 7 ,
and
D : 5x − 2π 7→ 5 .
QUESTIONS :
• Is D indeed a function from P2 to P1 ?
• Is D one-to-one ?
• Is D onto ?
• Does D have an inverse ?
184
186.
Problem 7. IfA and B are sets, and if
f : A −→ B ,
then for any subset S of A we define the image of S as
f(S) ≡ {b ∈ B : b = f(a) for some a ∈ S} .
Let S and T be subsets of A . Prove that
• f(S ∪ T) = f(S) ∪ f(T) ,
• f(S ∩ T) ⊆ f(S) ∩ f(T) .
• Also give an example that shows that in general
f(S ∩ T) 6= f(S) ∩ f(T) .
185
187.
Problem 8. IfA and B are sets, and if
f : A −→ B ,
then for any subset S of B we define the pre-image of S as
f−1
(S) ≡ {a ∈ A : f(a) ∈ S} .
NOTE : f−1
(S) is defined even if f does not have an inverse!
Let S and T be subsets of B . Prove that
• f−1
(S ∪ T) = f−1
(S) ∪ f−1
(T) ,
• f−1
(S ∩ T) = f−1
(S) ∩ f−1
(T) .
186
188.
THE DIVISION THEOREM:
∀n ∈ Z, ∀d ∈ Z+
, ∃! q, r ∈ Z : ( 0 ≤ r d , n = qd + r ) .
EXAMPLE : If n = 21 and d = 8 then
n = 2 · d + 5 .
Thus, here q = 2 and r = 5 .
• d is called the divisor,
• q is called the quotient; we write q = n div d ,
• r is called the remainder; we write r = n mod d .
187
189.
EXAMPLES :
n =14 , d = 5 : 14 = 2 · d + 4 , so
14 div 5 = 2 and 14 mod 5 = 4 .
n = −14 , d = 5 : −14 = (−3) · d + 1 , so
−14 div 5 = − 3 and − 14 mod 5 = 1 .
188
190.
Let d ∈Z+
and n, q, r ∈ Z .
From the definitions of “div” and “mod” it follows that :
PROPERTY 1 : n = (n div d) d + n mod d
Example : 23 = (23 div 7) · 7 + 23 mod 7
PROPERTY 2 : If 0 ≤ r d then (qd + r) mod d = r
Example : (5 · 7 + 3) mod 7 = 3
PROPERTY 3 : (qd + n mod d) mod d = n mod d
Example : (5 · 7 + 23 mod 7) mod 7 = 23 mod 7
189
191.
PROPERTY 4 :Let a, b ∈ Z and d ∈ Z+
. Then
(ad + b) mod d = b mod d .
PROOF :
By the Division Theorem
b = qd + r, where r = b mod d , with 0 ≤ r d .
Thus, using Property 2
(ad + b) mod d =
(a + q)d + r
mod d = r = b mod d .
QED !
EXAMPLE : (57 · 7 + 13) mod 7 = 13 mod 7 .
190
192.
PROPERTY 5 :Let a ∈ Z and d ∈ Z+
. Then
(a mod d) mod d = a mod d .
PROOF : Using Property 3,
(a mod d) mod d = (0 · d + a mod d) mod d = a mod d .
EXAMPLE :
(59 mod 7) mod 7 = 59 mod 7 .
191
193.
PROPERTY 6 :
Leta, 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
194.
PROOF :
By theDivision Theorem
a = qad + ra , where ra = a mod d , with 0 ≤ ra d ,
b = qbd + rb , where rb = b mod d , with 0 ≤ rb d .
Thus
(a + b) mod d = (qad + ra + qbd + rb) mod d
=
(qa + qb)d + ra + rb
mod d
= (ra + rb) mod d (using Property 4)
= (a mod d + b mod d) mod d . QED !
193
195.
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) .
Note that 83 − 31 = 52 , which is divisible by 26 , i.e.,
26 | (83 − 31) .
194
196.
PROPOSITION : Leta, b ∈ Z , and d ∈ Z+
. Then
a ≡ b (mod d) 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 = qad + r and b = qbd + r (same remainder).
It follows that
a − b = (qa − qb) d ,
so that d | (a − b).
195
197.
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
198.
PROPOSITION : Ifa, b ∈ Z , and c, d ∈ Z+
, then
a ≡ b (mod d) ⇒ ac ≡ bc (mod dc) .
PROOF :
a ≡ b (mod d) if and only if d | (a − b) ,
i.e.,
a − b = qd , for some q ∈ Z .
Then ac − bc = qdc , so that (dc) | (ac − bc) ,
i.e.,
ac ≡ bc (mod dc) .
NOTE : We also have that ac ≡ bc (mod d) .
197
199.
PROPOSITION : Leta, b ∈ Z and d ∈ Z+
. Then
a ≡ b (mod 2d) ⇒ a2
≡ b2
(mod 4d) .
EXAMPLE : Let a = 13 , b = 7 d = 3 . 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
200.
a ≡ b(mod 2d) ⇒ a2
≡ b2
(mod 4d)
PROOF : Suppose a ≡ b (mod 2d) .
Then 2d|(a − b) , i.e., a − b = q2d , for some q ∈ Z .
Thus a and b differ by an even number.
It follows that a and b must be both even or both odd.
Hence a + b must be even, i.e., a + b = 2c for some c ∈ Z .
Then a2
− b2
= (a + b) (a − b) = (2c) (q2d) = cq 4d .
It follows that 4d|(a2
− b2
) , i.e., a2
≡ b2
(mod 4d) . QED !
NOTE : Also a2
≡ b2
(mod 2d) and a2
≡ b2
(mod d) .
199
201.
PROPOSITION : Ifn 3 then not all of
n , n + 2 , n + 4 ,
can be primes.
Idea of the proof : Always one of these three numbers is divisible by 3 .
PROOF. By contradiction : Assume that n 3 and that
n , n + 2 and n + 4 are primes .
Since n is prime and n 3 we have
n mod 3 = 1 or n mod 3 = 2 . (Why ?)
Case 1 : If n mod 3 = 1 then n = 3k + 1 and
n + 2 = 3k + 3 , i.e., 3|(n + 2) .
Case 2 : If n mod 3 = 2 then n = 3k + 2 and
n + 4 = 3k + 6 , i.e., 3|(n + 4) .
Contradiction !
200
202.
THE FACTORIZATION THEOREM:
∀n ∈ (Z+
− {1}) , ∃!
m, {pi}m
i=1, {ni}m
i=1
:
m ∈ Z+
,
∀i (i = 1, · · · , m) : pi, ni ∈ Z+
,
1 p1 p2 · · · pm ,
∀i (i = 1, · · · , m) : pi is a prime number ,
n = pn1
1 pn2
2 · · · pnm
m .
EXAMPLE : 252 = 22
32
71
.
201
203.
PROPOSITION : log23is irrational.
PROOF : By contradiction:
Suppose log23 is rational, i.e., ∃p, q ∈ Z+
, such that
log23 = p/q .
By definition of the log function it follows that
2p/q
= 3 ,
from which
2p
= 3q
.
Let n = 2p
. Then n ∈ Z+
, with n ≥ 2 .
Then n has two different prime factorizations, namely
n = 2p
and n = 3q
.
This contradicts the Factorization Theorem. QED !
202
204.
REMARK :
The factthat
2p
6= 3q
,
also follows from the facts that 2p
is even and 3q
is odd.
203
205.
DEFINITION :
We calln ∈ 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 · · · pnm
m ,
then
n = k2
= p2n1
1 p2n2
2 · · · p2nm
m .
204
206.
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
√
n =
p
q
,
i.e.,
p2
= n q2
,
for some p, q ∈ Z+
.
205
207.
p2
= n q2
•The prime factorization of p2
has even powers only.
• The prime factorization of q2
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 nq2
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
208.
DEFINITION :
k ∈Z+
is the greatest common divisor of n, m ∈ Z+
,
k = gcd(n, m) ,
if
• k|n and k|m ,
• no positive integer greater than k divides both n and m .
207
209.
REMARK :
One candetermine
gcd( n , m )
from the minimum exponents in the prime factorizations of n and m.
EXAMPLE : If
n = 168 , m = 900 ,
then
n = 23
31
71
, m = 22
32
52
,
and
gcd(168, 900) = 22
31
= 12 .
208
210.
THE EUCLIDEAN THEOREM:
Let n , d ∈ Z+
, and let
r = n mod d , (the remainder)
Then
gcd(n, d) =
gcd(d , r) if r 0 ,
d if r = 0 .
209
211.
EXAMPLE :
gcd(93 ,36) = gcd(36 , 93 mod 36) = gcd(36 , 21)
= gcd(21 , 36 mod 21) = gcd(21 , 15)
= gcd(15 , 21 mod 15) = gcd(15 , 6)
= gcd(6 , 15 mod 6) = gcd(6 , 3)
= 3 .
210
212.
EXAMPLE :
gcd(2008 ,1947) = gcd(1947 , 2008 mod 1947) = gcd(1947 , 61)
= gcd(61 , 1947 mod 61) = gcd(61 , 56)
= gcd(56 , 61 mod 56) = gcd(56 , 5)
= gcd(5 , 56 mod 5) = gcd(5 , 1)
= 1 .
Thus 2008 and 1947 are relatively prime .
211
213.
LEMMA :
Let a,b, c ∈ Z , and d ∈ Z+
.
Then
(1) ( a = b + c , d|a , d|b ) ⇒ d|c ,
(2) ( a = b + c , d|b , d|c ) ⇒ d|a ,
(3) ( a = bc , d|c ) ⇒ d|a .
212
214.
(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 .
EXERCISE : Prove (2) and (3) in a similar way.
213
215.
gcd(n, d) =
gcd(d,r) if r 0
d if r = 0
PROOF OF THE EUCLIDEAN THEOREM :
By the Division Theorem
n = q · d + r ,
where
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
216.
gcd(n, d) =
gcd(d,r) if r 0
d if r = 0
Case 2 : 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 .
Thus k divides both d and r .
215
217.
gcd(n, d) =
gcd(d,r) if r 0
d if r = 0
k = gcd(n, d) , n = q · d + r .
Show k is the greatest common divisor of d and 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
218.
REVIEW EXERCISES.
Problem 1.
Provethat a composite number n has a factor k ≤
√
n .
Thus to check if a number n is prime one needs only check whether
n mod k = 0 , k = 2, 3, · · · , ⌊
√
n⌋ .
Problem 2. Use the above fact to check whether 143 is prime.
217
219.
Problem 3. Findall integer solutions of
2x ≡ 7(mod 17) .
Problem 4. Find all integer solutions of
4x ≡ 5(mod 9) .
Problem 5.
Does there exists an integer x that simultaneously satisfies
x ≡ 2(mod 6) and x ≡ 3(mod 9) ?
218
220.
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?
Problem 7. with S as above, also consider
f(k) = (6k + 3) mod 10 ,
and
f(k) = (7k + 3) mod 10 .
219
221.
Problem 8. Letn ≥ 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 .
Prove that f is one-to-one (and hence onto and invertible ).
220
222.
THE PRINCIPLE OFINDUCTION
Let
S = { s1 , s2 , s3 , · · · }
be a countably infinite set .
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 , for all s ∈ S .
221
223.
EXAMPLE :
n
X
k=1
k =
n(n+ 1)
2
, ∀n ∈ Z+
.
Here S = Z+
and
P(n) = T if
n
X
k=1
k =
n(n + 1)
2
,
and
P(n) = F if
n
X
k=1
k 6=
n(n + 1)
2
.
We must show that P(n) = T for all n .
222
224.
PROOF :
(i) “Byinspection” the formula holds if n = 1 , i.e., P(1) = T .
(ii) Suppose P(n) = T for some arbitrary n ∈ Z+
, i.e.,
n
X
k=1
k =
n(n + 1)
2
.
We must show that P(n + 1) = T , i.e.,
n+1
X
k=1
k =
(n + 1)
(n + 1) + 1
2
.
This is done as follows:
n+1
X
k=1
k =
n
X
k=1
k
+ (n + 1) =
n(n + 1)
2
+ (n + 1)
=
(n + 1)
(n + 1) + 1
2
. QED !
223
225.
EXAMPLE :
n
X
k=1
k2
=
n(n +1)(2n + 1)
6
, ∀n ∈ Z+
.
PROOF :
(i) Again the formula is valid if n = 1 .
(ii) Suppose
n
X
k=1
k2
=
n(n + 1)(2n + 1)
6
,
for some arbitrary n ∈ Z+
.
We must show that
n+1
X
k=1
k2
=
(n + 1)
(n + 1) + 1
2(n + 1) + 1
6
.
224
EXAMPLE :
(n3
− n)mod 3 = 0 , ∀n ∈ Z+
.
PROOF :
(i) By inspection P(1) = T .
(ii) Suppose P(n) = T , i.e.,
(n3
− n) mod 3 = 0 , for some arbitrary n ∈ Z+
.
We must show that P(n + 1) = T , i.e.,
(n + 1)3
− (n + 1)
mod 3 = 0 .
226
228.
(n3
− n) mod3 = 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
229.
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 because the empty set has one subset, namely itself.
(ii) Suppose that P(n) = T for some arbitrary n , ( n ≥ 0 ) ,
i.e., Sn has 2n
subsets.
We must show that P(n+1) = T , i.e., Sn+1 has 2n+1
subsets.
228
230.
To do thiswrite
Sn+1 = { s1 , s2 , · · · , sn , sn+1 } = Sn ∪ {sn+1} .
Now count the subsets of Sn+1 :
(a) By inductive hypothesis Sn has 2n
subsets.
These are also subsets of Sn+1 .
(b) All other subsets of Sn+1 have the form
T ∪ {sn+1} ,
where T is any subset of Sn .
Thus there are 2n
such additional subsets.
The total number of subsets of Sn+1 is therefore
2n
+ 2n
= 2n+1
. QED !
229
231.
EXAMPLE :
Let P(n)denote the statement
3n
n!
CLAIM :
P(n) = T for all integers n with n 6 .
REMARK : P(n) is False for n ≤ 6 . (Check!)
230
232.
PROOF :
(i) P(7)= T , because
37
= 2187 5040 = 7!
(ii) Assume P(n) = T for some arbitrary n , (n ≥ 7) ,
i.e.,
3n
n! (n ≥ 7) .
We must show that P(n + 1) = T , i.e.,
3n+1
(n + 1)!
231
233.
3n
n! ⇒3n+1
(n + 1)!
To do this :
3n+1
= 3 · 3n
3 · n! (by inductive assumption)
(n + 1) n! (since n ≥ 7)
= (n + 1)!
232
234.
EXERCISE : Forwhich nonnegative integers is
n2
≤ n! ?
Prove your answer by induction.
EXERCISE : For which positive integers n is
n2
≤ 2n
?
Prove your answer by induction.
233
235.
EXAMPLE :
Let
Hm ≡
m
X
k=1
1
k
.(”Harmonic numbers.”)
Let P(n) denote the statement
H2n ≥ 1 +
n
2
.
CLAIM : P(n) = T for all n ∈ Z+
.
PROOF :
(i) It is clear that P(1) = T , because
H21 =
2
X
k=1
1
k
= 1 +
1
2
.
234
236.
(ii) Assume that
P(n)= T for some arbitrary n ∈ Z+
,
i.e.,
H2n ≥ 1 +
n
2
.
We must show that
P(n + 1) = T ,
i.e.,
H2n+1 ≥ 1 +
n + 1
2
.
235
237.
To do this:
H2n+1 =
2n+1
X
k=1
1
k
=
2n
X
k=1
1
k
+
2n+1
X
k=2n+1
1
k
=
2n
X
k=1
1
k
+
2n+2n
X
k=2n+1
1
k
≥ (1 +
n
2
) + 2n 1
2n + 2n
= (1 +
n
2
) +
1
2
= 1 +
n + 1
2
. QED !
236
238.
REMARK :
It followsthat
∞
X
k=1
1
k
diverges ,
i.e.,
n
X
k=1
1
k
−→ ∞ as n −→ ∞ .
237
239.
EXAMPLE : (TheBinomial Formula.)
For n ≥ 0 , a, b nonzero,
(a + b)n
=
n
X
k=0
n
k
an−k
bk
,
where
n
k
≡
n!
k! (n − k)!
.
REMARK : Thus we can write
(a+b)n
= an
+
n
1
an−1
b+
n
2
an−2
b2
+· · ·+
n
n − 1
abn−1
+bn
.
238
240.
PROOF :
The formulaholds if n = 0 . (Check!)
Assume that for some arbitrary n, ( n ≥ 0 )
(a + b)n
=
n
X
k=0
n
k
an−k
bk
.
We must show that the formula is also valid for n + 1 , i.e., that
(a + b)n+1
=
n+1
X
k=0
n + 1
k
an+1−k
bk
.
239
241.
This can bedone as follows :
(a + b)n+1
= (a + b)(a + b)n
= (a + b)
n
X
k=0
n
k
an−k
bk
= an+1
+
n
X
k=1
n
k
an−k+1
bk
+
n−1
X
k=0
n
k
an−k
bk+1
+ bn+1
= an+1
+
n
X
k=1
n
k
an−k+1
bk
+
n
X
k=1
n
k − 1
an−k+1
bk
+ bn+1
= an+1
+
n
X
k=1
n
n
k
+
n
k − 1
o
an−k+1
bk
+ bn+1
= an+1
+
n
X
k=1
n + 1
k
an−k+1
bk
+ bn+1
=
n+1
X
k=0
n + 1
k
an+1−k
bk
. QED !
240
242.
REMARK :
In theproof we used the fact that
n
k
+
n
k − 1
=
n!
k! (n − k)!
+
n!
(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
Observe that everyentry can be obtained by summing the closest entries
in the preceding row.
This is so because the (n + 1)st and (n + 2)nd rows look like :
1 · · · · · · · · ·
n
k − 1
n
k
· · · · · · · · · 1
1 · · · · · · · · ·
n + 1
k
· · · · · · · · · 1
and we have shown above that
n
k
+
n
k − 1
=
n + 1
k
.
243
245.
REMARKS :
• Theadvantage of a proof by induction is that it is systematic.
• A disadvantage is that the result (e.g., a formula) must be known in
advance from a heuristic argument or by trial and error.
• In contrast, a constructive proof actually derives the result.
244
246.
EXAMPLE : Forx ∈ R , x 6= 0, 1 :
n
X
k=0
xk
=
1 − xn+1
1 − x
, ∀n ≥ 0 , ( Geometric sum ) .
PROOF ( a constructive proof : already done earlier ) :
Let
Sn =
n
X
k=0
xk
.
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
,
from which the formula follows. QED !
245
247.
ALTERNATE PROOF (by induction ) :
(i) “By inspection” we find that the formula holds if n = 0 .
(ii) Suppose that Sn = 1−xn+1
1−x
, for some arbitary n, ( n ≥ 0 ) .
Show Sn+1 = 1−x(n+1)+1
1−x
:
Sn+1 = Sn + xn+1
=
1 − xn+1
1 − x
+ xn+1
=
(1 − xn+1
) + xn+1
(1 − x)
1 − x
=
1 − xn+1
+ xn+1
− xn+2
1 − x
=
1 − x(n+1)+1
1 − x
. QED !
246
248.
EXERCISE :
Use mathematicalinduction to prove that
21 | (4n+1
+ 52n−1
) ,
whenever n is a positive integer.
EXERCISE :
The Fibonacci numbers are defined as: f1 = 1 , f2 = 1 , and
fn = fn−1 + fn−2 , for n ≥ 3 .
Use a proof by induction to show that
3 | f4n ,
for all n ≥ 1 .
247
249.
Variations on thePrinciple of Induction.
Let S = { s1, s2, s3, · · · } be a countably infinite set and P a predicate :
P : S −→ { T , F } .
VARIATION 1 : ( as used so far · · · )
P(s1) ∧
h
∀n ≥ 1 : P(sn) ⇒ P(sn+1)
i
⇒ ∀n : P(sn) .
VARIATION 2 :
P(s1) ∧ P(s2) ∧
h
∀n ≥ 2 : P(sn−1) ∧ P(sn) ⇒ P(sn+1)
i
⇒ ∀n : P(sn) .
VARIATION · · ·
STRONG INDUCTION :
P(s1) ∧ ∀n ≥ 1 :
h
P(s1) ∧ P(s2) ∧ · · · ∧ P(sn) ⇒ P(sn+1)
i
⇒ ∀n : P(sn) .
248
250.
EXAMPLE : TheFibonacci Numbers.
The Fibonacci numbers are defined recursively as
f1 = 1 ,
f2 = 1 ,
fn = fn−1 + fn−2 , for n ≥ 3 .
249
fn = 1
√
5
h
1+
√
5
2
n
−
1−
√
5
2
n i
PROOF (By Induction, using Variation 2) :
The formula is valid when n = 1 :
f1 =
1
√
5
h 1 +
√
5
2
−
1 −
√
5
2
i
= 1 .
The formula is also valid when n = 2 :
f2 =
1
√
5
h 1 +
√
5
2
2
−
1 −
√
5
2
2 i
=
1
√
5
√
5 = 1 .
(Check!)
254
256.
Inductively, assume thatwe have
fn−1 =
1
√
5
h 1 +
√
5
2
n−1
−
1 −
√
5
2
n−1 i
,
and
fn =
1
√
5
h 1 +
√
5
2
n
−
1 −
√
5
2
n i
.
We must show that
fn+1 =
1
√
5
h 1 +
√
5
2
n+1
−
1 −
√
5
2
n+1 i
.
255
257.
Using the inductivehypothesis for n and n − 1 we have
fn+1 = fn−1 + fn (by definition)
=
1
√
5
h 1 +
√
5
2
n−1
−
1 −
√
5
2
n−1
+
1 +
√
5
2
n
−
1 −
√
5
2
n i
=
1
√
5
h 1 +
√
5
2
n−1
1 +
1 +
√
5
2
−
1 −
√
5
2
n−1
1 +
1 −
√
5
2
i
=
1
√
5
h 1 +
√
5
2
n−1 3 +
√
5
2
−
1 −
√
5
2
n−1 3 −
√
5
2
i
=
1
√
5
h 1 +
√
5
2
n−1 1 +
√
5
2
2
−
1 −
√
5
2
n−1 1 −
√
5
2
2 i
=
1
√
5
h 1 +
√
5
2
n+1
−
1 −
√
5
2
n+1 i
. QED !
256
258.
Direct solution ofthe Fibonacci recurrence relation.
f1 = 1 , f2 = 1 ,
fk = fk−1 + fk−2 , for k ≥ 3 .
Try solutions of the form
fn = c zn
,
This gives
c zn
= c zn−1
+ c zn−2
, or zn
− zn−1
− zn−2
= 0 ,
from which we obtain the characteristic equation
z2
− z − 1 = 0 .
257
259.
z2
− z −1 = 0
The characteristic equation has solutions (“roots”):
z =
1 ±
√
1 + 4
2
,
that is,
z1 =
1 +
√
5
2
, z2 =
1 −
√
5
2
.
The general solution of the recurrence relation is then
fn = c1 zn
1 + c2 zn
2 .
258
260.
fn = c1zn
1 + c2 zn
2
The constants c1 and c2 are determined by the initial conditions :
f1 = 1 ⇒ c1 z1 + c2 z2 = 1 ,
and
f2 = 1 ⇒ c1 z2
1 + c2 z2
2 = 1 ,
that is,
c1
1 +
√
5
2
+ c2
1 −
√
5
2
= 1 ,
and
c1
1 +
√
5
2
2
+ c2
1 −
√
5
2
2
= 1 ,
from which we find
c1 =
1
√
5
and c2 = −
1
√
5
. (Check!)
259
261.
fn = c1zn
1 + c2 zn
2
We found that
z1 =
1 +
√
5
2
, z2 =
1 −
√
5
2
.
and
c1 =
1
√
5
and c2 = −
1
√
5
. (Check!)
from which
fn =
1
√
5
1 +
√
5
2
n
−
1
√
5
1 −
√
5
2
n
.
260
262.
REVIEW EXERCISES.
Problem 1.
Provethat the Fibonacci numbers satisfy the following relations:
•
Pn
k=1 f2k−1 = f2n , for n ∈ Z+
.
• fn−1 fn+1 − f2
n = (−1)n
, for n ∈ Z+
, (n ≥ 2) .
• −f1 + f2 − f3 + · · · − f2n−1 + f2n = f2n−1 − 1 , for n ∈ Z+
.
261
263.
Problem 2. Therecurrence 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
Problem 3. Find an explicit solution to the recurrence relation
xn+1 = 3 xn − 2 xn−1 , n = 1, 2, 3, · · · ,
with x1 = 1 and x2 = 3 .
262
264.
RELATIONS
A binary relationrelates elements of a set to elements of another set.
EXAMPLE :
The operator “≤” relates elements of Z to elements of Z. e.g.,
2 ≤ 5 , and 3 ≤ 3 , but 7 6≤ 2 .
We can also view this relation as a function
≤ : Z × Z −→ {T , F } .
263
265.
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
266.
NOTE :
• Theproduct set A × B has nA · nB elements.
• If A and B are distinct and nonempty then A × B 6= B × A.
EXAMPLE :
If
A = { ! , ? } and B = { • , ◦ , } ,
then
A × B = { (!, •) , (!, ◦) , (!, ) , (?, •) , (?, ◦) , (?, ) } .
265
267.
We can nowequivalently define :
DEFINITION :
A binary relation R from A to B is a subset of A × B.
NOTATION :
If R ⊆ A × B, and
(a, b) ∈ R ,
then we say that
“a is R-related to b”,
and we also write
a R b .
266
268.
EXAMPLE :
Let A= {1, 3} and B = {3, 5, 9}.
Let R denote the relation “divides” from A to B, i.e.,
aRb 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
269.
We can representR by the following diagram
3
A B
1
3
5
9
R
This representation is an example of a directed bipartite graph.
Note that R is not a function, since it is multi-valued.
268
270.
REMARK :
We seethat a relation generalizes the notion of a function.
Unlike functions from a set A to a set B :
• A relation does not have to be defined for all a ∈ A .
• A relation does not have to be single-valued.
269
271.
A finite relationfrom a set A into itself can be represented
by an ordinary directed graph.
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” .
This relation has the following directed graph representation :
270
We can composerelations as follows :
Let R be a relation from A to B , and S a relation from B to C.
B C
R
S
S
A
R
o
Then S ◦ R is the relation from A to C defined by
a(S ◦ R)c if and only if ∃b ∈ B : aRb ∧ bSc .
272
274.
EXAMPLE :
Let
A ={1, 2, 3}, B = {2, 6}, and C = {1, 9, 15},
and define the relations R and S by
aRb if and only if a|b ,
and
bSc if and only if b + c is prime .
Define
T = S ◦ R .
273
275.
Then from thediagram below we see that
T = { (1, 1) , (1, 9) , (1, 15) , (2, 1) , (2, 9) , (2, 15) , (3, 1) } .
C
R
S
S
A
R
o
1
2
3
2
6
1
9
15
B
= T
274
276.
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 :
The composition of relations is associative, i.e.,
(T ◦ S) ◦ R = T ◦ (S ◦ R) .
A B C
R S T
R
T
S
S R
o
o o
o
T S
D
275
277.
A B C
RS T
R
T
S
S R
o
o o
o
T S
D
(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 ∧ cTd)
⇐⇒ ∃c ∈ C, ∃b ∈ B : (aRb ∧ bSc ∧ cTd)
⇐⇒ ∃c ∈ C : (aS ◦ Rc ∧ cTd) ⇐⇒ aT ◦ (S ◦ R)d .
QED !
276
278.
EXAMPLE : Letthe relation R on
A = { 2, 3, 4, 8, 9, 12 } ,
be defined by
(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
EXAMPLE :
Let Rbe the relation on the set of all real numbers defined by
xRy if and only if xy = 1
Then
xR2
z ⇐⇒ ∃y : xRy and yRz
⇐⇒ ∃y : xy = 1 and yz = 1
⇐⇒ x = z and x 6= 0 . (Why ?)
279
281.
The last equivalencein detail:
∃y : xy = 1 and yz = 1 if and only if x = z and x 6= 0 .
PROOF : (⇒) Let x and z be real numbers, and assume that
∃y : xy = 1 and yz = 1 .
Then x and z cannot equal zero.
Thus we can write
y =
1
x
and y =
1
z
.
Hence 1/x = 1/z, i.e., x = z.
Thus x = z and x 6= 0 .
280
282.
∃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
283.
Similarly
xR3
z ⇐⇒ ∃y: xR2
y and yRz
⇐⇒ ∃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 · · ·
Thus we see that
Rn
= R2
if n is even ,
and
Rn
= R if n is odd .
282
284.
EXAMPLE :
Let Rbe the relation on the real numbers defined by
xRy if and only if x2
+ y2
≤ 1 .
Then
xR2
z ⇐⇒ ∃y : xRy and yRz
⇐⇒ ∃y : x2
+ y2
≤ 1 and y2
+ z2
≤ 1
⇐⇒ x2
≤ 1 and z2
≤ 1 (Why ?)
⇐⇒ | x | ≤ 1 and | z | ≤ 1 .
283
285.
y
x x
z
R R2
1−1
1
1
−1
The relations R and R2
as subsets of R2
.
284
286.
Similarly
xR3
z ⇐⇒ ∃y: xR2
y and yRz
⇐⇒ ∃y : | x | ≤ 1 and | y | ≤ 1 and y2
+ z2
≤ 1
⇐⇒ ∃y : | x | ≤ 1 and y2
+ z2
≤ 1 (Why ?)
⇐⇒ | x | ≤ 1 and | z | ≤ 1 (Why ?)
Thus R3
= R2
.
285
287.
Similarly
R4
= R3
◦ R= R2
◦ R = R3
= R2
,
R5
= R4
◦ R = R2
◦ R = R3
= R2
,
and so on · · ·
Thus we see that
Rn
= R2
for all n ≥ 2 .
286
288.
The relation matrix.
Arelation between finite sets can be represented by a relation matrix.
(Also known as the transition matrix).
For a relation R from A to B the relation matrix R has entries
Rij =
0 if (ai, bj) 6∈ R ,
1 if (ai, bj) ∈ R .
287
289.
EXAMPLE :
Reconsider theexample where
A = {1, 2, 3}, B = {2, 6}, and C = {1, 9, 15} ,
aRb if and only if a|b, and bSc if and only if b + c is prime .
C
R
S
S
A
R
o
1
2
3
2
6
1
9
15
B
= T
288
We found that
T= S ◦R = { (1, 1) , (1, 9) , (1, 15) , (2, 1) , (2, 9) , (2, 15) , (3, 1) } .
C
R
S
S
A
R
o
1
2
3
2
6
1
9
15
B
= T
290
292.
C
R
S
S
A
R
o
1
2
3
2
6
1
9
15
B
= T
The relationmatrices of R and S were found to be
R =
1 1
1 1
0 1
, S =
1 1 1
1 0 0
.
The relation matrix of T = S ◦ R is
T =
1 1 1
1 1 1
1 0 0
.
291
293.
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.
Then the relation matrix of T has the same zero-structure
as the matrix product RS.
292
294.
PROOF :
Tij =1 ⇐⇒ aiTcj
⇐⇒ aiRbk and bkScj, for some bk ∈ B
⇐⇒ Rik = 1 and Skj = 1 for some k
⇐⇒
PnB
ℓ=1 Riℓ Sℓj 6= 0
⇐⇒ [RS]ij 6= 0 . QED !
293
295.
REMARK :
If weuse Boolean arithmetic, then T = RS .
EXAMPLE :
The matrix product RS in the preceding example is
1 1
1 1
0 1
1 1 1
1 0 0
=
2 1 1
2 1 1
1 0 0
.
Using Boolean arithmetic the matrix product is
T =
1 1 1
1 1 1
1 0 0
.
294
296.
The inverse ofa relation.
Let R be a relation from A to B.
Then the inverse relation R−1
is the relation from B to A defined by
b R−1
a if and only if a R b ,
or, in equivalent notation,
(b, a) ∈ R−1
if and only if (a, b) ∈ R .
Thus, unlike functions, relations are always invertible.
295
297.
EXAMPLE :
1
2
3
a
b
A
B
Here
R ={(1, a), (1, b), (2, a), (3, b)} ,
and
R−1
= {(a, 1), (a, 2), (b, 1), (b, 3)} .
The relation matrices are
R =
1 1
1 0
0 1
, R−1
=
1 1 0
1 0 1
.
296
298.
Note that
R−1
= RT
(transpose).
This holds in general, because if
A = {a1, a2, · · · , anA
} , B = {b1, b2, · · · , bnB
} ,
then, by definition of R−1
we have for any ai, bj that
bjR−1
ai ⇐⇒ aiRbj .
Hence [R−1
]ji = Rij .
297
299.
EXERCISE : LetR be the relation on the set
A = { 1 , 2 , 3 , 4 } ,
defined by
a1Ra2 if and only if a1 a2 .
• Write down R as a subset of A × A .
• Show the relation matrix of R .
• Do the same for R2
, R3
, · · ·
EXERCISE : Do the same for a1Ra2 if and only if a1 ≤ a2 .
EXERCISE : Do the same for a1Ra2 if and only if a1 + a2 = 5 .
EXERCISE : Do the same for the set Z instead of A .
298
300.
DEFINITION : LetR 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 ,
i.e., if the relation matrix R (for finite A) satisfies
∀i : Rii = 1 .
EXAMPLES :
The “divides” relation on Z+
is reflexive.
The “≤” relation on Z is reflexive.
The “⊆” relation on a power set 2A
is reflexive.
The “” relation on Z is not reflexive.
299
301.
• R issymmetric 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 if and only if x2
+ y2
≤ 1 ,
is symmetric.
The “divides” relation on Z+
is not symmetric.
300
302.
• R isantisymmetric if for all a, b ∈ A we have
aRb ∧ bRa ⇒ a = b ,
or equivalently,
a 6= b ⇒ ¬(aRb) ∨ ¬(bRa) ,
i.e., if the relation matrix (for finite A) satisfies
∀i, j with i 6= j : RijRji 6= 1 .
EXAMPLES :
The “≤” relation on Z is antisymmetric.
The “divides” relation on Z+
is antisymmetric.
The “⊆” relation on a power set 2A
is antisymmetric.
301
303.
• R istransitive if
aRb ∧ bRc ⇒ aRc .
We’ll show later that R is transitive if and only if
n
X
k=1
Rk
= R
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
304.
EXERCISE : LetA be a set of n elements.
• How many relations are there on A ?
How many relations are there on A that are :
• symmetric ?
• antisymmetric ?
• symmetric and antisymmetric ?
• reflexive ?
• reflexive and symmetric ?
• transitive (∗)
?
(∗)
Hint : Search the web for “the number of transitive relations” !
303
305.
• An equivalencerelation is a relation that is
- reflexive
- symmetric
- transitive.
EXAMPLE :
The following relation on Z is an equivalence relation :
aRb if and only if a mod m = b mod m .
(Here m ≥ 2 is fixed.)
304
306.
• A partialorder is a relation that is
- reflexive
- antisymmetric
- transitive.
EXAMPLES :
The “divides” relation on Z+
.
- The “≤” relation on Z+
.
- The “⊆” relation on the power set 2S
.
- The operator “” on Z is not a partial order:
(It is antisymmetric (!) and transitive, but not reflexive.)
305
307.
• A relationR on a set A is called a total order if
- R is a partial order, and
- ∀a, b ∈ A we have aRb or bRa .
EXAMPLES :
- The partial order “≤” is also a total order on Z+
.
- The partial order m|n on Z+
is not a total order.
(For example 5 6 |7 and 7 6 |5 .)
- The partial order “⊆” on 2S
is not a total order.
306
308.
Equivalence classes.
Let Abe a set and let R be an equivalence relation on A .
Let a1 ∈ A.
Define
[a1] = {a ∈ A : aRa1} ,
that is
[a1] = all elements of A that “are equivalent ” to a1 .
Then [a1] is called the equivalence class generated by a1 .
307
309.
EXAMPLE :
Let Rbe 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
310.
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
311.
EXAMPLE :
Consider Z× Z , the set of all ordered pairs of integers.
Define a relation R on Z × Z by
(a1, b1)R(a2, b2) if and only if a1 − b1 = a2 − b2 .
Note that R can be viewed as subset of
(Z × Z) × (Z × Z) .
310
312.
(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
313.
(a1, b1)R(a2, b2)if and only if a1 − b1 = a2 − b2
The equivalence classes are
Ak = { (a, b) : a − b = k } .
For example,
A1 = [(2, 1)] = {· · · , (−1, −2) , (0, −1) , (1, 0) , (2, 1) , · · ·} .
The sets Ak partition the set Z × Z , namely,
Z × Z = ∪∞
k=−∞ Ak .
312
DEFINITION :
• Thereflexive closure of R is the smallest relation containing R that
is reflexive.
• The symmetric closure of R is the smallest relation containing R
that is symmetric.
• The transitive closure of R is the smallest relation containing R
that is transitive.
314
316.
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
00
11
11
11
00
00
00
11
11
11
00
00
00
11
11
11
00
00
00
11
11
11
2
4 3
1
315
PROPERTY : Thetransitive closure R∗
of a relation R is given by
R∗
= ∪∞
k=1 Rk
.
PROOF : Later · · ·
PROPERTY : For a finite set of n elements, the relation matrix of
the transitive closure is
R∗
=
n
X
k=1
Rk
(using Boolean arithmetic) .
NOTE : It suffices to sum only the first n powers of the matrix R !
322
RECALL : Thetransitive closure R∗
of a relation R is given by
R∗
= ∪∞
k=1 Rk
(to be proved later · · · )
EXAMPLE : Consider the relation R on the real numbers
xRy if and only if xy = 1 .
Earlier we found that
xR2
y if and only if x = y ∧ x 6= 0 ,
and
R = R3
= R5
= · · · ,
R2
= R4
= R6
= · · · .
Thus the transitive closure is
xR∗
y if and only if xy = 1 ∨ (x = y ∧ x 6= 0) .
327
329.
EXAMPLE : Againconsider the relation R on the real numbers
xRy if and only if x2
+ y2
≤ 1 .
Earlier we found that
xR2
y if and only if | x | ≤ 1 ∧ | y | ≤ 1 ,
and
Rn
= R2
, for n ≥ 2 .
Thus the transitive closure is
xR∗
y if and only if x2
+ y2
≤ 1 ∨ ( | x |≤ 1 ∧ | y |≤ 1 ) ,
that is,
xR∗
y if and only if | x | ≤ 1 ∧ | y | ≤ 1 . (Why ?)
328
330.
EXERCISE : LetR be the relation on the real numbers given by
xRy if and only if x2
+ y2
= 1 .
• Draw R as a subset of the real plane.
• Is R reflexive?
• Is R symmetric?
• Is R antisymmetric?
• Is R transitive?
• What is R2
? (Be careful!)
• What is R3
?
• What is the transitive closure of R ?
329
331.
EXERCISE : LetR be the relation on the real numbers given by
xRy if and only if xy ≤ 1 .
• Draw R as a subset of the real plane.
• Is R reflexive?
• Is R symmetric?
• Is R antisymmetric?
• Is R transitive?
• What is R2
?
• What is R3
?
• What is the transitive closure of R ?
330
332.
EXERCISE : LetR be the relation on the real numbers given by
xRy if and only if x2
≤ y .
• Draw R as a subset of the real plane.
• Is R reflexive?
• Is R symmetric?
• Is R antisymmetric?
• Is R transitive?
• What is R2
?
• What is R3
?
• What is Rn
? (Prove your formula for Rn
by induction.)
• What is the transitive closure of R ?
331
333.
xRy if andonly if x2
≤ y
Then
xR2
z ⇐⇒ ∃y : xRy and yRz
⇐⇒ ∃y : x2
≤ y and y2
≤ z
⇐⇒ x4
≤ z .
Similarly
xR3
z ⇐⇒ ∃y : xR2
y and yRz
⇐⇒ ∃y : x4
≤ y and y2
≤ z
⇐⇒ x8
≤ z .
By induction one can prove that
xRn
z ⇐⇒ x2n
≤ z .
332
334.
We see that
•The relation R corresponds to the area of the x, y-plane that
lies on or above the curve y = x2
.
• The relation R2
corresponds to the area of the x, y-plane that
lies on or above the curve y = x4
.
• The relation Rn
corresponds to the area of the x, y-plane that
lies on or above the curve y = x2n
.
333
335.
The transitive closureis
R∗
= ∪∞
k=1 Rk
.
(to be proved later · · · )
We find that R∗
is the union of the following two regions:
• The area of the x, y-plane that lies on or above the curve
y = x2
(i.e., the area that corresponds to the relation R ).
• The area inside the rectangle whose corners are located at
(x, y) = (−1, 0) , (1, 0) , (1, 1) , (−1, 1) ,
(excluding the border of this rectangle).
(Check!)
334
336.
Let R bea relation on a set A .
Recursively define
R1
= R , Rn+1
= Rn
◦ R , n = 1, 2, 3, · · · .
Then for all n ∈ Z+
we have:
PROPERTY 1 : Rn
◦ R = R ◦ Rn
PROPERTY 2 : R symmetric ⇒ Rn
is symmetric
EXERCISE : Use induction to prove these properties.
335
337.
PROPERTY 1 :Rn
◦ R = R ◦ Rn
, for all n ∈ Z+
PROOF : Clearly, the equality holds if n = 1.
Inductive assumption :
Rn
◦ R = R ◦ Rn
, for some arbitrary n ∈ Z+
.
We must show that
Rn+1
◦ R = R ◦ Rn+1
.
To do this :
Rn+1
◦ R = (Rn
◦ R) ◦ R (by definition)
= (R ◦ Rn
) ◦ R (by inductive assumption)
= R ◦ (Rn
◦ R) (by associativity)
= R ◦ Rn+1
(by definition). QED !
336
338.
PROPERTY 2 :R symmetric ⇒ Rn
is symmetric
PROOF : Clearly True if n = 1 .
Inductively assume that Rn
is symmetric.
We must show that Rn+1
is symmetric:
aRn+1b ⇐⇒ aRn ◦ Rb (by definition of power)
⇐⇒ ∃p(aRp ∧ pRnb) (by definition of composition)
⇐⇒ ∃p(pRa ∧ bRnp) (since R and Rn are symmetric)
⇐⇒ ∃p(bRnp ∧ pRa) (commutative law of logic)
⇐⇒ bR ◦ Rna (by definition of composition)
⇐⇒ bRn ◦ Ra (by Property 1)
⇐⇒ bRn+1a (by definition of power) . QED !
337
339.
Let R bea relation on a set A and let n ∈ Z+
.
PROPERTY 3 : 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
340.
Given R andRn
are transitive. Show Rn+1
is transitive
· · · continuation of proof · · ·
aRn+1
b ∧ bRn+1
c
⇒ aRn
◦ Rb ∧ bRn
◦ Rc (power)
⇒ aRn
◦ Rb ∧ bR ◦ Rn
c (by Property 1)
⇒ aRp ∧ pRn
b ∧ bRn
q ∧ qRc (∃p, q: composition)
⇒ aRp ∧ pRn
q ∧ qRc (inductive assumption)
⇒ aRn
◦ Rq ∧ qRc (composition)
⇒ aR ◦ Rn
q ∧ qRc (by Property 1)
339
341.
Given R andRn
are transitive. Show Rn+1
is transitive.
· · · continuation of proof · · ·
aR ◦ Rn
q ∧ qRc
⇒ aRn
s ∧ sRq ∧ qRc (∃s: composition)
⇒ aRn
s ∧ sRc (since R is transitive)
⇒ aR ◦ Rn
c (composition)
⇒ aRn
◦ Rc (by Property 1)
⇒ aRn+1
c (power) QED !
340
342.
Let R andS 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
⊆ Sn
PROOF : The statement clearly holds when n = 1 .
Inductive step:
Given R ⊆ S and Rn
⊆ Sn
. Show Rn+1
⊆ Sn+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) ∈ Sn
.
Hence (x, z) ∈ Sn+1
. QED !
341
343.
Let S bea relation on a set A .
PROPERTY 5 : S is transitive if and only if ∀n ∈ Z+
: Sn
⊆ S
PROOF :
(⇐) (∀n ∈ Z+
: Sn
⊆ S) ⇒ S is transitive
Let (x, y) ∈ S and (y, z) ∈ S .
Then, by definition of composition, (x, z) ∈ S2
.
Since, in particular, S2
⊆ S it follows that (x, z) ∈ S .
Hence S is transitive.
342
344.
(⇒) S istransitive ⇒ ∀n ∈ Z+
: Sn
⊆ S
By induction :
Clearly Sn
⊆ S if n = 1 .
Suppose that for some n we have Sn
⊆ S .
We must show that Sn+1
⊆ S .
343
345.
Given (1): Sis transitive, and (2): Sn
⊆ S . Show Sn+1
⊆ S
To do this, suppose that (x, z) ∈ Sn+1
.
We must show that (x, z) ∈ S .
By definition of composition, (x, z) ∈ Sn
◦ S , and hence
∃y : (x, y) ∈ S and (y, z) ∈ Sn
.
By inductive hypothesis (2) (y, z) ∈ S .
Thus (x, y) ∈ S and (y, z) ∈ S .
By assumption (1) S is transitive, so that (x, z) ∈ S . QED !
344
346.
THEOREM :
The transitiveclosure R∗
of a relation R is given by
R∗
= ∪∞
k=1 Rk
.
PROOF : Let U = ∪∞
k=1 Rk
.
We must show that
(1) U is transitive.
(2) U is the smallest transitive relation containing R .
If so, then R∗
= U .
345
347.
U = ∪∞
k=1Rk
⋆
(1) We first show that U is transitive :
Suppose (x, y) ∈ U and (y, z) ∈ U .
We must show that (x, z) ∈ U .
From ⋆ it follows that
(x, y) ∈ Rm
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
348.
U = ∪∞
k=1Rk
⋆
(2) Show U is the smallest transitive relation containing R :
To do this it suffices to show that :
( S transitive and R ⊆ S ) ⇒ U ⊆ S .
R
U
S
347
349.
U = ∪∞
k=1Rk
⋆
R ⊆ S ⇒ Rn
⊆ Sn
Property 4
S is transitive ⇐⇒ ∀n ∈ Z+
: Sn
⊆ S Property 5
To do: Given S transitive and R ⊆ S . Show U ⊆ S
Let (x, y) ∈ U . Then, by ⋆ we have
(x, y) ∈ Rn
for some n ∈ Z+
.
By Property 4 : (x, y) ∈ Sn
.
By Property 5 : (x, y) ∈ S . QED !
348
Review Problem 2.
Supposem and n are relatively prime integers; m ≥ 2 , n ≥ 2 .
Prove that logmn is an irrational number.
351
353.
Review Problem 3.If A and B are sets, and if
f : A −→ B ,
then for any subset S of B we define the pre-image of S as
f−1
(S) ≡ {a ∈ A : f(a) ∈ S} .
NOTE : f−1
(S) is defined even if f does not have an inverse!
Let S and T be subsets of B .
Prove that
f−1
(S ∩ T) = f−1
(S) ∩ f−1
(T)
352
354.
Review Problem 4.
Provethat if a , b , and c are integers such that
m ≥ 2 and a ≡ b(mod m)
then
gcd(a, m) = gcd(b, m) .
353
355.
Review Problem 5.
Usemathematical induction to prove that
21 | (4n+1
+ 52n−1
) ,
whenever n is a positive integer.
354
356.
Review Problem 6.
TheFibonacci numbers are defined as: f1 = 1 , f2 = 1 , and
fn = fn−1 + fn−2 , for n ≥ 3 .
Use a proof by induction to show that
fn−1 fn+1 − f2
n = (−1)n
for all n ≥ 2 .
355
357.
Review Problem 7.
LetA 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 : a1Ra2 ⇐⇒ f(a1)Sf(a2) .
Prove that R is an partial order on A .
356