27
CS104:Discrete Structures Chapter 2: Proof Techniques

CS104:Discrete Structures

  • Upload
    tori

  • View
    91

  • Download
    0

Embed Size (px)

DESCRIPTION

CS104:Discrete Structures. Chapter 2: Proof Techniques. Introduction to Proofs (In Book: Chapter 1-sec 1.8). Introduction to Proofs. A proof : is a valid argument that establishes the truth of a mathematical statement . There are two types of proofs : - PowerPoint PPT Presentation

Citation preview

Page 1: CS104:Discrete Structures

CS104:Discrete Structures

Chapter 2:

Proof Techniques

Page 2: CS104:Discrete Structures

2

Introduction to Proofs (In Book: Chapter 1-sec 1.8)

Page 3: CS104:Discrete Structures

3

Introduction to Proofs

A proof : is a valid argument that establishes the truth of a mathematical statement.

There are two types of proofs : Formal proof : where all steps are supplied and the rules for each

step in the argument are given Informal proof : where more than one rule of inference may be used

in each step, where steps may be skipped, where the axioms being assumed and rule of inference used are not explicitly stated.

Page 4: CS104:Discrete Structures

4

Introduction to Proofs (Cont.) A theorem is a statement that can be shown to be true.

Less important theorems sometimes are called propositions. (Theorems can also be referred to as facts or results.) it may be the universal quantification of a conditional statement with one or

more premises and a conclusion, or it may be another type of logical statements. Proof is a valid argument (sequence of statements) that establishes

the truth of a theorem. And the statements to be used in proofs include: Axioms or postulates (statement assumed to be

true without proof) Hypothesis (premises) of the theorem Previously proven theorems Rules of inference used to draw conclusions and to move from one step to another

o Ex: If x is positive integer then x+1 is positive integer.AxiomsHypothesis

Proven theorems

New Theorems

Rules of inference

Page 5: CS104:Discrete Structures

5

Introduction to Proofs (Cont.)

Lemma is a less important theorem that is helpful in the proof of other results A corollary is a theorem that can be established directly from a theorem that has been proved. A conjuncture • is a statement that is being proposed to be a true statement, usually

on the basis of some partial evidence.• When a proof of a conjuncture is found, the conjuncture becomes a

theorem

Page 6: CS104:Discrete Structures

6

Introduction to Proofs (Cont.)

Methods of proving theorems:

Direct proofs Proof by Contraposition Vacuous Proofs Trivial Proofs Proofs by Contradiction Proof by cases

Page 7: CS104:Discrete Structures

7

Methods of proving theorems – Direct proofs

A direct proof of a conditional statement pq is constructed when the first step is the assumption that p is true; subsequent steps are constructed using rules of inference, with the final step showing that q must also be true.• A direct proof shows that a conditional statement pq is true by

showing that if p is true then q must also be true. • In a direct proof, we assume that p is true and use axioms,

definitions, and previously proven theorems, together with rules of inference, to show that q must also be true.

Page 8: CS104:Discrete Structures

8

Definition : The integer n is even if there exists an integer k such that n = 2k, and n is odd if there exists an integer k such that n = 2k + 1.

Note that every integer is either even or odd, and no integer is both even and odd. Two integers have the same parity when both are even or both are odd; they have opposite parity when one is even and the other is odd.

Methods of proving theorems – Direct proofs

Page 9: CS104:Discrete Structures

9

Methods of proving theorems – Direct proofs

Example Give a direct proof of the theorem : “If n is an odd integer, then n2 is odd.”

Proof: We assume that n is odd.

(hypothesis)=> n = 2k + 1, where k is some integer.

(definition of odd number)

=> n2 = (2k+1)2 = 4k2 + 4k + 1 = 2(2k2+2k)+1 (By squaring)Since r = 2k2+2k is an integer (Axiom)=> n2 = 2r+1 is odd.

Example :Use a direct proof to show that : “If n is an even integer, then n2 is even.”

We can square both sides of the equation n = 2k + 1 to obtain a new equation that expresses n2

