Induction and Recursion
Induction
The well-ordering property
Link copiedThe following fundamental fact about the set of integers is useful for proofs. It leads to the idea of proof by induction.
Theorem 3.1 (The Well-Ordering Property) Every nonempty set of nonnegative integers has a least element.
Mathematical induction
Link copiedMany theorems are that a statement is true for all positive integers (here, is a predicate or propositional function). Mathematical induction is a technique for proving theorems of this kind. In other words, mathematical induction is used to prove propositions of the form , where the universe of discourse is the set of non-negative integers, or sometimes the set .
A proof by mathematical induction that is true for every positive integer consists of two steps:
Basis step The proposition (or sometimes ) is shown to be true.
Inductive step The implication
is shown to be true for every non-negative integer .
The inductive hypothesis
Link copiedHere is called the inductive hypothesis. When we complete both steps of a proof by mathematical induction, we have proved that is true for all positive integers ; that is, we have shown that is true.
Expressed as a rule of inference, this proof technique can be stated as
How to write a proof by induction
Link copiedThe first step in the proof is to show that is true. This amounts to showing that the particular statement obtained when is replaced by is true.
The next step is to show that is true for every positive integer . This can be done by assuming that is true and showing that under this hypothesis must also be true.
The final step of the proof is to invoke the “principle of mathematical induction” which implies the theorem is true.
Let be the statement ”…”.
is true because …
Assume for some , is true:
Here is an argument that must be true, assuming that is true. …
Thus, by the principle of mathematical induction,
is true for every integer .
Although we are taking in this discussion it is sometimes convenient to start with , or , etc.
Important remark
Link copiedIn a proof by mathematical induction it is not assumed that is true for all positive integers! It is only shown that if is true, then is also true, that is, . Thus, a proof by mathematical induction is not a circular argument.
When we use mathematical induction to prove a theorem, we first show that is true. Then we know that is true, since implies . Further, we know that is true, since implies . Continuing along these lines, we see that is true, for any positive integer .
The domino illustration
Link copiedA way to illustrate the principle of mathematical induction is to consider an infinite row of dominoes, labelled , where each domino is standing up. Let be the proposition that domino is knocked over. If is true (meaning: the first domino is knocked over), and if is true (meaning: if the domino is knocked over then it also knocks over the -th domino), then all the dominoes are knocked over.
Why mathematical induction is valid
Link copiedThe validity of mathematical induction as a proof technique comes from the well-ordering property of the natural numbers.
Suppose we know that is true and that the proposition is true for all positive integers To show that must be true for all positive integers, assume that there is at least one positive integer for which is false.
- Then the set of non-negative integers for which is false is nonempty.
- Thus, by the well-ordering property, has a least element, which will be denoted by . We know that cannot be 0 since is true.
- Since is positive and greater than 1, is a positive integer.
- Furthermore, since is less than , it is not in , so must be true.
- Since the implication P is also true, it must be the case that is true. This contradicts the choice of .
- Hence, must be true for every positive integer .
We will use a variety of examples to illustrate how theorems are proved using mathematical induction. (Many theorems proved in this section via mathematical induction can be proved using different methods. However, it is worthwhile to try to prove a theorem in more than one way, since one method of attack may succeed whereas another approach may not.)
Summation example
Link copiedMathematical induction is often used to verify summation formulae.
Solution.
Let denote the proposition that the sum of the first odd positive integers is .
Basis step: is the claim that the sum of the first zero odd positive integers is . This is true.
Some students may be more comfortable starting with in this case. states that the sum of the first odd positive integer is . This is true since the sum of the first odd positive integer is .
Inductive step: Show that is true . Suppose that is true for a positive integer ; that is
(Note that the odd positive integer is , since this integer is obtained by adding a total number of times to ). We must show that is true, assuming that is true. Note that is the statement that
So, assuming that is true, it follows that */}
This shows that follows from . Note that we used the inductive hypothesis in the second equality to replace the sum of the first odd positive integers by . Since is true and the implication is true , the principle of mathematical induction shows that is true for all positive integers .
for all nonnegative integers .
Inequality example
Link copiedThe next example uses the principle of mathematical induction to prove an inequality.
for all positive integers .
Divisibility examples
Link copied[Hint: .]
Number of subsets example
Link copiedFactorial example
Link copiedGeometric examples
Link copiedBasis at other than 0 or 1
Link copiedSometimes we need to show that is true for , where is an integer other than 0 or 1. We can use mathematical induction to accomplish this as long as we change the basis step.
The second principle of mathematical induction
There is another form of mathematical induction that is often useful in proofs. With this form we use the same basis step as before, but we use a different inductive step. We assume that is true for all values and show that must also be true based on this assumption. This is called the second principle of mathematical induction. We summarize the two steps used to show that is true for all positive integers
Basis step: The proposition is shown to be true.
Inductive step: It is shown that
is true for every positive integer .
The two forms of mathematical induction are equivalent; that is, each can be shown to be a valid proof technique assuming the other. We leave it as an exercise for the student to show this.
Solution.
Let denote the proposition that can be written as a product of primes.
Basis step: is true since it can be written as the product of one prime, itself.
Inductive step: Assume that is true for all positive integers with . To complete the inductive step it must be shown that is true under this assumption. There are two cases to consider, namely, when is prime and when is composite. If is prime then we can immediately see that is true. Otherwise is composite and thus can be written as a product of two positive integers and with . By the induction hypothesis, both and can be written as the product of primes. Thus, if is composite, then it can be written as the product of primes, namely, those primes in the factorizations of and .
Loop invariant theorem
Consider a segment of computer program of the form
While do
The condition is called the guard and is called the body. An iteration of the loop is one execution of . The loop terminates when the guard condition becomes false.
A statement is a loop invariant if, whenever is true before an iteration, remains true after the iteration.
Input:
-
Set and
-
While ( ) do
Let be the statement . Then is true at the beginning of the loop and stays true through the body of the loop.
Theorem 3.2 (Loop invariant theorem) Let be an invariant of the loop “while do “. Suppose is true on the first entry into the loop. Then stays true at every iteration of the loop, and if the loop terminates then is true after the last iteration.
Recursive definitions
Sometimes it is difficult to define an object explicitly. However, it may be easy to define this object in terms of itself. This process is called recursion_.
We can use recursion to define sequences, functions, and sets. In previous discussions, we specified the terms of a sequence using an explicit formula.
Recursively defined functions
Link copiedTo define a function with the set of nonnegative integers as its domain,
-
Specify the value of the function at zero (and possibly 1, 2, … ).
-
Give a rule for finding its value at an integer from its values at smaller integers.
Such a definition is called a recursive or iterative or inductive definition.
Find , and .
Specifying the first few values of a function
Link copiedIn some recursive definitions of functions, the values of the function at the first positive integers are specified, and a rule is given for the determining the value of the function at larger integers from its values at some or all of the preceding integers.
for . What are the Fibonacci numbers ?
Show that , where \ , whenever .
(Hint: first show that )
Recurrence relations
Consider the following type of counting problem:
Recurrence relations introduction
Link copiedIn the previous section we discussed how sequences can be defined recursively. Recursive definitions can be used to solve counting problems. When they are, the rule for finding terms from those that precede them is called a recurrence relation.
Definition 3.1 A recurrence relation for the sequence is a formula that expresses in terms of one or more of the previous terms of the sequence, namely, , for all integers with where is a nonnegative integer.
A sequence is called a solution of a recurrence relation if its terms satisfy the recurrence relation.
Initial conditions
Link copiedThe initial conditions for a sequence specify the terms that precede the first term where the recurrence relation takes effect.
The recurrence relation and initial conditions uniquely determine a sequence. This is the case since a recurrence relation, together with initial conditions, provide a recursive definition of the sequence. Any term of the sequence can be found from the initial conditions using the recurrence relation a sufficient number of times. However, there are better ways for computing the terms of certain classes of sequences defined by recurrence relations and initial conditions.
We can use recurrence relations to model a wide variety of problems, such as finding compound interest, counting rabbits an island, determining the number of moves in the tower of Hanoi puzzle, and counting bit strings with certain properties.
Compound interest
Link copiedRabbits and the Fibonacci numbers
Link copiedThe next example shows how the population of rabbits on an island can be modelled using a recurrence relation.
The towers of Hanoi
Link copiedThe next example involves a famous puzzle.
Initially these discs are placed on the first peg in order of size, with the largest on the bottom. The rules of the puzzle allow discs to be moved one at a time from one peg to another as long as a disc is never placed on top of a smaller disc.
The goal of the puzzle is to have all the discs on the second peg in order of size, with the largest on the bottom.
Let denote the number of moves needed to solve the Towers of Hanoi problem with discs. Set up a recurrence relation for the sequence .
Non-consecutive ‘s
Codewords
Link copiedThe next example shows how a recurrence relation can be used to model the number of codewords that are allowable using certain validity checks.
Let be the number of valid -digit codewords. Find a recurrence relation for .
Solving recurrence relations
A wide variety of recurrence relations occur in models. Some of these recurrence relations can be solved using iteration or some other ad hoc technique. However, one important class of recurrence relations can be explicitly solved in a systematic way. These are recurrence relations that express the terms of a sequence as linear combinations of previous terms.
Linear homogeneous recurrence relations
Link copiedDefinition 3.2 A linear homogeneous recurrence relation of degree with constant coefficients is a recurrence relation of the form
where are real numbers, and
The recurrence relation in the definition is linear since the right-hand side is a sum of constant multiples of the previous terms of the sequence. The recurrence relation is homogeneous since no terms occur that are not multiples of the ‘s. The coefficients of the terms of the sequence are all constants, rather than functions that depend on . The degree is because is expressed in terms of the previous terms of the sequence.
A consequence of the second principle of mathematical induction is that a sequence satisfying the recurrence relation in the definition is uniquely determined by this recurrence relation and the initial conditions
Linear homogeneous recurrence relations are studied for two reasons. First, they often occur in modelling of problems. Second, they can be systematically solved.
Solving linear homogeneous recurrence relations
The basic approach for solving linear homogeneous recurrence relations is to look for solutions of the form , where is a constant. Note that is a solution of the recurrence relation
if and only if
Characteristic equation
Link copiedWhen both sides of this equation are divided by and the right-hand side is subtracted from the left, we obtain the equivalent equation
Consequently, the sequence with is a solution if and only if is a solution of this last equation, which is called the characteristic equation of the recurrence relation. The solutions of this equation are called the characteristic roots of the recurrence relation. As we will see, these characteristic roots can be used to give an explicit formula for all the solutions of the recurrence relation.
Linear homogeneous recurrence relations of degree two: distinct roots
Link copiedWe now turn our attention to linear homogeneous recurrence relations of degree two. First, consider the case when there are two distinct characteristic roots.
Theorem 3.3 Let and be real numbers. Suppose that has two distinct roots and ” . Then the sequence is a solution of the recurrence relation
if and only if for , where and are constants.
Proof: See lecture
The actual procedure for solving the recurrence relation
with initial values and is the following (provided that the roots of the characteristic equation are distinct.):
Step 1 : Identify the characteristic polynomial and find its roots and
Step 2 : If then the general solution is of the form
where and are constants.
Step 3 : Determine the values of and by using the initial conditions and .
with initial values and .
Solution
Step 1 Determine the characteristic equation by substituting and factoring out __
Take and .
Step 2 The general solution is
Step 3 Using the initial values and we obtain
and this gives us . Thus is the unique solution to the given recurrence relation.
with and ?
Linear homogeneous recurrence relations of degree two: one root of multiplicity two
Link copiedTheorem 4.2 does not apply when there is one characteristic root of multiplicity two. This case can be handled using the following theorem.
Theorem 3.4 Let and be real numbers with . Suppose that has only one root . A sequence is a solution of the recurrence relation if and only if , for , where and are constants.
The actual procedure for solving the recurrence relation
with initial values and is the following (provided that the roots of the characteristic equation are not distinct):
Step 1 : Identify the characteristic polynomial and find its roots and
Step 2 : If then the general solution is of the form
where and are constants.
Step 3 : Determine the values of and by using the initial conditions and .
with initial values and .
with initial conditions and ?