MC0082-Unit-02 (1)

13
Theory of Computer Science Unit 2 Sikkim Manipal University Page No.: 33 Unit 2 Proof Techniques Structure 2.1 Introduction Objectives 2.2 Proof Techniques 2.3 Summary 2.4 Terminal Questions 2.5 Answers 2.1 Introduction In this unit would discuss various methods of proofs and a few examples. The techniques will give an idea to analyze and solve the problems. We are introduced to certain fundamental mathematical concepts. The idea of graphs and trees is being discussed in this unit. Objectives: At the end of the unit you would be able to understand the fundamental idea of certain mathematical concepts. learn the various operations on sets. learn Graphs and Trees. know the methods of proof. 2.2 Proof Techniques A significant requirement for reading this subject is the ability to follow proofs. In mathematical arguments, we employ the accepted rules of deductive reasoning, and many proofs are simply a sequence of such steps. Direct Proof: Consider a set of hypothesis H 1 , H 2 , …, H n from which we want to infer a conclusion C. Consider the example: Prove that if x and y are rational numbers then x + y is rational.

description

ZZZ

Transcript of MC0082-Unit-02 (1)

Page 1: MC0082-Unit-02 (1)

Theory of Computer Science Unit 2

Sikkim Manipal University Page No.: 33

Unit 2 Proof Techniques

Structure

2.1 Introduction

Objectives

2.2 Proof Techniques

2.3 Summary

2.4 Terminal Questions

2.5 Answers

2.1 Introduction

In this unit would discuss various methods of proofs and a few examples.

The techniques will give an idea to analyze and solve the problems. We are

introduced to certain fundamental mathematical concepts. The idea of

graphs and trees is being discussed in this unit.

Objectives:

At the end of the unit you would be able to

understand the fundamental idea of certain mathematical concepts.

learn the various operations on sets.

learn Graphs and Trees.

know the methods of proof.

2.2 Proof Techniques

A significant requirement for reading this subject is the ability to follow

proofs. In mathematical arguments, we employ the accepted rules of

deductive reasoning, and many proofs are simply a sequence of such steps.

Direct Proof: Consider a set of hypothesis H1, H2, …, Hn from which we

want to infer a conclusion C.

Consider the example: Prove that if x and y are rational numbers then

x + y is rational.

Page 2: MC0082-Unit-02 (1)

Theory of Computer Science Unit 2

Sikkim Manipal University Page No.: 34

Solution: Since x and y are rational numbers, we can find integers p, q, m,

n such that x = p/q and y = m/n. Then x + y = p/q + m/n = (pn + mq)/qn.

Since pn + mq and qn are both integers, we conclude that x + y is a rational

number.

Indirect Proof: Proofs that are not direct are called indirect. Two main

types of indirect proof uses both the negation and conclusion, so they are

often suitable when that negation is easy to state. The first type of proof is

contra-positive proof.

Consider the example: Prove that if m + n 73, then m 37 or n 37, m

and n being positive integers.

Solution: We prove this by taking contra-positive: not “m 37 or n 37”

implies not “m + n 73”. By De morgan law, the negation of “m 37 or n

37” is “not m 37 and n 37”. That is,

“m ≤ 36 and n ≤ 36” so that the contrapositive proposition is if m ≤ 36 and

n ≤ 36 then m + n ≤ 72. This follows that from the inequalities: a ≤ c and

b ≤ d imply that a + b ≤ c + d for all real numbers a, b, c, d.

A few special proof techniques are used so frequently that it is appropriate

to review them briefly.

1. Proof by induction

2. Proof by contradiction

3. The pigeonhole principle, and

4. The Diagonalization Principle

5. Proof by Contradiction

2.2.1 Proof by Induction

Let A be the set of all natural numbers such that

i) 0 A, and

ii) for each natural number n, if {0, 1,... , n} A, then n + 1 A.

Then A = N.

Page 3: MC0082-Unit-02 (1)

Theory of Computer Science Unit 2

Sikkim Manipal University Page No.: 35

In other words: The principle of mathematical induction states that any set

of natural numbers containing zero, and with the property that it contains n +

1 whenever it contains all the numbers up to and including n, must in fact be

the set of all natural numbers.

In practice, induction is used to prove assertions of the following form:

“For all natural numbers n, property P is true.”

The above principle is applied to the set A = {n: P is true of n} in the

following way.

1. In the basis step we show that 0 A, that is, that P is true of 0.

2. The induction hypothesis is the assumption that for some fixed but

arbitrary n 0, P holds for each natural number 0,1,... , n.

