You are on page 1of 15

Fundamentals of Theory of Computer Science

Unit 3

Unit 3

Methods of Proof

Structure
3.1

Introduction
Objectives

3.2

Proof Techniques
Self Assessment Questions

3.3

Summary

3.4

Terminal Questions

3.5

Answers

3.1 Introduction
In this unit we discuss various methods of proofs and few examples. The
techniques will give an idea to analyze and solve the problems.

Objectives:
At the end of the unit the student must be able to:

Understand the proof techniques

Apply in various problems

Analyse various proof in automata

3.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.
Sikkim Manipal University

Page No.: 48

Fundamentals of Theory of Computer Science

Unit 3

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 which are not direct are called indirect. Two main
types of indirect proof, uses the negation and conclusion, so they are often
suitable when that negation is easy to state. The first type of proof is contrapositive 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 from the inequalities: a c and b d
imply that
a + b c + d for all real numbers a, b, c, d.
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 Digitalization Principle
5. Proof by Contradiction
6. Exhaustive Proof and Proof by cases

Sikkim Manipal University

Page No.: 49

Fundamentals of Theory of Computer Science

Unit 3

3.2.1 Proof by Induction


Let A be the set of all natural numbers such that

Then A = N.
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 for n + 1. By the induction principle, A is then equal to N, that is, P
holds for every natural number.

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

n n1
2

Solution:
That is to prove that 1 + 2 + 3 + . + n
(i)

n n 1
2

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

Sikkim Manipal University

Page No.: 50

Fundamentals of Theory of Computer Science

Unit 3

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


For n1, left side = 1, right side

11 1
1 . Hence the result is
2

true for n1
(ii)

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


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

(iii)

m 1
2

Induction Step: We now show that the above result is true for nm1.
Adding the m1 th term viz., m1 to both sides we obtain.
1 + 2 + 3 + ... + m m 1
m

m 1
1
2

m 1

m m 1
2

m 1

m 1 m 2
2

m 1 1 ,
2

which is the same as the given result for nm1


Hence by mathematical induction, the result is true for all positive integral
values of n.
3.2.3 Example
Prove by mathematical induction that
1

.... n

n n 1 2 n 1
6

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 n 1 , left side 12 1.

Sikkim Manipal University

Page No.: 51

Fundamentals of Theory of Computer Science

Right side

Unit 3

11 1 2 . 1 1
1. 2 . 3

1.
6
6

Hence the result is true for n 1 .


(ii)

Induction Hypothesis: Assume that the result to be true for nm


Then 12 2 2 3 2 ... m 2

m m 1 2 m 1
.
6

Adding the m 1 th term i.e. m 1 2 to both sides of the above


equation, we get,
12 2 2 ... m 2 m 12

m 1
m 2 m 1 6 m 1

m m 1 2 m 1
m 1 2
6

m 1
6

2 m

7m 6

m 1 m 2 2 m 3
6

m 1

m 1 1 2 m 1 1
6

Therefore the result is true for nm1 . Hence by mathematical induction the
given result is true for all positive integers n.
3.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:
Sikkim Manipal University

Page No.: 52

Fundamentals of Theory of Computer Science

Unit 3

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
This division, in fact partitions 2A into two
disjoint equinumerous parts, so the cardinality of the whole is twice 2 B,
which, by the induction hypothesis, is 2 2n = 2

n+1

. This completes the

proof.
3.2.5 Example
(Refer unit 4 for definition of binary tree) A binary tree is a tree in which no
parent can have more than two children. 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
Sikkim Manipal University

Page No.: 53

Fundamentals of Theory of Computer Science

Unit 3

Therefore our claim is true for n + 1. Since n is