Page 10: CS104:Discrete Structures

10

Methods of proving theorems – Direct proofs

Can we use this methodology to prove theorems of the form ∀x(P(x) → Q(x)) ?

Proofs of theorems of this type that are not direct proofs, that is, that do not start with the premises and end with the conclusion are called indirect proof.

Example Give a direct proof of the theorem : “if m and n are both perfect squares, then nm is also perfect”

Proof: We assume that m and n are both perfect squares :m = s2 and n = t2

m.n = s2.t2 = (st)2

m.n is also perfect

Page 11: CS104:Discrete Structures

11

Methods of proving theorems – Proof by Contraposition

An extremely useful type of indirect proof is known as proof by contraposition ( p → q equivalent to ¬ q → ¬ p ) Methodology of Proof by Contraposition : It is proving the conditional statement p → q by showing that its contrapositive, ¬ q → ¬ p, is trueto prove that p → q

¬ q

Begin with is true as a premise

using (axioms, definitions previously proven theorems with rules of inference)

¬ p must be also true

It is showing the contrapositive¬ q →¬ p is true

End with

is true

Page 12: CS104:Discrete Structures

12

Example Prove that if n is an integer and 3n + 2 is odd, then n is odd. Proof:

We assume that the conclusion of the conditional statement “if 3n + 2 is odd, then n is odd” is false .

=> n = 2k , where k is some integer.(definition of even number)

=> 3n + 2 = 3(2k) + 2 = 6k + 2 = 2(3k + 1)(Substituting 2k for n)Since r = 3k + 1 is an integer (Axiom)=> 3n + 2 = 2r is even .

=> We assume that n is even.

(hypothesis)

(definition of even number)Because the negation of the conclusion of the conditional statement implies that the hypothesis is false, the original conditional statement is true.

We have proved the theorem “if 3n + 2 is odd, then n is odd”

Methods of proving theorems – Proof by Contraposition

( Substituting 2k for n in hypthesis : 3n+2 )

Page 13: CS104:Discrete Structures

13

Example Use an indirect proof to show that “if n2 is odd then n is odd” Proof:

The contraposition is “if n is not odd then n2 is not odd ”

=> n = 2k , where k is some integer.(definition of even number)=> n2 = (2k)2 = 4k2 = 2(2k2)

Since r = 2k2 is an integer (Axiom)=> n2 = 2r

=> We Assume that n is not odd i.e., n is even

(hypothesis)

(definition of not odd number)

Methods of proving theorems – Proof by Contraposition

Thus , if n2 is odd then n is odd is true

Page 14: CS104:Discrete Structures

14 Example Prove that if n = ab where a and b are positive integers then a n or b n

Proof: Let p=“an”, q=“bn” and r=“n=ab” We want to prove that r pq=> The contraposition is (pq ) r (By definition)=> p q r (De Morgan’s law)Now, assume that an and bn (p q)=> a.b n.n = n (by multiplying above twos)=> ab n => r which contradicts the statement n = ab

Because the negation of the conclusion of the conditional statement implies that the hypothesis is false, the original conditional statement is true.

Methods of proving theorems – Proof by Contraposition

Page 15: CS104:Discrete Structures

15

Methods of proving theorems – Vacuous Proofs

Vacuous Proofs A conditional statement p q is TRUE if p is FALSE. If we can show that p is False, then we have a proof, called vacuous proof, of the conditional statement p q .

p q p qFFTT

FTFT

TTFT

Example Show that the proposition P(0) is true, where P(n) is “If n > 1, then n2 > n” and the domain consists of all integers. Proof: Note that P(0) is “If 0 > 1, then 02 > 0.” We can show P(0) using a vacuous proof. Indeed, the hypothesis 0 > 1 is false. This tells us that P(0) is automatically true. Example Prove that if he is alive and he is dead then the sun is ice cold

Proof: Since the hypothesis is always false the implication is vacuously true.

Page 16: CS104:Discrete Structures

16

