Professional Documents
Culture Documents
Bab 4 Induction and Recursion
Bab 4 Induction and Recursion
INFORMATION SHEET
CODE AND
J12 DIPLOMA IN COMPUTER ENGINEERING TECHNOLOGY
PROGRAM
NAME
CODE AND
DKB3204 DISCRETE MATHEMATICS
COURSE NAME
Mathematical Induction can be used to prove the statement that P (n) is true for all
positive integers n, where P(n) is a propositional function.
1 2 .... k k 1
k 1k 1 1
2
k 1k 2
2
Under the assumption of P(k), we add (k+1) to both side
k k 1
1 2 .... k k 1 k 1
2
k k 1 2k 1
2
k 1k 2
2
By Mathematical Induction, we know that P(n) is true for all positive integers n. So, we
nn 1
had shown that 1 2 .... n for all positive integers n.
2
2
Example 2 : Show that if n is a positive integer, then
nn 12n 1
12 2 2 .... n 2
6
Solution:
Let P (n) be the proposition that the sum of the first n2 positive integer is
nn 12n 1
6
12 2 2 .... k 2 k 1
2 k 1k 1 1 2k 1 1
6
k 1k 22k 3
6
2
Under the assumption of P (k), add (k+1) to both side
k k 12k 1
12 2 2 .... k 2 k 1 k 1
2 2
6
k k 12k 1 6k 1
2
6
k 1 k 2k 1 6k 1
6
k 1 2k k 6k 6
2
6
k 1k 22k 3
6
By Mathematical Induction, we know that P(n) is true for all positive integers n.
nn 12n 1
So, we had shown that 12 2 2 .... n 2 for all positive integers n.
6
3
Example 3 : Prove n < 2n for all positive integers n.
Solution :
Assume P(n) : n < 2n
Basis Step: P(1) is true, because 1 < 21 = 2 (obvious)
Inductive Step: Show that P(k ) Pk 1
a) Inductive Hypothesis: Assume that P(k) is true,
k < 2k is true
k+1<2k+1
< 2 k+ 2 k Note that;
= 2 1 1
k 1 2k
= 2 2k
= 2 k+1
By Mathematical Induction, we know that P(n) is true for all positive integers n.
So, we had shown that n < 2n is true for all positive integers n.
4
4.2 Understand Recursion
4.2.1 Describe the recursive definition.
f 0 3
f n 1 2 f n 3
Solution:
From the recursive definition it follows that;
f 1 2 f 0 3 2 3 3 9
f 2 2 f 1 3 2 9 3 21
f 3 2 f 2 3 2 21 3 45
f 4 2 f 3 3 2 45 3 93
f 0 1
f n 1 f n f n 1
2
Solution:
From the recursive definition it follows that;
f 1 f 0 f 0 1 1 1 1 3
2
5
Example 3:
The function f(n) = n! for natural numbers n can be defined recursively as follows:
Basis : f(0) = 0! = 1
Recursive : For all natural number n, f(n+1) = (n+1) f(n).
Since 0! = 1, 1 ! = 1 * 0 ! = 1 * 1 = 1 ,
Hence 2! = 2 * 1 ! = 2 * 1 = 2 .
Hence 3! = 3 * 2 ! = 3 * 2 * 1 = 6 .
Example 4
Determine the recursive definition of the sequence a n ,n = 1, 2, 3.. if
a) a n 4n 2
b) a n 10 n
Solution:
b) a n 10 n
a) a n 4n 2 a n 1 10 n 1
10 n 101
a n 1 4n 1 2
4n 4 2 We know that , a n 10 n
4n 2
a n 1 10 n 101
From an = 4n – 2
10a n
4n = an + 2
Thus,
Therefore a n 1 10a n for n 1 and a1 10
a n 1 a n 2 2
an 4
Therefore, a n 1 a n 4 for n 1