Topic3.2 3 LectureNotes
Topic3.2 3 LectureNotes
Topic3.2 3 LectureNotes
Trenerry
1
The following is a High School intuitive understanding which is NOT a proof:
The base step leads to
P (0) is true
2
Example. Prove by induction that n3 +2n is a multiple of 3 for all natural numbers
n.
A formal induction proof... (you may treat the green part as a template)
Basis step:
For n = 0, we have
03 + 2 0 = 0 = 3 0, which is a multiple of 3.
Hence P (0) is true.
Induction step: Suppose that k N. (This k is arbitrary, but fixed once chosen.)
Suppose that (for this k), P (k) is true. Then
(k + 1)3 + 2(k + 1)
= k 3 + 3k 2 + 3k + 1 + 2k + 2
= (k 3 + 2k) + 3k 2 + 3k + 3
= 3m + 3k 2 + 3k + 3 by the induction hypothesis
= 3(m + k 2 + k + 1),
which is a multiple of 3.
Conclusion:
Hence by induction, P (n) is true for all n N.
3
Note that this particular problem would be far quicker done using a proof by
cases.
Note the difference between our formal way of writing the induction step:
For any k N, if P (k) is true then P (k + 1) is true.
and some other ways of writing the induction step that are commonly used by
teachers and mathematicians, but are not quite right .....
Assume P (n) is true, then we prove that P (n + 1) is true
this seems to assume what we have to prove and does not quantify n.
We prove that if P (k) is true, then P (k + 1) is true this does not properly
quantify k.
If P (n) is true for some particular value of n then we show P (n + 1) is
true using the words some particular makes this sound like there is some
particular n such that if P (n) it true then P (n + 1) is true, and so this has
the wrong quantifier. (Epp uses this in places.) The intention here seems to
be that k is an arbitrary then particular value (rather than some particular
value) of n.
4
Example. Prove by induction that the sum of the squares of the first n positive
integers
1
12 + 22 + + n2 = n(n + 1)(2n + 1).
6
Induction can start at integers other than 0.
5
What is wrong with the following as an attempt at part of the previous proof?
By the induction hypothesis, we have
1
12 + 22 + + k 2 = k(k + 1)(2k + 1).
6
Replace k by k + 1. Therefore
1
12 + 22 + + (k + 1)2 = (k + 1)(k + 2)(2k + 3),
6
which completes the induction step.
Example.
Show that 16 | 5n 4n 1 for all n 1.
Proof. Let P (n) be the predicate 16 | 5n 4n 1.
Basis:
We note that P (1) is true since 51 4 1 1 = 0 is divisible by 16.
Induction: Let k N with k 1.
Assume that P (k) is true, so that 16 | 5k 4k 1.
Then there is an integer m with 5k 4k 1 = 16m. Now
6
Example. (Generalized Bezout Identity)
Let n 2 be an integer. For any n integers a1 , a2 , , an having no common
factor, there exist integers x1 , x2 , , xn such that
a1 x1 + a2 x2 + + an xn = 1.
Basis:
Now P (2) is true, and was proved in section 2 of this course.
Moreover, g and ak+1 have no common factor (if they did, it would be a common
factor of a1 , , ak , ak+1 ). So by the Basis case we have
for some integers z and zk+1 . Multiplying equation (2) by g and substituting into
(3) gives
(a1 y1 + + ak yk )z + ak+1 zk+1 = 1.
7
Finally choosing x1 = y1 z, , xk = yk z and xk+1 = zk+1 gives a solution of
equation (1), and we have deduced that P (k + 1) is true.
Hence we have shown that for all k N with k 2, P (k) implies P (k + 1).
Conclusion
By induction, P (n) is true for all n 2.
8
Note that informal induction proofs are often used in mathematics, but they
tend to hide exactly what is being proved,
which here is (for Universe N),
9
Example. Suppose the sequence {un } has the properties
Conclusion
By (strong) induction, the formula is true for all n 0.
Note that we varied the induction slightly to get P (k + 2) from P (k) and
P (k + 1) as the flow of the proof is better.
Here we used n0 = 0, m = 1 in the strong induction and only needed to assume
two of the previous P ( ... ) instead of all of them.
10
Exercise. The Fibonacci numbers 0, 1, 1, 2, 3, 5, 8, 13, . . . are defined by the recur-
rence relation
In the next example we will use n0 = 2, m = 0 and have to assume all the
previous cases even though we only use two of them as we do not know
which two we will use.
Example. Prove that any integer n 2 can be written as a product of primes.
Proof. (Informal)
Basis:
Since 2 is a product of one prime, the result is true for n = 2.
Induction:
Suppose k is an integer and k 2. Suppose that the result is true for all
n = 2, 3, . . . , k. We want to prove that the result is also true for n = k + 1, that
is, we want to show that k + 1 can be written as a product of primes.
11
Exercise. Prove by induction that postage of 24 cents or more can be achieved by
using 5-cent stamps and 7-cent stamps.
12
Here we used n0 = 24, m = 4 in the strong induction, and used the last five of
P (24), , P (k) to get P (k + 1).
Note that we have also proved that for all natural numbers n 24
5x + 7y = n
Example.
Let
= 3.14159 = d0 .d1 d2 d3 (di are the digits of )
(and define a sequence {un } by u0 = 1 and
un+1 = d0 un + d1 un1 + + dn u0
Basis:
Now P (1) is true since u1 = 3 9.
13
Now
LHS = d0 uk + d1 uk1 + + dk1 u1 + dk u0
9 (uk + uk1 + + u1 + u0 )
9 (9 10k1 + 9 10k2 + + 9 + 1)
14
Exercise. Let n be a positive integer. Prove by induction that any 2n 2n checker-
board with one corner square removed can be tiled using L-shaped pieces formed
by three 1 1 squares. (These pieces are called L-triominos or right triominos.)
The L-triominoes look like this:
b b
b b b
b b b
Exercise. Large dots are drawn on the circumference of a circle and lines are drawn
joining the dots in pairs so that every dot is joined to every other dot by a line.
Prove by induction that for every positive integer n 2, if n dots are drawn then
they will be joined in pairs by 12 n(n 1) lines.
Exercise. Straight lines are drawn right across an A4 sheet of paper in such a way
that each pair of lines intersect and no three or more lines intersect at the same
point. Prove by induction that when n such lines are drawn, they divide the sheet
of paper into 12 (n2 + n + 2) regions.
15
The Well-ordering Principle for the natural numbers says:
Every non-empty subset S of N contains a least element.
Descent:
Let n 1. Assume that P (n) is false, so that
4n (8m + 7) = x2 + y 2 + z 2 , for some x, y, z Z.
Then clearly 4 | x2 + y 2 + z 2 .
A simple proof by cases mod 4 (detail omitted) shows that 4 | x2 + y 2 + z 2 can
only occur when all of x, y, z are even.
So, let x = 2X, y = 2Y, z = 2Z where X, Y, Z Z. Now
4n (8m + 7) = (2X)2 + (2Y )2 + (2Z)2 .
so that on dividing by 4 we get
4n1 (8m + 7) = X 2 + Y 2 + Z 2 ,
16
which says that P (n 1) is false.
Hence we have proved that (P (n) false) implies (P (n 1) false).
Basis: But P (0) is true, since a proof by cases mod 8 (detail omitted) shows that
x2 + y 2 + z 2 6 7 (mod 8) for all x, y, z Z.
Conclusion:
Hence we have proved by Fermats Method of Descent that P (n) is true for all
n 0.
17
3.3 Symbolic Logic
This section consists of taking what we did with proofs and induction and making
it move formal and symbolic.
Some parts are repeated and some done quickly as we have already covered them.
Example.
Canberra is the capital of Australia is a proposition which is true.
1 is a prime number is a proposition which is false.
2 + 2 = 4 is a proposition which is true.
x + y = 1 is not a proposition, because it can be either true or false
depending on the values of x and y.
18
implication or conditional
p q p implies q q if p
if p then q q in case p
p only if q q provided that p
p therefore q q follows from p
not p unless q q whenever p
p is a sufficient condition for q
q is a necessary condition for p
biconditional
p q p if and only if q p precisely when q
p is equivalent to q p just when q
p iff q p just in case q
p if q and q if p p exactly when q
if p then q and conversely
p is a necessary and sufficient condition for q
Note:
p unless q, p except when q mean p if not q and translate as q p.
neither p nor q translates as (p q) or p q.
Exercise. Let p = You work hard, q = You skip lectures, and r = You pass
this course. Translate (p q) r into plain English.
19
We denote the truth value of a proposition by the upper case letter T (true)
or F (false).
Truth tables for , , , , and :
p p
T F p is true when p is false, and it is false when p is true.
F T
p q pq p q pq p q pq p q pq
T T T T T T T T T T T T
T F F T F T T F F T F F
F T F F T T F T T F T F
F F F F F F F F T F F T
p q is true when both p and q are true, and it is false otherwise.
p q is false when both p and q are false, and it is true otherwise.
p q is false when p is true and q is false, and it is true otherwise.
p q is true when p and q have the same truth value, and it is false
otherwise.
20
Example. The compound proposition p p is a tautology. The compound
proposition p p is a contradiction.
p p p p p p
T F T F
F T T F
p q pq p (p q) p (p q) q
T T T T T
T F F F T
F T T F T
F F T F T
p q r pq r p r (p q) (p r) (p q) (p r)
r
T T T
T T F
T F T
T F F
F T T
F T F
F F T
F F F
21
If P and Q are two compound propositions such that P Q is a tautology,
then we say that P logically implies Q, and we write P Q.
If P and Q are two compound propositions such that P Q is a tautology,
then we say that P is logically equivalent to Q, and we write P Q or
P Q.
Two compound propositions are logically equivalent iff they always have
the same truth values in a truth table.
p q pq q (p q) q p (p q) q p
T T T F F F T
T F F T F F T
F T T F F T T
F F T T T T T
p q pq pq qp (p q) (q p)
T T
T F
F T
F F
22
Recall that the conditional proposition p q is false when p is true and q is
false, and it is true otherwise.
The contrapositive of p q is q p.
The converse of p q is q p.
The inverse of p q is p q.
Notes.
2. The fact that p q is true when p is false (no matter what truth value q
has) may seem strange at first, but it does make sense...
For example, if p is It is fine and q is You will go to the beach, then
p q is If it is fine, then you will go to the beach. Now if it is not fine,
would you go to the beach? Maybe... Maybe not...
3. If p then q is the same as p only if q in logic, but this is not always clear
in daily English.
For example, in mathematics, it is clear that If x > 2 then x2 > 4 is the
same as x > 2 only if x2 > 4, meaning x cannot be greater than 2 if x2 is
not greater than 4.
BUT
In daily language, If you want to pass this course then you must work hard
during the session doesnt sound the same as You want to pass this course
only if you work hard during the session.
If it is fine then you will go to the beach is understandable while It is fine
only if you go to the beach is hard to understand.
Similarly, If I am free this weekend then I will visit my parents is clear,
but I am free this weekend only if I visit my parents is unclear in ordinary
language.
23
Example. Construct a truth table to show that
A conditional proposition and its contrapositive are logically equivalent, i.e.,
p q q p.
A conditional proposition and its converse are NOT logically equivalent.
A conditional proposition and its inverse are NOT logically equivalent.
The converse and inverse of a conditional proposition are logically equivalent.
conditional contrapositive converse inverse
p q p q pq q p qp p q
T T F F T T T T
T F F T F F T T
F T T F T T F F
F F T T T T T T
p q p q and (p q) p q.
p q p pq p q q (p q) p q
T T
T F
F T
F F
24
Recall that the biconditional p q is true when p and q have the same truth
value, and it is false otherwise.
Notes.
3. Ordinary language seldom uses if and only if even though the meaning
commonly is this. In daily language, when one direction of if and only if is
obvious, it is often not stated explicitly.
For example, If you finish your homework then you can watch TV also
usually means If you do not finish your homework then you are not allowed
to watch TV although this is logically its inverse.
You can watch TV only if you finish your homework also commonly means
a reward together with the meaning If you finish your homework, then you
will be allowed to watch TV even though this is actually its converse.
In logic it should be said as You can watch TV if and only if you finish your
homework.
25
De Morgans laws:
(p q) p q and (p q) p q
p q p q p q (p q) p q p q (p q) p q
T T
T F
F T
F F
Exercise.
(a) What is the negation of Peter is tall and thin?
(b) What is the negation of 2 x < 5?
(c) Given that You can vote in the next election if (and only if) you are an
Australian citizen and you are 18 years or over, complete the sentence You
cannot vote in the next election if .
(d) Given that You can apply for this position if (and only if) you graduated in
mathematics or you are in your final year of study in mathematics, complete
the sentence You cannot apply for this position if .
26
Standard logical equivalences:
(Denote a tautology by T and a contradiction by F):
Commutative laws pq qp
pq qp
Associative laws p (q r) (p q) r
p (q r) (p q) r
Distributive laws p (q r) (p q) (p r)
p (q r) (p q) (p r)
Absorption laws p (p q) p
p (p q) p
Negations of T and F T F F T
De Morgans laws
(p q) p q
(p q) p q
Logical equivalences involving
p q q p ... contrapositive
p q p q ... alternative form for implication
(p q) p q
p q (p q) (q p)
Notice that the Rules for Logical Equivalences (except the last ones) and their
names are essentially the same as the Rules for Set Algebra. Such systems are
called Boolean Algebras.
27
Example. Use standard logical equivalences to simplify (p q) (p q).
(p q) (p q) (p q) ( p q) De Morgans law
(p p) q Commut and Distrib laws
F q Negation law
q Identity law
(p q) (q r) q (p r).
28
Rules of Inference
An argument is a finite sequence of compound propositions, written in the
form
P1
P2
..
.
Pn
Q
Example.
The following are valid arguments:
If Socrates is a man, then Socrates is mortal.
Socrates is a man.
Socrates is mortal.
If Zeus is human, then Zeus is mortal.
Zeus is not mortal.
Zeus is not human.
John is a trouble maker.
(more generally) John is a trouble maker or John is crazy.
Jane loves shopping and Jane loves cooking.
(in particular) Jane loves cooking.
If x is divisible by 9, then x is divisible by 3.
If x is divisible by 3, then the sum of the digits of x is divisible by 3.
If x is divisible by 9, then the sum of the digits of x is divisible by 3.
29
x is positive or x is negative.
If x is positive, then x2 > 0.
If x is negative, then x2 > 0.
x2 > 0.
The following are invalid arguments:
(converse error )
If the program is correct, then it will process the test data correctly.
It processed the test data correctly.
The program is correct.
(inverse error )
If x > 2, then x2 > 4.
y 2 (the negation of y > 2).
y 2 4 (the negation of y 2 > 4).
Note also that there is a difference between a valid argument and a true conclusion,
as is seen in the following examples.
(A false premise, valid argument, but false conclusion)
If x is divisible by 3, then x is divisible by 9.
6 is divisible by 3.
6 is divisible by 9.
(A false premise, valid argument, but true conclusion)
If x is divisible by 3, then x is divisible by 9.
18 is divisible by 3.
18 is divisible by 9.
(A false premise, invalid argument, but true conclusion)
If x is divisible by 3, then x is divisible by 9.
18 is divisible by 9.
18 is divisible by 3.
(True premise, invalid argument, but true conclusion)
If x is divisible by 9, then x is divisible by 3.
18 is divisible by 3.
18 is divisible by 9.
30
Important rules of inference:
Modus ponens (Latin for method of affirming)
pq
p
q
Modus tollens (Latin for method of denying)
pq
q
p
Conjunctive addition (or conjunction)
p
q
pq
Disjunctive addition (or generalization)
p q
pq pq
31
Example. (from Epp) You are looking for your glasses, and you say to yourself...
(1) If my glasses are on the kitchen table, then I saw them at breakfast.
(2) I was reading the newspaper in the living room or I was reading the newspaper
in the kitchen.
(3) If I was reading the newspaper in the living room, then my glasses are on
the coffee table.
(4) I did not see my glasses at breakfast.
(5) If I was reading my book in bed, then my glasses are on the bedside table.
(6) If I was reading the newspaper in the kitchen, then my glasses are on the
kitchen table.
Where are the glasses?
Let p = My glasses are on the kitchen table
q = I saw my glasses at breakfast
r = I was reading the newspaper in the living room
s = I was reading the newspaper in the kitchen
t = My glasses are on the coffee table
u = I was reading my book in bed
v = My glasses are on the bedside table
(1) pq
(2) rs
(3) rt
(4) q
(5) uv
(6) sp
32
Example. Given the following information about a computer program, find the
bug in the program.
(1) There is an undeclared variable or there is a syntax error.
(2) If there is a syntax error, then there is a missing semicolon or a variable name
is misspelled.
(3) There is not a missing semicolon.
(4) There is not a misspelled variable name.
33
Some Fallacies (invalid inferences):
Converse fallacy
pq
q
p
Inverse fallacy
pq
p
q
Both of these are invalid inference and must be avoided, but they are often used in
common English expression.
Example.
Suppose you say If its fine, Ill go to the beach.
If you went to the beach and your friend concludes that it must have been fine,
then
If it was not fine, and your friend concludes that you did not go to the beach,
then
Of course if you really meant I will go to the beach if and only if it is fine, then
34
Many Mathematics students also fall for these fallacies, often without realising.
Example.
To show that Expression 1 = Expression 2, many students write (wrongly)
Expression 1 = Expression 2
() Expression 3 = Expression 4
() etc
() Expression A = Expression B
(which is clearly true)
Hence Expression 1 = Expression 2
Similarly the which is clearly true is often not there but is implicit.
(1) s b
(2) s
(3) b
35
(4) b Assumption
(5) Modus ponens, (3) and (4)
(6) ( s) Modus tollens, (2) and (5)
(7) s Double negation law, (6)
(8) b Modus ponens, (1) and (7)
(9) b b Conjunction, (8) and (4)
(10) F Negation law, (9)
(11) b F Implication, (4)(10)
(12) b Proof by contradiction, (11)
NOTE that we will NOT give you any problems like this, but some did appear in
exams many years ago.
36
Recall that a proposition is a sentence which is either true or false but not
both.
A predicate is a sentence involving one or more free variables that becomes a
proposition when each free variable is assigned a defined value.
We use upper case letters for predicates and lower case letters for the free
variables, e.g., P (x) or Q(x, y).
The set of values that each free variable can take is referred to as the domain
of disclosure. Sometimes the domain of disclosure is not given explicitly, but
it can often be deduced from the context.
37
Example. Let Q(x) be the predicate x is crazy and let D denote the set of all
cats. Then
x D, Q(x) means All cats are crazy.
x D, Q(x) means There is at least one cat that is crazy.
x D, Q(x) is the same as y D, Q(y).
x D, Q(x) is the same as z D, Q(z).
The name of the free variable is irrelevant.
If P (x) is the predicate x is a cat, then
x D, Q(x) is the same as x, P (x) Q(x).
x D, Q(x) is the same as x, P (x) Q(x).
In both cases, the domain of disclosure is left for interpretation (e.g. the set
of all animals).
Example.
The negation of Everyone owns a car is Not everyone owns a car, which
is logically equivalent to Some people do not own a car.
The negation of Somebody likes me is Nobody likes me, which is logically
equivalent to Everybody dislikes me.
Exercise. Write the following statements in symbolic form.
(a) All triangles have three sides.
(b) Some apples are green.
(c) If a number is an integer, then it is a rational number.
Answer.
(a) Let Q(x) = x has three sides and T = the set of all triangles.
The statement is x T, Q(x).
Or x, P (x) Q(x), where P (x) = x is a triangle.
(b) Let Q(x) = x is green and A = the set of all apples.
The statement is x A, Q(x).
Or x, P (x) Q(x), where P (x) = x is an apple.
(c) Let P (x) = x is an integer and Q(x) = x is a rational number.
The statement is x, P (x) Q(x).
This is an example of implicit quantification in daily language.
38
Exercise. Write All politicians are liars in symbolic form, then write down its
negation in symbolic form, and finally write down its negation in words.
Answer.
Let P (x) = x is a politician and Q(x) = x is a liar.
Original: x, P (x) Q(x)
Negation:
(x, P (x) Q(x)) x, (P (x) Q(x)) x, P (x) Q(x)
There is at least one politician who is not a liar.
Example.
x R y R, x > y is a proposition which is true. The statement says
For every real number there exists a smaller real number.
y R x R, x > y is a proposition which is false. The statement says
There is a real number which is smaller than all other real numbers.
39
Exercise. Write down the negation of the statement y R, x R, x > y,
and simplify it so that the negation symbol does not appear.
Answer.
(y R x R, x > y) y R, (x R, x > y)
y R x R, (x > y)
y R x R, x y
40
The converse is clearly true, so the inverse is also true as it is logically equivalent
to the converse.
We prove that the contrapositive is true. For any real number x 6= 0, we can take
|x|
= .
2
Then |x| 2 > as required.
Hence the contrapositive is true.
The original proposition is true, since it is logically equivalent to its contrapositive.
41
Let A(x) = x is an athlete
H(x) = x is healthy
G(x) = x has good lungs
S(x) = x smokes
(1) x A(x) H(x)
(2) x G(x) H(x)
(3) (x S(x) G(x))
x A(x) S(x)
42