36
1 Methods of Proof Methods of Proof CS 202 CS 202 Rosen section 1.5 Rosen section 1.5 Aaron Bloomfield Aaron Bloomfield

09-Methods of Proof

Embed Size (px)

Citation preview

Page 1: 09-Methods of Proof

11

Methods of ProofMethods of Proof

CS 202CS 202

Rosen section 1.5Rosen section 1.5

Aaron BloomfieldAaron Bloomfield

Page 2: 09-Methods of Proof

22

Proof methodsProof methods

We will discuss ten proof methods:We will discuss ten proof methods:1.1. Direct proofsDirect proofs2.2. Indirect proofsIndirect proofs3.3. Vacuous proofsVacuous proofs4.4. Trivial proofsTrivial proofs5.5. Proof by contradictionProof by contradiction6.6. Proof by casesProof by cases7.7. Proofs of equivalenceProofs of equivalence8.8. Existence proofsExistence proofs9.9. Uniqueness proofsUniqueness proofs10.10. CounterexamplesCounterexamples

Page 3: 09-Methods of Proof

33

Direct proofsDirect proofs

Consider an implication: p→qConsider an implication: p→q If p is false, then the implication is always trueIf p is false, then the implication is always true Thus, show that if p is true, then q is trueThus, show that if p is true, then q is true

To perform a direct proof, assume that p is To perform a direct proof, assume that p is true, and show that q must therefore be true, and show that q must therefore be truetrue

Page 4: 09-Methods of Proof

44

Direct proof exampleDirect proof example

Rosen, section 1.5, question 20Rosen, section 1.5, question 20 Show that the square of an even number is an Show that the square of an even number is an

even numbereven number Rephrased: if n is even, then nRephrased: if n is even, then n22 is even is even

Assume n is evenAssume n is even Thus, n = 2k, for some k (definition of even Thus, n = 2k, for some k (definition of even

numbers)numbers) nn22 = (2k) = (2k)22 = 4k = 4k22 = 2(2k = 2(2k22)) As nAs n22 is 2 times an integer, n is 2 times an integer, n22 is thus even is thus even

Page 5: 09-Methods of Proof

55

Indirect proofsIndirect proofs

Consider an implication: p→qConsider an implication: p→q It’s contrapositive is ¬q→¬pIt’s contrapositive is ¬q→¬p

Is logically equivalent to the original implication!Is logically equivalent to the original implication! If the antecedent (¬q) is false, then the If the antecedent (¬q) is false, then the

contrapositive is always truecontrapositive is always true Thus, show that if ¬q is true, then ¬p is trueThus, show that if ¬q is true, then ¬p is true

To perform an indirect proof, do a direct To perform an indirect proof, do a direct proof on the contrapositiveproof on the contrapositive

Page 6: 09-Methods of Proof

66

Indirect proof exampleIndirect proof example

If nIf n22 is an odd integer then n is an odd integer is an odd integer then n is an odd integer

Prove the contrapositive: If n is an even integer, Prove the contrapositive: If n is an even integer, then nthen n22 is an even integer is an even integer

Proof: n=2k for some integer k (definition of even Proof: n=2k for some integer k (definition of even numbers)numbers)

nn22 = (2k) = (2k)22 = 4k = 4k22 = 2(2k = 2(2k22))

Since nSince n22 is 2 times an integer, it is even is 2 times an integer, it is even

Page 7: 09-Methods of Proof

77

Which to useWhich to use

When do you use a direct proof versus an When do you use a direct proof versus an indirect proof?indirect proof?

If it’s not clear from the problem, try direct If it’s not clear from the problem, try direct first, then indirect secondfirst, then indirect second If indirect fails, try the other proofsIf indirect fails, try the other proofs

Page 8: 09-Methods of Proof

88

Example of which to useExample of which to use

Rosen, section 1.5, question 21Rosen, section 1.5, question 21 Prove that if n is an integer and nProve that if n is an integer and n33+5 is odd, then n is +5 is odd, then n is

eveneven

Via direct proofVia direct proof nn33+5 = 2k+1 for some integer k (definition of odd +5 = 2k+1 for some integer k (definition of odd

numbers)numbers) nn33 = 2k+6 = 2k+6 Umm…Umm…

So direct proof didn’t work out. Next up: indirect So direct proof didn’t work out. Next up: indirect proofproof