3. In the induction step we show, using the induction hypothesis, that P is

true of n + 1. By the induction principle, A is then equal to N, that is, P

holds for every natural number.

2.2.2 Example

Prove by mathematical induction that the sum of the first n natural numbers

is

2

1nn

Solution:

That is to prove that 1 + 2 + 3 + …. + n

2

1nn

i) Base Step: Let n = 0. Then the sum on the left is zero, since there is

nothing to add. The expression on the right is also zero.

For 1n , left side = 1, right side

12

111

. Hence the result is

true for 1n

Page 4: MC0082-Unit-02 (1)

Theory of Computer Science Unit 2

Sikkim Manipal University Page No.: 36

ii) Induction Hypothesis: Assume that the result to be true for m ≤ n

and n 0. Then 1 + 2 + 3 + … + 2

1mmm

iii) Induction Step: We now show that the above result is true for

1mn . Adding the th1m term viz., 1m to both sides we

obtain.

1 + 2 + 3 + ... + 1m2

1mm1mm

2

2m1m1

2

m1m

2

11m1m ,

which is the same as the given result for 1mn

Hence by mathematical induction, the result is true for all positive

integral values of n.

2.2.3 Example

Prove by mathematical induction that

6

1n21nnn....321 2222

Solution:

i) Base Step: Let n = 0. Then the sum on the left is zero, since there is

nothing to add. The expression on the right is also zero.

If 1n , left side 112 .

Right side

16

3.2.1

6

11.2111

.

Hence the result is true for n = 1.

ii) Induction Hypothesis: Assume that the result to be true for n = m

Then

6

1m21mmm...321

2222 .

Page 5: MC0082-Unit-02 (1)

Theory of Computer Science Unit 2

Sikkim Manipal University Page No.: 37

Adding the th1m term i.e. 21m to both sides of the above

equation, we get,

222221m

6

1m21mm1mm...21

1m61m2m

6

1m

6m7m2

6

1m 2

6

3m22m1m

6

11m211m1m

Therefore, the result is true for 1mn . Hence by mathematical

induction, the given result is true for all positive integers n.

2.2.4 Example

For any finite set A, the cardinality of the power set of A is 2 raised to a

power equal to the cardinality of A.

Solution:

i) Basis Step: Let A be a set of cardinality n = 0. Then A = , and 2A =

20 = 1; on the other hand, 2A = {}, and 2A = {} = 1.

ii) Induction Hypothesis: Let n > 0, and suppose that 2A = 2A

provided that A≤ n.

iii) Induction Step: Let A be such that A = n+ 1. Since n > 0, A

contains at least one element a. Let B = A -{a}; then B = n. By the

induction hypothesis, 2B = 2B = 2n.

Now the power set of A can be divided into two parts, those sets containing

the element a and those sets not containing a. The latter part is just 2B, and

the former part is obtained by introducing a into each member of 2B. Thus

Page 6: MC0082-Unit-02 (1)

Theory of Computer Science Unit 2

Sikkim Manipal University Page No.: 38

2A =2B {C {a}: C 2B}.

This division in fact partitions 2A into two disjoint equinumerous parts, so the

cardinality of the whole is twice 2B , which, by the induction hypothesis, is

2 2n = 2 n+1. This completes the proof.

2.2.5 Example

(Refer the unit 3 for definition of binary tree) A binary tree is a tree in which

no parent can have more than two children.

Example: Prove that a binary tree of height n has at most 2n leaves.

Solution: If we denote the maximum number of leaves of a binary tree of

height n by l(n), then we want to show that l(n) ≤ 2n.

Basic Step: Clearly l(0) = 1 = 20 since a tree of height 0 can have no nodes

other than the root, that is , it has at most one leaf.

Inductive Hypothesis: l(i) ≤ 2i for i = 0, 1, …, n.

Inductive step: To get a binary tree of height n +1 from one of height n, we

can create, at most, two leaves in place of each previous one. Therefore,

l(n + 1) = 2l(n).

Now, using the inductive assumption, we get

l(n + 1) ≤ 2 2n = 2n+1.

Therefore, our claim is true for n + 1. Since n is arbitrary, we can conclude

that the statement is true for all n.

2.2.6 Example

(Refer unit 3 for the definition of tree) A tree G with „n‟ vertices has (n - 1)

edges.

Proof: We prove this theorem by induction on the number vertices n.

Basic step: If n = 1, then G contains only one vertex and no edge. So the

number of edges in G is n -1 = 1 - 1 = 0.