Methods of proving theorems – Trivial Proofs

Trivial Proofs A conditional statement p q is TRUE if q is True . If we can show that q is True, then we have a proof, called Trivial proof, of the conditional statement p q .

p q p qFFTT

FTFT

TTFT

Example Let P(n) be “If a and b are positive integers with a ≥ b, then an ≥ bn where the domain consists of all nonnegative integers. Show that P(0) is true. Proof: The proposition P(0) is “If a ≥ b, then a0 ≥ b0.” Because a0 = b0 = 1, the conclusionof the conditional statement “If a ≥ b, then a0 ≥ b0” is true. Hence, this conditional statement, which is P(0), is true Example Prove that if x=2 then x2 0 for all real numbers Proof: Since x2 0 is true then the implication is trivially true. (we didn’t use the fact x=2) Example Use a trivial proof to show that if n > 1 then n2 ≥ n for all integers

Page 17: CS104:Discrete Structures

17

Methods of proving theorems – Proofs by Contradiction

Proofs by ContradictionLet p be the statement we want to prove is true, assuming not p (p )and show a contradiction p q

Example Prove that 2 is irrational by giving a proof by contradiction. Proof: Let p is “2 is irrational “ To start a proof by contradiction, we suppose that ¬ p is true , "It is not the case that is irrational”

Let p is 2 is rational (hypothesis)

2 = a/b for some integers a and b (b0) and a and b have no common factors We can square both sides of the equation 2 = a/b => 2 = a2/b2

Definition: The real number r is rational if there exist integers p and q with q 0 such that r = p/q and p and q have no common factors A real number that is not rational is called irrational

Page 18: CS104:Discrete Structures

18

Methods of proving theorems – Proofs by Contradiction

We have now shown that the assumption of ¬ p leads to the equation √2 = a/b, where a and b have no common factors, but both a and b are even ( that is, 2 divides both a and b)

That is our assumption of ¬ p leads to the contradiction, ¬ p must be false.That is, the statement p, “ √2 is irrational,” is true. We have proved that √2 is irrational.

=> 2b2 = a2 By the definition of an even integer it follows that a2 is even, so we can substituting with a = 2c for some integer => 2b2 = (2c)2 = 4c2

Þ b2 = 2c2 By the definition of an even integer it follows that b2 is even , i.e. b is even

(Dividing both sides of this equation by 2)

Page 19: CS104:Discrete Structures

Methods of proving theorems – Proofs by Contradiction

19

To prove a conditional statement p q by contradiction we prove that: ( p q F is true ) which is equivalent to p q . Example Give a proof by contradiction of the theorem : “If 3n + 2 is odd, then n is odd.”

Proof: Suppose that 3n+2 is odd and n is even [p q] => n = 2r

(hypothesis q, definition of even numbers) =>3n = 6r

(multiply both sides by 3) => 3n+2=2+6r

(add 2 to both sides) => 3n+2=2(1+3r) => 3n+2=2k

(Let k=1+3r)

=> Thus 3n+2 is even which is false (a contradiction !) Therefore the implication is true.

Page 20: CS104:Discrete Structures

20

Methods of proving theorems – Proofs of Equivalence

Proofs of Equivalence To prove a theorem that is a biconditional statement, that is, a statement of the form p ↔ q, we show that p → q and

q → p are both true. Example Prove the theorem: “If n is an integer, then n is odd if and only if n2 is odd.”

“if n is odd then n2 is odd” proved in Example 5 “ n2 is odd then n is odd” proved in Example 7 Therefore, n is even if and only if n2 is even

Proving equivalence of several propositions: If we want to prove that p1 p2 p3… pn

Then it is sufficient to prove p1 p2,, p2 p3 … pn p1

Page 21: CS104:Discrete Structures

21

Methods of proving theorems – Counterexample

Counterexample : To show that a statement of the form ∀xP(x) is false, we need only find a counterexample, that is, an example x for which P(x) is false.