3 62 kn

Page 9: 09-Methods of Proof

99

Example of which to useExample of which to use

Rosen, section 1.5, question 21 (a)Rosen, section 1.5, question 21 (a) Prove that if n is an integer and nProve that if n is an integer and n33+5 is odd, then n is +5 is odd, then n is

eveneven

Via indirect proofVia indirect proof Contrapositive: If n is odd, then nContrapositive: If n is odd, then n33+5 is even+5 is even Assume n is odd, and show that nAssume n is odd, and show that n33+5 is even+5 is even n=2k+1 for some integer k (definition of odd numbers)n=2k+1 for some integer k (definition of odd numbers) nn33+5 = (2k+1)+5 = (2k+1)33+5 = 8k+5 = 8k33+12k+12k22+6k+6 = 2(4k+6k+6 = 2(4k33+6k+6k22+3k+3)+3k+3) As 2(4kAs 2(4k33+6k+6k22+3k+3) is 2 times an integer, it is even+3k+3) is 2 times an integer, it is even

Page 10: 09-Methods of Proof

10

Quick surveyQuick survey

I feel I understand direct proofs and I feel I understand direct proofs and indirect proofs…indirect proofs…

a)a) Very wellVery well

b)b) With some review, I’ll be goodWith some review, I’ll be good

c)c) Not reallyNot really

d)d) Not at allNot at all

Page 11: 09-Methods of Proof

1111

Proof by contradictionProof by contradiction

Given a statement p, assume it is falseGiven a statement p, assume it is false Assume ¬pAssume ¬p

Prove that ¬p cannot occurProve that ¬p cannot occur A contradiction existsA contradiction exists

Given a statement of the form p→qGiven a statement of the form p→q To assume it’s false, you only have to consider the To assume it’s false, you only have to consider the

case where p is true and q is falsecase where p is true and q is false

Page 12: 09-Methods of Proof

1212

Proof by contradiction example 1Proof by contradiction example 1

Theorem (by Euclid): There are infinitely many Theorem (by Euclid): There are infinitely many prime numbers. prime numbers.

Proof. Assume there are a finite number of primesProof. Assume there are a finite number of primes

List them as follows: pList them as follows: p11, p, p22 …, p …, pnn..

Consider the number q = pConsider the number q = p11pp22 … p … pnn + 1 + 1 This number is not divisible by any of the listed primesThis number is not divisible by any of the listed primes

If we divided pIf we divided pii into q, there would result a remainder of 1 into q, there would result a remainder of 1 We must conclude that q is a prime number, not among We must conclude that q is a prime number, not among

the primes listed abovethe primes listed aboveThis contradicts our assumption that all primes are in the list This contradicts our assumption that all primes are in the list pp11, p, p22 …, p …, pnn..

Page 13: 09-Methods of Proof

1313

Proof by contradiction example 2Proof by contradiction example 2

Rosen, section 1.5, question 21 (b)Rosen, section 1.5, question 21 (b) Prove that if n is an integer and nProve that if n is an integer and n33+5 is odd, then n is even+5 is odd, then n is even Rephrased: If nRephrased: If n33+5 is odd, then n is even+5 is odd, then n is even

Assume p is true and q is falseAssume p is true and q is false Assume that nAssume that n33+5 is odd, and n is odd+5 is odd, and n is odd

n=2k+1 for some integer k (definition of odd numbers)n=2k+1 for some integer k (definition of odd numbers)

nn33+5 = (2k+1)+5 = (2k+1)33+5 = 8k+5 = 8k33+12k+12k22+6k+6 = 2(4k+6k+6 = 2(4k33+6k+6k22+3k+3)+3k+3)

As 2(4kAs 2(4k33+6k+6k22+3k+3) is 2 times an integer, it must be +3k+3) is 2 times an integer, it must be eveneven

Contradiction!Contradiction!

Page 14: 09-Methods of Proof

1414

A note on that problem…A note on that problem…

Rosen, section 1.5, question 21Rosen, section 1.5, question 21 Prove that if n is an integer and nProve that if n is an integer and n33+5 is odd, then n is even+5 is odd, then n is even Here, our implication is: If nHere, our implication is: If n33+5 is odd, then n is even+5 is odd, then n is even

