Disc Week 10
Disc Week 10
Recursion
Recursion
First of all, instead of giving the definition of Recursion, we give you an example.
You already know the Set of Odd numbers. Here we give the new definition of
the same set that is the set of Odd numbers.
•Definition for odd positive integers may be given as:
•BASE:
•1 is an odd positive integer.
•RECURSION:
•If k is an odd positive integer, then k + 2 is an odd positive integer.
•Now, 1 is an odd positive integer by the definition base.
•With k = 1, 1 + 2 = 3, so 3 is an odd positive integer.
•With k = 3, 3 + 2 = 5, so 5 is an odd positive integer
•and so, 7, 9, 11, … are odd positive integers.
• Find the first four terms of the following recursively defined sequence.
• b1 = 2
• bk = bk-1 + 2 · k, for all integers k ≥ 2
• SOLUTION:
• b1 = 2 (given in base step)
• b2 = b1 + 2 · 2 = 2 + 4 = 6
• b3 = b2 + 2 · 3 = 6 + 6 = 12
• b4 = b3 + 2 · 4 = 12 + 8 = 20
Example
• Find the first five terms of the following recursively defined
sequence.
• t = – 1, t = 1
0 1
SOLUTION:
• t = – 1, (given in base step)
0
• t = t + 2 · t = 1 + 2 · (–1) = 1 – 2 = –1
2 1 0
• t = t + 2 · t = –1 + 2 · 1 = –1 + 2 = 1
3 2 1
• t = t3 + 2 · t = 1 + 2 · (–1) = 1 – 2 = –1
4 2
EXERCISE