Vous êtes sur la page 1sur 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.
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 e A, and
ii) for each natural number n, if {0, 1,... , n} _ A, then n + 1 e A.
Then A = N.
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 e 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
1 n n +

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

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 1 = n , left side = 1, right side
( )
1
2
1 1 1
=
+
= . Hence the result is
true for 1 n =


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
1 m m
m
+
=
iii) Induction Step: We now show that the above result is true for
1 m n + = . Adding the ( )
th
1 m + term viz., 1 m + to both sides we
obtain.
1 + 2 + 3 + ... + ( )
( )
( ) 1 m
2
1 m m
1 m m + +
+
= + +
( )
( ) ( )
2
2 m 1 m
1
2
m
1 m
+ +
=
(

+ + =

( ) ( )
2
1 1 m 1 m + + +
= ,
which is the same as the given result for 1 m n + =
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
1 n 2 1 n n
n .... 3 2 1
2 2 2 2
+ +
= + + + +
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 1 = n , left side 1 1
2
= = .
Right side
( )( )
1
6
3 . 2 . 1
6
1 1 . 2 1 1 1
= =
+ +
= .
Hence the result is true for n = 1.
ii) Induction Hypothesis: Assume that the result to be true for n = m
Then
( ) ( )
6
1 m 2 1 m m
m ... 3 2 1
2 2 2 2
+ +
= + + + + .
Theory of Computer Science Unit 2
Sikkim Manipal University Page No.: 37
Adding the ( )
th
1 m + term i.e. ( )
2
1 m + to both sides of the above
equation, we get,
( )
( ) ( )
( )
2 2 2 2 2
1 m
6
1 m 2 1 m m
1 m m ... 2 1 + +
+ +
= + + + + +

( )
( ) ( ) { } 1 m 6 1 m 2 m
6
1 m
+ + +
+
=

( )
( ) 6 m 7 m 2
6
1 m
2
+ +
+
=

( )( ) ( )
6
3 m 2 2 m 1 m + + +
=

( ) ( ) ( ) ( )
6
1 1 m 2 1 1 m 1 m + + + + +
=
Therefore, the result is true for 1 m n + = . 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 2
A
=
2
0
= 1; on the other hand, 2
A
= {|}, and 2
A
= {|} = 1.
ii) Induction Hypothesis: Let n > 0, and suppose that 2
A
= 2
A

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, 2
B
= 2
B
= 2
n
.
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 2
B
, and
the former part is obtained by introducing a into each member of 2
B
. Thus
Theory of Computer Science Unit 2
Sikkim Manipal University Page No.: 38
2
A
=2
B
{C {a}: C e 2
B
}.
This division in fact partitions 2
A
into two disjoint equinumerous parts, so the
cardinality of the whole is twice 2
B
, which, by the induction hypothesis, is
2 2
n
= 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 2
n
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) 2
n
.
Basic Step: Clearly l(0) = 1 = 2
0
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) 2
i
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 2
n
= 2
n+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.
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 e
k
be any
edge in T whose end vertices are v
i
and v
j
. Since T is a tree, by Theorem
6.5, there is no other path between v
i
and v
j.
So by removing

e
k
from T, we
get a disconnected graph. Furthermore, T- e
k
consists of exactly two
components (say T
1
and T
2
). Since T is a tree, there were no circuits in T
and so there were no circuits in T
1
and T
2.
Therefore T
1
and T
2
are also trees.
It is clear that |V(T
1
)| + |V(T
2
)| = |V(T)| where V(T) denotes the set of vertices
in T.

Also |V(T
1
)| and |V(T
2
)| are less than n.
Therefore by the induction hypothesis, we have
|E(T
1
)| = |V(T
1
)| - 1 and |E(T
2
)| = |V(T
2
)| - 1.
Now |E(T)| - 1 = |E(T
1
)| + |E(T
2
)| = |V(T
1
)| - 1 + |V(T
2
)| - 1
|E(T)| = |V(T
1
)| + |V(T
2
)| - 1 = |V(T)| - 1 = n-1.
2.2.7 Problem
Prove by mathematical induction that
n
2 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 2
m
> m
Now 2
m+1
= 2. 2
m
> 2m.. We know that 2m m m m 1 = + > + for all m N e .
Therefore 2
m+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.
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 e 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.
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 e A (since A > B = n + 1 > 1, A is nonempty, and therefore such a
choice is possible). If there is another element a = a
1
e A, such that f(a) =
f(a
1
), 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 aeA and (a, a) e R}. For each
a e A, let R
a
= {b: b e A and (a, b) e R}. Then D is distinct from each R
a
.
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) e 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 R
a
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 R
a
= {b, d}, R
b
= {b, c}, R
c
= {c}, R
d
= {b, c, e, f}, R
e
= {a, e}, and
R
f
= {c, d, e}. All in all, R may be pictured like this:

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.
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.
p
2
= 2q
2
.
p
2
is even p is even.
If p is even, then it can be written as p = 2k. Therefore, 4k
2
= 2q
2
. 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
1 n n
n ... 3 2 1
2 2
3 3 3 3
+
= + + + + .
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.




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 1 = n , left side 1 1
3
= =
right side
( )
1
4
4 . 1
4
1 1 1
2 2
= =
+
=
Hence it is true for 1 n =

Theory of Computer Science Unit 2
Sikkim Manipal University Page No.: 45
ii) Assume the result to be true for m n =
Then
( )
4
1 m m
m ... 3 2 1
2 2
3 3 3 3
+
= + + + + (induction
hypothesis)
Adding the ( )
th
1 m + term viz., ( )
3
1 m + to both sides,
( )
( )
( )
3
2 2
3 3 3 3
1 m
4
1 m m
1 m m ... 2 1 + +
+
= + + + + +

( )
( ) 4 m 4 m
4
1 m
2
2
+ +
+
=

( ) ( )
4
2 m 1 m
2 2
+ +
=

( ) ( )
4
1 1 m 1 m
2 2
+ + +
=
Therefore the result is true for 1 m n + = . 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.

Vous aimerez peut-être aussi