The indirect proof proved the contrapositive: ¬q → ¬pThe indirect proof proved the contrapositive: ¬q → ¬p I.e., If n is odd, then nI.e., If n is odd, then n33+5 is even+5 is even

The proof by contradiction assumed that the implication The proof by contradiction assumed that the implication was false, and showed a contradictionwas false, and showed a contradiction

If we assume p and ¬q, we can show that implies qIf we assume p and ¬q, we can show that implies q The contradiction is q and ¬qThe contradiction is q and ¬q

Note that both used similar steps, but are different Note that both used similar steps, but are different means of proving the implicationmeans of proving the implication

Page 15: 09-Methods of Proof

1515

How the book explains How the book explains proof by contradictionproof by contradiction

A very poor explanation, IMHOA very poor explanation, IMHO

Suppose q is a contradiction (i.e. is always false)Suppose q is a contradiction (i.e. is always false)

Show that ¬p→q is trueShow that ¬p→q is true Since the consequence is false, the antecedent must be Since the consequence is false, the antecedent must be

falsefalse Thus, p must be trueThus, p must be true

Find a contradiction, such as (rFind a contradiction, such as (r¬r), to represent q¬r), to represent q

Thus, you are showing that ¬p→(rThus, you are showing that ¬p→(r¬r)¬r) Or that assuming p is false leads to a contradictionOr that assuming p is false leads to a contradiction

Page 16: 09-Methods of Proof

1616

A note on proofs by contradictionA note on proofs by contradiction

You can DISPROVE something by using a proof You can DISPROVE something by using a proof by contradictionby contradiction You are finding an example to show that something is You are finding an example to show that something is

not truenot true

You cannot PROVE something by exampleYou cannot PROVE something by example

Example: prove or disprove that all numbers are Example: prove or disprove that all numbers are eveneven Proof by contradiction: 1 is not evenProof by contradiction: 1 is not even (Invalid) proof by example: 2 is even(Invalid) proof by example: 2 is even

Page 17: 09-Methods of Proof

17

Quick surveyQuick survey

I feel I understand proof by I feel I understand proof by contradiction…contradiction…

a)a) Very wellVery well

b)b) With some review, I’ll be goodWith some review, I’ll be good

c)c) Not reallyNot really

d)d) Not at allNot at all

Page 18: 09-Methods of Proof

1818

Vacuous proofsVacuous proofs

Consider an implication: p→qConsider an implication: p→q

If it can be shown that p is false, then the If it can be shown that p is false, then the implication is always trueimplication is always true By definition of an implicationBy definition of an implication

Note that you are showing that the Note that you are showing that the antecedent is falseantecedent is false

Page 19: 09-Methods of Proof

1919

Vacuous proof exampleVacuous proof example

Consider the statement:Consider the statement: All criminology majors in CS 202 are femaleAll criminology majors in CS 202 are female Rephrased: If you are a criminology major and Rephrased: If you are a criminology major and

you are in CS 202, then you are femaleyou are in CS 202, then you are femaleCould also use quantifiers!Could also use quantifiers!

Since there are no criminology majors in Since there are no criminology majors in this class, the antecedent is false, and the this class, the antecedent is false, and the implication is trueimplication is true

Page 20: 09-Methods of Proof

2020

Trivial proofsTrivial proofs

Consider an implication: p→qConsider an implication: p→q

If it can be shown that q is true, then the If it can be shown that q is true, then the implication is always trueimplication is always true By definition of an implicationBy definition of an implication

Note that you are showing that the Note that you are showing that the conclusion is trueconclusion is true

Page 21: 09-Methods of Proof

2121

Trivial proof exampleTrivial proof example

Consider the statement:Consider the statement: If you are tall and are in CS 202 then you are If you are tall and are in CS 202 then you are

a studenta student

Since all people in CS 202 are students, Since all people in CS 202 are students, the implication is true regardlessthe implication is true regardless

Page 22: 09-Methods of Proof

2222

Proof by casesProof by cases

Show a statement is true by showing all Show a statement is true by showing all possible cases are truepossible cases are true

Thus, you are showing a statement of the Thus, you are showing a statement of the form:form:

is true by showing that:is true by showing that:

qppp n ...21

qpqpqpqppp nn ...... 2121

Page 23: 09-Methods of Proof

2323