E.g. Prove that “For all real numbers x2 > x” is false X=0.5 is a counterexample since 0.52 > 0.5 is not true

To show that this statement is false, we look for a counterexample which is 3 because we cannot write 3 as the sum of the squares of two integers. To show this is the case, note that the only perfect squares not exceeding 3 are: (02 = 0 & 12 = 1), but 3 1+0. Therefore the statement is false

Example Show that the statement: “Every positive integer is the sum of the squares of two integers” is false.

Page 22: CS104:Discrete Structures

22

Methods of proving theorems – proof by cases

Proof by cases : A proof by cases must cover all possible cases that arise in a theorem. Each case may cover an infinite number of instances Example Prove "if n is an integer then n2 ≥ n".

Proof: We can prove that n2 ≥ n for every integer by considering three cases, when n = 0, when n ≥ 1, and when n ≤ -1. Case 1: When n = 0, since 02 = 0, 02 >= 0. So, n2 ≥ n is true. Case 2: When n ≥ 1, From n ≥ 1, we get n2 ≥ n (by multiplying with n). Case 3: When n ≤ -1, since n is negative, n2 is positive, so n2 ≥ n.Hence, if n is an integer then n2 ≥ n.

Page 23: CS104:Discrete Structures

23

Methods of proving theorems – proof by cases

Example Use a proof by cases to prove that |xy| = |x||y|, where x and y real numbers.Hint: Consider all 4 cases: x and y positive or negative

Proof: using the fact that |a| = a if a 0 and |a| = -a if a 0 , there are four cases for x and y :

Case 1: x and y both are nonnegative: xy 0 so that |xy| = xy = |x||y| Case 2 : x is nonnegative and y is negative: xy 0 so that |xy| = - xy = x(-y) = |x||y|Case 3 : x is negative and y is nonnegative: xy 0 so that |xy| = - xy = (-x)y = |x||y| Case 4 : x and y both are negative xy 0 so that |xy| = xy = (-x)(-y) = |x||y|

Page 24: CS104:Discrete Structures

24

Mistakes in Proofs

There are many common errors made in constructing mathematical and the most common errors are mistakes in arithmetic and basic algebra.

Each step of a mathematical proof needs to be correct and the conclusion needs to follow logically from the steps that precede it.Be careful!

Many mistakes result from the introduction of steps that do not logically follow from those that precede it

Page 25: CS104:Discrete Structures

25

Mistakes in Proofs

Example What is wrong with this famous supposed “proof” that 1 = 2 ? Proof: Suppose a and b are two equal positive integers.

Steps : 1. a = b 2. a2 = ab3. a2 - b2 = ab - b2

4. (a − b)(a + b) = b(a − b)

5. a + b = b6. 2b = b7. 2 = 1

Reason ( Given) (Multiply both sides of (1) by a)(Subtract b2 from both sides of (2)) (Factor both sides of (3))(Divide both sides of (4) by a − b )(Replace a by b in (5) because a = b &

simplify)(Divide both sides of (6) by b) Can you find the error

The error is that a − b equals zero; division of

both sides of an equation by the same quantity is

valid as long as this quantity is not zero.

Every step is valid except for one, step 5 where we divided both sides by a − b

Page 26: CS104:Discrete Structures

26

Mistakes in Proofs

Example What is wrong with this “proof” ? “Theorem:” If n2 is positive, then n is positive.

Proof: Suppose that n2 is positive. Because the conditional statement : “If n is positive, then n2 is positive” is true, we can conclude that n is positive.

Then our hypothesis is Q(n). (1) Solution : Let P(n) be “n is positive” and Q(n) be “n2 is positive.”

This statement “If n is positive, then n2 is positive” is the statement: ∀n(P (n) → Q(n)). (2) From the hypothesis (1) and the statement (2): We cannot conclude P(n)

because we are not using a valid rule of

inference.

Instead, we can prove that by using counterexampleA counterexample

supplied by n = −1 for which n2 = 1 is

positive, but n is negative.

Page 27: CS104:Discrete Structures

End of Chapter 2