Page 7: MC0082-Unit-02 (1)

Theory of Computer Science Unit 2

Sikkim Manipal University Page No.: 39

Induction hypothesis: The statement is true for all trees with less than „n‟

vertices.

Induction step: Now let us consider a tree with „n‟ vertices. Let „ek‟ be any

edge in T whose end vertices are vi and vj. Since T is a tree, by Theorem

6.5, there is no other path between vi and vj. So by removing ek from T, we

get a disconnected graph. Furthermore, T- ek consists of exactly two

components (say T1 and T2). Since T is a tree, there were no circuits in T

and so there were no circuits in T1 and T2. Therefore T1 and T2 are also trees.

It is clear that |V(T1)| + |V(T2)| = |V(T)| where V(T) denotes the set of vertices

in T.

Also |V(T1)| and |V(T2)| are less than n.

Therefore by the induction hypothesis, we have

|E(T1)| = |V(T1)| - 1 and |E(T2)| = |V(T2)| - 1.

Now |E(T)| - 1 = |E(T1)| + |E(T2)| = |V(T1)| - 1 + |V(T2)| - 1

|E(T)| = |V(T1)| + |V(T2)| - 1 = |V(T)| - 1 = n-1.

2.2.7 Problem

Prove by mathematical induction that n2 n for all positive integer n.

Solution: Let P(n) be the given proposition. Now P(1) implies 2 > 1 which is

true. Hence P(1) is true

Induction hypothesis: Let us assume that P m is true. That is 2m > m

Now 2m+1 = 2. 2m > 2m.. We know that 2m m m m 1 for all m N .

Therefore 2m+1 > m+1. Hence P (m+1) is true.

Therefore by induction P n is true for all n.

2.2.8 Example

Show by induction that n (n+1) (2n+1) is divisible by 6.

Solution: Let P (n) = n (n+1) (2n+1)

Now P (1) = 1. (1+1) (2+1) = 6 this is divisible by 6.

Page 8: MC0082-Unit-02 (1)

Theory of Computer Science Unit 2

Sikkim Manipal University Page No.: 40

Assume that P (m) is divisible by 6.

That is, m(m+1) (2m+1) is divisible by 6.

Therefore, m (m+1) (2m+1) = 6k for some integer k.

Now

P(m+1) = (m+1) [(m+1) + 1] [2 (m+1)+1]

m 1 m 2 2m 3

m 1 m 2 2m 1 2

m 1 m 2 2m 1 2 m 1 m 2

m m 1 2m 1 2 m 1 2m 1 2 m 1 m 2

6k 2 m 1 3m 3 by induction hypothesis

2

6k 6 m 1

Since each term on the R.H.S is divisible by 6 their sum is also divisible by 6.

Hence P(m+1) is divisible by 6. Therefore, by induction P (n) is divisible by

6 for all n N

2.2.9 The Pigeonhole Principle: If A and B are finite sets and A > B,

then there is no one-to-one function from A to B.

(In other words, if we attempt to pair off the elements of A (the “pigeons”)

with elements of B (the “pigeonholes”), sooner or later we will have to put

more than one pigeon in a pigeonhole).

Proof: Basis Step: Suppose B = 0, that is, B = . Then there is no

function f: A B and so no one to one function.

Induction Hypothesis: Suppose that f is not one-to-one, provided that

f: A B, A> B, and B ≤ n, where n 0.

Page 9: MC0082-Unit-02 (1)

Theory of Computer Science Unit 2

Sikkim Manipal University Page No.: 41

Induction Step: Suppose that f: A B and A> B = n + 1. Choose some

a A (since A > B = n + 1 1, A is nonempty, and therefore such a

choice is possible). If there is another element a a1 A, such that f(a) =

f(a1), then obviously f is not a one-to-one function, and we are done.

So, suppose that a is the only element mapped by f to f(a).

Consider then the sets A – {a}, B – {f(a)}.

The function g: A-{a} B-{f(a)} that agrees with f on all elements of A-{a}.

Now the induction hypothesis applies, because B-{f(a)} has n elements, and

A -{a} = A -1 > B -1 = B-{f(a)}.

Therefore, there are two distinct elements of A-{a} that are mapped by g

(and therefore by f) to the same element of B-{b}. Hence f is not one-to-one.

2.2.10 The Diagonalization Principle: Let R be a binary relation on a set

A, and let D, the diagonal set for R, be {a aA and (a, a) R}. For each

a A, let Ra = {b: b A and (a, b) R}. Then D is distinct from each Ra.

If A is a finite set, then R can be pictured as a square array; the rows and