Proof by cases exampleProof by cases example

Prove that Prove that Note that b ≠ 0Note that b ≠ 0

Cases:Cases: Case 1: a ≥ 0 and b > 0Case 1: a ≥ 0 and b > 0

Then |a| = a, |b| = b, andThen |a| = a, |b| = b, and Case 2: a ≥ 0 and b < 0Case 2: a ≥ 0 and b < 0

Then |a| = a, |b| = -b, andThen |a| = a, |b| = -b, and Case 3: a < 0 and b > 0Case 3: a < 0 and b > 0

Then |a| = -a, |b| = b, andThen |a| = -a, |b| = b, and Case 4: a < 0 and b < 0Case 4: a < 0 and b < 0

Then |a| = -a, |b| = -b, andThen |a| = -a, |b| = -b, and

b

a

b

a

b

a

b

a

b

a

b

a

b

a

b

a

b

a

b

a

b

a

b

a

b

a

b

a

b

a

b

a

b

a

Page 24: 09-Methods of Proof

2424

The think about proof by casesThe think about proof by cases

Make sure you get ALL the casesMake sure you get ALL the cases The biggest mistake is to leave out some of The biggest mistake is to leave out some of

the casesthe cases

Page 25: 09-Methods of Proof

25

Quick surveyQuick survey

I feel I understand trivial and vacuous I feel I understand trivial and vacuous proofs and proof by cases…proofs and proof by cases…

a)a) Very wellVery well

b)b) With some review, I’ll be goodWith some review, I’ll be good

c)c) Not reallyNot really

d)d) Not at allNot at all

Page 26: 09-Methods of Proof

2626

Proofs of equivalencesProofs of equivalences

This is showing the definition of a bi-This is showing the definition of a bi-conditionalconditional

Given a statement of the form “p if and Given a statement of the form “p if and only if q”only if q” Show it is true by showing (p→q)Show it is true by showing (p→q)(q→p) is (q→p) is

truetrue

Page 27: 09-Methods of Proof

2727

Proofs of equivalence exampleProofs of equivalence example

Rosen, section 1.5, question 40Rosen, section 1.5, question 40 Show that mShow that m22=n=n22 if and only if m=n or m=-n if and only if m=n or m=-n Rephrased: (mRephrased: (m22=n=n22) ↔ [(m=n)) ↔ [(m=n)(m=-n)](m=-n)]

Need to prove two parts:Need to prove two parts: [(m=n)[(m=n)(m=-n)] → (m(m=-n)] → (m22=n=n22))

Proof by cases!Proof by cases!Case 1: (m=n) → (mCase 1: (m=n) → (m22=n=n22))

(m)(m)22 = m = m22, and (n), and (n)22 = n = n22, so this case is proven, so this case is proven

Case 2: (m=-n) → (mCase 2: (m=-n) → (m22=n=n22)) (m)(m)22 = m = m22, and (-n), and (-n)22 = n = n22, so this case is proven, so this case is proven

(m(m22=n=n22) → [(m=n)) → [(m=n)(m=-n)](m=-n)]Subtract nSubtract n22 from both sides to get m from both sides to get m22-n-n22=0=0Factor to get (m+n)(m-n) = 0Factor to get (m+n)(m-n) = 0Since that equals zero, one of the factors must be zeroSince that equals zero, one of the factors must be zeroThus, either m+n=0 (which means m=n)Thus, either m+n=0 (which means m=n)Or m-n=0 (which means m=-n)Or m-n=0 (which means m=-n)

Page 28: 09-Methods of Proof

2828

Existence proofsExistence proofs

Given a statement: Given a statement: x P(x)x P(x)We only have to show that a P(c) exists for We only have to show that a P(c) exists for some value of csome value of c

Two types:Two types: Constructive: Find a specific value of c for Constructive: Find a specific value of c for

which P(c) existswhich P(c) exists Nonconstructive: Show that such a c exists, Nonconstructive: Show that such a c exists,

but don’t actually find itbut don’t actually find itAssume it does not exist, and show a contradictionAssume it does not exist, and show a contradiction

Page 29: 09-Methods of Proof

2929

Constructive existence proof Constructive existence proof exampleexample

Show that a square exists that is the sum Show that a square exists that is the sum of two other squaresof two other squares Proof: 3Proof: 322 + 4 + 422 = 5 = 522