arbitrary, we can conclude that the statement is true for all n.
3.2.6 Example
(Refer unit 4 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.
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.
|E(T1)| = |V(T1)| - 1 and |E(T2)| = |V(T2)| - 1.

3.2.12 Problem
Prove by mathematical induction that 2n n for all positive integer n.

Sikkim Manipal University

Page No.: 54

Fundamentals of Theory of Computer Science

Unit 3

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.
3.2.13 Example
Show by induction that n n 1 2 n 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.
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
6k 6 m 1
Sikkim Manipal University

Page No.: 55

Fundamentals of Theory of Computer Science

Unit 3

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
3.2.7 The Pigeonhole Principle
If A and B are finite sets and

, 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.
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.
Sikkim Manipal University

Page No.: 56

Fundamentals of Theory of Computer Science

Unit 3

3.2.8 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.
3.2.9 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 R a = {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:

The sequence of boxes along the diagonal is


x

Sikkim Manipal University

Page No.: 57

Fundamentals of Theory of Computer Science

Unit 3

Its complement is
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 n1

(ii)

Assuming the theorem to be true for nm , 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
n1 and from (ii) it is true for n112 ; since it is true for n2 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 .
3.2.10 Proof by Contradiction
Proof by contradiction is sometimes a 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.


3.2.11 Example
Prove by contradiction, that

is not a rational number.

Solution: A rational number is of the form p/q where

, and p, q are not

having any common factors.


Assume that

is a rational number. So it can be written as

Sikkim Manipal University

Page No.: 58

Fundamentals of Theory of Computer Science

Unit 3

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


q is even.
This is a contradiction to our assumption that p and q have no common
factors. Therefore

is not a rational number.

3.2.12 Example
Give a proof by contradiction of if 3n + 2 is odd, then n is odd.
Solution: Let p: 3n+2 is odd
q: n is odd.
To construct a proof by contradiction, assume that both p and q are true.
That is, assume that 3n + 2 is odd and that n is not odd.
Since n is not odd, it is even.
Now we can show that if n is even, then 3n + 2 is even.
(Verification: n is even

n = 2k for some integer k. Substituting 2k for n,

we get 3n + 2 = 3(2k) + 2 = 6k + 2 = 2(3k + 1)

3n + 2 is even).

Now the statement 3n + 2 is even is p. Now since p and p are true, we


have a contradiction. This completes the proof by contradiction, proving that
if 3n + 2 is odd, then n is odd.
3.2.13 Exhaustive Proof and Proof by Cases
Some theorems can be proved by examining a relatively small number of
examples. Such proofs are called exhaustive proofs, since these proofs
proceed by exhausting all possibilities. An exhaustive proof is a special type
of proof by cases where each case involves checking a single example.

Sikkim Manipal University

Page No.: 59

Fundamentals of Theory of Computer Science

Unit 3

3.2.14 Example
Prove that (n + 1)3

3n if n is a positive integer with n 4.

Solution: We use a proof by exhaustion. We only need verify the inequality


(n + 1)3

3n when n = 1, 2, 3, 4.

For n = 1, we have (n + 1)3 = 23 = 8 and 3n = 31 = 3;


for n = 2, we have (n + 1)3 = 33 = 27 and 3n = 32 = 9;
for n = 3, we have (n + 1)3 = 43 = 64 and 3n = 33 = 27; and
for n = 4, we have (n + 1)3 = 53 = 125 and 3n = 34 = 81;
Therefore, (n + 1)3

3n for all positive integers n 4.

3.2.15 Example
(Proof by Cases) Prove that if n is an integer, then

Self Assessment Questions


1. Prove by mathematical induction that

13 2 3 3 3 ... n 3
2. Prove that

n2

n 1 2
4

is not a rational number (by the method of contradiction).

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

Sikkim Manipal University

Page No.: 60

Fundamentals of Theory of Computer Science

Unit 3

3.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.

3.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 the same
color.
Induction Hypothesis: In any group of upto 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.
(Hint: The induction proof fails for n=2).

3.5 Answers
Self Assessment Questions
1. (i) For n1 , left side 13 1
right side

12 1 12
1. 4

1
4
4

Hence it is true for n 1 .


(ii) Assume the result to be true for n m
Sikkim Manipal University

Page No.: 61

Fundamentals of Theory of Computer Science

Unit 3

m 2 m 1 2
(induction
4

Then 13 2 3 3 3 ... m 3
hypothesis)

Adding the m 1 th term viz., m 13 to both sides,


1

... m

m 1

m2

m 1 2
4

m 1 2
4

m 1 3
4m 4

m 1 2 m 2 2
4

m 1 2 m 1 1 2
4

Therefore the result is true for nm1. Hence by mathematical induction


the given result is established for all positive integers.
2. Proof by Contradiction method .
3. Take two odd integers m and n. Then there exist two integers r and t so
that m = 2r + 1 and n = 2t + 1.

Sikkim Manipal University

Page No.: 62