Chapter 2 Section 2.1: Proofs – Proof Techniques

Chapter 2
Section 2.1:
Proofs – Proof Techniques
CS 130 – Discrete Structures
Some Terminologies
• Axioms: Statements that are always true.
– Example: Given two distinct points, there is exactly one
line that contains them.
• Definitions: Used to create new concepts in terms of
existing ones
• Theorem: A proposition that has been proved to be
true.
• Two kinds of theorems: Lemma and Corollary
– Lemma: A theorem that is usually not too interesting in its
own right but is useful in proving another theorem.
– Corollary: A theorem that follows quickly from another
theorem
CS 130 – Discrete Structures
2
Inductive Reasoning v.s. Deductive Reasoning
• Inductive reasoning: draw a conclusion based on
experience
– You observe a number of cases in which whenever P is
true, Q is also true. On the basis of these experiences, you
may formulate a conjecture: P  Q
– The more cases you find where Q follows from P, the more
confident your are in your conjecture
– But no matter how reasonable the conjecture sounds, you
will not be satisfied
• Deductive reasoning: verify the truth or falsity of a
conjecture
– Either produce a proof for P  Q
– Or find a counterexample that disproves the conjecture,
where P is true and Q is false
CS 130 – Discrete Structures
3
Proof Techniques
•
•
•
•
•
Disproof by counterexample
Exhaustive proof
Direct proof
Proof by contraposition
Proof by contradiction
CS 130 – Discrete Structures
4
Disproof By Counterexample
• Prove (x)P(x) is NOT true, thus [(x)P(x)]’ is true by
showing (x)[P(x)]’
• Example – Disprove the following conjectures:
– All animals living in the ocean are fish.
• Pf. For example, whales live in the ocean and are not fish.
– All input to a computer is provided by the keyboard.
• Pf. For example, mice provide input to a computer and are not
keyboards.
• For a positive integer n, n factorial is defined as n(n1)(n-2) … 1 and is denoted by n!. Prove or disprove the
conjecture “For every positive integer n, n! <= n2.”
CS 130 – Discrete Structures
5
Exhaustive Proof
• If dealing with a finite domain in which the proof is to
be shown to be valid, then using the exhaustive proof
technique, one can go over all the possible cases for
each member of the finite domain.
• Final result of this exercise: you prove or disprove the
theorem but you could be definitely exhausted.
• Example 1: If an integer between 1 and 20 is divisible
by 6, then it is also divisible by 3.
• Example 2: For any positive integer less than or equal
to 5, the square of the integer is less than or equal to
the sum of 10 plus 5 times the integer.
CS 130 – Discrete Structures
6
Direct Proof
• Prove P directly, using generalized methods of
deduction
• Example 1: show that every integer divisible
by 6 is divisible by 3
– Pf. Let x be an integer divisible by 6. There exists an
integer y S.T. x = 6•y. Therefore x = 3 • 2 • y, and x
is divisible by 3.
• Example 2: the product of two even integers is
even
CS 130 – Discrete Structures
7
Proof By Contraposition
• Use the variants of P  Q to prove the conjecture.
– (Q’  P’) is equivalent to (P  Q)
– Prove P  Q is true by showing Q’  P’
• Example 1: prove that if the square of an integer is odd,
then the integer must be odd.
• Example 2: Prove that every integer divisible by 6 is
divisible by 3.
• Example 3: Prove that the product xy is odd if and only
if both x and y are odd integers.
CS 130 – Discrete Structures
8
Indirect Proof: Proof By Contradiction
• By constructing a truth table, we can see:
– (P ^ Q’  0 )  (P  Q)
• To prove P  Q by proving (P ^ Q’  0 )
• Example 1: Prove “If a number added to itself
gives itself, then the number is 0.”
• Prove P is true by showing P’  0, P’ implies a
contradiction
• Example 2: Prove “The sum of even integers is
even.”
CS 130 – Discrete Structures
9
Summary
Proof Technique
Approach to prove P  Q
Remarks
Exhaustive Proof
Demonstrate P  Q
for all cases
May only be used for
finite number of cases
Direct Proof
Assume P, deduce Q
The standard approachusually the thing to try
Proof by
Contraposition
Assume Q’, derive P’
Use this Q’ if as a
hypothesis seems to
give more ammunition
then P would
Assume P Λ Q’ , deduce a
contradiction
Use this when Q says
something is not true
Proof by
Contradiction
CS 130 – Discrete Structures
10
Serendipity
• Serendipity means proving by luck
• A tennis tournament has 342 players. A single match
involves 2 players. The winner of a match plays the
winner of another match in the next round, while losers
are eliminated from the tournament. The 2 players who
have won all previous rounds play in the final game,
and the winner wins the tournament. Prove that the
total number of matches to be played is 341.
CS 130 – Discrete Structures
11
Class Exercises
1. Provide counterexamples to the following statements:
The number n is an odd integer if and only if 3n + 5 is an
even integer.
2.
3.
4.
5.
Product of any 2 consecutive integers is even
The sum of 3 consecutive integers is even
Product of 3 consecutive integers is even
If a number x is positive, so is x+1 (do a proof by
contraposition)
6. The square of an odd integer equals 8k+1 for some
integer k
7. The sum of two rational numbers is rational
8. For a positive integer x, x+1/x ≥ 2
CS 130 – Discrete Structures
12
Chapter 2 – Section 2.2: Induction
CS 130 – Discrete Structures
A Motivating Example
• Climbing a ladder
– We assume the following two assertions:
• You can reach the first rung
• Once you get to a rung, you can always climb to the
next rung (This is an implication)
– If we can prove the above two assertions are true,
then we can conclude that:
• You can reach as high as you want
• Induction: a very useful proof technique in
computer science
CS 130 – Discrete Structures
14
First Principle of Induction
• Two assertions:
– P(1) is true
– For all k, if P(k) is true, then P(k+1) is true
• Conclusion: P(n) is true for all positive
integers n
• Inductive proof:
– P(1) is the basis step
– P(k)  P(k+1) is the inductive step
– We assume P(k) is true to prove the inductive step,
P(k) is called the inductive assumption
CS 130 – Discrete Structures
15
Steps To Prove By Induction
• Step 1: Prove the basis step
• Step 2: Assume P(k) is true
• Step 3: Prove P(k+1) is true
CS 130 – Discrete Structures
16
Examples
• Prove the following for any (n >= 1):
–
–
–
–
–
–
1 + 3 + 5 + … + (2n-1) = n2
1 + 2 + 22 + … + 2n = 2n+1 –1
2n > n
22n –1 is divisible by 3
n2 > 3n for n >= 4
2n+1 < 3n for all n > 1
CS 130 – Discrete Structures
17
Second Principle of Induction
• Assertions:
– P(1) is true
– For all k, P(r) is true for all r, where 1 <= r <= k
• Conclusion:
– P(n) is true for all positive integers n
• More powerful than the first principle of induction
• Steps:
– Step 1: Prove P(1) is true
– Step 2: Assume P(r) is true for all r, where 1 <= r <= k
– Step 3: Prove P(k+1) is true
CS 130 – Discrete Structures
18
Examples
• Prove that for every n >= 2, n is a prime
number or a product of prime numbers.
• Prove that any amount of postage greater
than or equal to 8 cents can be built using
only 3-cent and 5-cent stamps.
CS 130 – Discrete Structures
19
Class Exercises
• Use mathematical induction to prove that the
statements are true for every positive integer n
2 + 6 + 10 + … + (4n-2) = 2n2
• Prove that n2 > n+1 for n >= 2
• Prove that 1+ 2 + … + n < n2 for n > 1
• Prove that the statements are true for every positive
integer.
– 23n – 1 is divisible by 7
CS 130 – Discrete Structures
20