Show that a cube exists that is the sum of Show that a cube exists that is the sum of three other cubesthree other cubes Proof: 3Proof: 333 + 4 + 433 + 5 + 533 = 6 = 633

Page 30: 09-Methods of Proof

3030

Non-constructive existence proof Non-constructive existence proof exampleexample

Rosen, section 1.5, question 50Rosen, section 1.5, question 50Prove that either 2*10Prove that either 2*10500500+15 or 2*10+15 or 2*10500500+16 is not a +16 is not a perfect squareperfect square

A perfect square is a square of an integerA perfect square is a square of an integer Rephrased: Show that a non-perfect square exists in the set Rephrased: Show that a non-perfect square exists in the set

{2*10{2*10500500+15, 2*10+15, 2*10500500+16}+16}

Proof: The only two perfect squares that differ by 1 are 0 Proof: The only two perfect squares that differ by 1 are 0 and 1and 1

Thus, any other numbers that differ by 1 cannot both be perfect Thus, any other numbers that differ by 1 cannot both be perfect squaressquares

Thus, a non-perfect square must exist in any set that contains Thus, a non-perfect square must exist in any set that contains two numbers that differ by 1two numbers that differ by 1

Note that we didn’t specify which one it was!Note that we didn’t specify which one it was!

Page 31: 09-Methods of Proof

3131

Uniqueness proofsUniqueness proofs

A theorem may state that only one such A theorem may state that only one such value existsvalue exists

To prove this, you need to show:To prove this, you need to show: Existence: that such a value does indeed Existence: that such a value does indeed

existexistEither via a constructive or non-constructive Either via a constructive or non-constructive existence proofexistence proof

Uniqueness: that there is only one such valueUniqueness: that there is only one such value

Page 32: 09-Methods of Proof

3232

Uniqueness proof exampleUniqueness proof example

If the real number equation 5x+3=a has a If the real number equation 5x+3=a has a solution then it is uniquesolution then it is unique

ExistenceExistence We can manipulate 5x+3=a to yield x=(a-3)/5We can manipulate 5x+3=a to yield x=(a-3)/5 Is this constructive or non-constructive?Is this constructive or non-constructive?

UniquenessUniqueness If there are two such numbers, then they would fulfill If there are two such numbers, then they would fulfill

the following: a = 5x+3 = 5y+3the following: a = 5x+3 = 5y+3 We can manipulate this to yield that x = yWe can manipulate this to yield that x = y

Thus, the one solution is unique!Thus, the one solution is unique!

Page 33: 09-Methods of Proof

3333

CounterexamplesCounterexamples

Given a universally quantified statement, find a single Given a universally quantified statement, find a single example which it is not trueexample which it is not true

Note that this is DISPROVING a UNIVERSAL statement Note that this is DISPROVING a UNIVERSAL statement by a counterexampleby a counterexample

x ¬R(x), where R(x) means “x has red hair”x ¬R(x), where R(x) means “x has red hair” Find one person (in the domain) who has red hairFind one person (in the domain) who has red hair

Every positive integer is the square of another integerEvery positive integer is the square of another integer The square root of 5 is 2.236, which is not an integerThe square root of 5 is 2.236, which is not an integer

Page 34: 09-Methods of Proof

3434

Mistakes in proofsMistakes in proofs

Modus BadusModus Badus Fallacy of denying the hypothesisFallacy of denying the hypothesis Fallacy of affirming the conclusionFallacy of affirming the conclusion

Proving a universal by exampleProving a universal by example You can only prove an existential by example!You can only prove an existential by example!

Page 35: 09-Methods of Proof

35

Quick surveyQuick survey

The pace of the lecture for this The pace of the lecture for this slide set was…slide set was…

a)a) FastFast

b)b) About rightAbout right

c)c) A little slowA little slow

d)d) Too slowToo slow

Page 36: 09-Methods of Proof

36

Quick surveyQuick survey

How interesting was the material in How interesting was the material in this slide set? Be honest!this slide set? Be honest!

a)a) Wow! That was SOOOOOO cool!Wow! That was SOOOOOO cool!

b)b) Somewhat interestingSomewhat interesting

c)c) Rather bortingRather borting

d)d) ZzzzzzzzzzzZzzzzzzzzzz