columns are labeled with the elements of A and there is a cross in the box

with row labeled a and column labeled b, just in case (a, b) B. The

diagonal set D corresponds to the complement of the sequence of boxes

along the main diagonal, boxes with crosses being replaced by boxes

without crosses, and vice versa. The sets Ra correspond to the rows of the

array. The diagonalization principle can then be rephrased: the complement

of the diagonal is different from each row.

2.2.11 Example: Let us consider the relation R = {(a, b), (a, d), (b, b), (b, c),

(c, c), (d, b), (d, c), (d, e), (d, f), (e, e), (e, f), (f, a), (f, c), (f, d), (f, e)}; notice

that Ra = {b, d}, Rb = {b, c}, Rc = {c}, Rd = {b, c, e, f}, Re = {a, e}, and

Rf = {c, d, e}. All in all, R may be pictured like this:

Page 10: MC0082-Unit-02 (1)

Theory of Computer Science Unit 2

Sikkim Manipal University Page No.: 42

The sequence of boxes along the diagonal is

x x x

Its complement is

x x x

which corresponds to the diagonal set D = {a, d, f}. Indeed, D is different

from each row of the array; for D, because of the way it is constructed,

differs from the first row in the first position, from the second row in the

second position, and so on.

Mathematical induction is the process of proving a general theorem or

formula involving the positive integer n from particular cases.

A proof by mathematical induction consists of the following two steps.

i) Show by actual substitution that the theorem is true for n = 1

ii) Assuming the theorem to be true for n = m, prove that it is also true for

n = m + 1.

Note that here m is a particular value of n. From (i), the theorem is true for n = 1

and from (ii), it is true for n=1+1=2 ; since it is true for n=2 it follows from

(iii) that it is also true for n = 2+1 = 3 and so on. Hence, theorem is true for

all positive integral values of n.

Page 11: MC0082-Unit-02 (1)

Theory of Computer Science Unit 2

Sikkim Manipal University Page No.: 43

2.2.12 Proof by Contradiction

Proof by contradiction is sometimes very useful technique to prove that

some statements are true. In this technique, let us assume that property P is

not true. Using logical reasoning, we have to get a conclusion that

contradicts the given conditions.

2.2.13 Example

Prove by contradiction, that 2 is not a rational number.

Solution: A rational number is of the form p/q where q 0, and p, q are not

having any common factors.

Assume that 2 is a rational number. So it can be written as

2 = p/q.

p2 = 2q2.

p2 is even p is even.

If p is even, then it can be written as p = 2k. Therefore, 4k2 = 2q2. Therefore,

q is even.

This is a contradiction to our assumption that p and q have no common

factors. Therefore, 2 is not a rational number.

Self Assessment Questions

1. Prove by mathematical induction that

4

1nnn...321

223333 .

2. Prove that 8 is not a rational number (by the method of contradiction).

3. Prove that the product of two odd integers is an odd integer.

Page 12: MC0082-Unit-02 (1)

Theory of Computer Science Unit 2

Sikkim Manipal University Page No.: 44

2.3 Summary

We introduced a variety of different methods of proof and illustrated how

each method is used. This unit is useful for several other important proof

methods, where we consider different cases separately and proof where we

prove the existence of objects with desired properties.

2.4 Terminal Questions

1. What is wrong with the following purported proof that all horses are the

same color?

The proof is by induction on the number of horses.

Basic step: There is only one horse. Then clearly all horses have same

color.

Induction Hypothesis: In any group of up to n horses, all horses have

the same color.

Induction Step: Consider a group of n+1 horses. Discard one horse; by

induction hypothesis, all the remaining horses have the same color.

Now put that horse back and discard another; again all the remaining

horses have the same color. So all the horses have the same color as

the ones that were not discarded either time and so they all have the

same color.

2.5 Answers

1. i) For 1n , left side 113

right side

14

4.1

4

11122

Hence it is true for 1n

Page 13: MC0082-Unit-02 (1)

Theory of Computer Science Unit 2

Sikkim Manipal University Page No.: 45

ii) Assume the result to be true for mn

Then

4

1mmm...321

223333 (induction

hypothesis)

Adding the th1m term viz., 31m to both sides,

322

33331m

4

1mm1mm...21

4m4m

4

1m 22

4

2m1m22

4

11m1m22

Therefore the result is true for 1mn . Hence by mathematical

induction the given result is established for all positive integers.

3. Hint: Take two odd integers m and n. Then there exist two integers r

and t so that m = 2r + 1 and n = 2t + 1.