Chapter5 - Induction and Recursion
Chapter5 - Induction and Recursion
3/27
Principle of Mathematical Induction
To prove that P(n) is true for all positive integers n, where P(n) is
a propositional function, we complete two steps:
Basic step: Verify P(1) is true
Inductive step: Show that if P(k) is true, then P(k + 1) is
true for all positive integers k.
n(n + 1)
1 + 2 + ... + n = .
2
Example 2. Conjecture a formula for the sum of the first n
positive odd integers. Then prove your conjecture using
mathematical induction.
2n < n!
6/27
Example 5. Show that if n is an integer greater than 1, then n
can be written as the product of primes.
Polygon
A polygon is a closed geometric figure consisting of a
sequence of line segments s1 , s2 , . . . , sn , called sides.
Each pair of consecutive sides of the polygon meet at a
common endpoint, called a vertex.
A polygon is called simple if no two nonconsecutive sides
intersect.
Every simple polygon divides the plane into two regions: its
interior, consisting of the points inside the curve, and its
exterior, consisting of the points outside the curve.
Diagonal
A diagonal of a simple polygon is a line segment connecting
two nonconsecutive vertices of the polygon.
A diagonal is called an interior diagonal if it lies entirely inside
the polygon, except for its endpoints.
Theorem 1
A simple polygon with n sides, where n is an integer with n ≥ 3,
can be triangulated into n − 2 triangles.
Lemma 1
Every simple polygon with at least four sides has an interior
diagonal.
5.1 Mathematical Induction
5.2 Strong Induction and Well-Ordering
5.3 Recursive Definitions and Structural Induction
5.4 Recursive Algorithms
12/27
Example 7. Suppose that f is defined recursively by
f (0) = 3,
f (n + 1) = 2f (n) + 3.
Find f (4).
f (1) = 1,
f (n) = 3f (n/2) + 1.
Find f (16).
Fibonacci numbers
f (0) = 0, f (1) = 1
f (n) = f (n − 1) + f (n − 2), n = 2, 3, . . .
Lamé’s Theorem
Let a and b be positive integers with a ≥ b. Then the number of
divisions used by the Euclidean algorithm to find gcd(a, b) is less
than or equal to five times the number of decimal digits in b.
Recursive Definitions of Sets
Basic step: Specify an initial collection of elements.
Recursive step: Give a rule for forming new elements in the
set from those already known to be in the set.
Example 10. If Σ = {0, 1}, then Σ∗ is the set of all bit strings.
The Concatenation of Two Strings
Basic step: If w ∈ Σ∗ , then w · λ = w , where λ is the empty
string.
Recursive step: If w1 , w2 ∈ Σ∗ and x ∈ Σ, then
w1 · (w2 x) = (w1 · w2 )x ∈ Σ∗ .
5.1 Mathematical Induction
5.2 Strong Induction and Well-Ordering
5.3 Recursive Definitions and Structural Induction
5.4 Recursive Algorithms
18/27
Example 12. Recursive algorithm for computing an