Recursion

The basic concepts and ideas involved with recursion are simple: a function that has to solve a big problem uses itself to solve a slightly smaller problem. Understanding the basic idea is fairly straightforward. However, to truly understand the intricacies of recursion, and to be able to use it well in one's own programs, requires a lot of practice. The best way to obtain this practice is to write a lot of recursive functions. In this section we'll do just that.

Examples: Write the first four terms of the sequence: In recursive formulas, each term is used to produce the next term. Follow the movement of the terms through the set up at the left.

Answer: -4, 1, 6, 11

2. Consider the sequence 2, 4, 6, 8, 10, ...Explicit formula:
Recursive formula:

Certain sequences, such as this arithmetic sequence, can be represented in more than one manner. This sequence can be represented as either an explicit (general) formula or a recursive formula.

3. Consider the sequence 3, 9, 27, 81, ...Explicit formula:
Recursive formula:

Certain sequences, such as this geometric sequence, can be represented in more than one manner. This sequence can be represented as either an explicit formula or a recursive formula.

4. Consider the sequence 2, 5, 26, 677, ...Recursive formula:

This sequence is neither arithmetic nor geometric. It does, however, have a pattern of development based upon each previous term.

5. Write the first 5 terms of the sequence

Notice how the value of n is used as the exponent for the value (-1). Also, remember that in recursive formulas, each term is used to produce the next term. Follow the movement of the terms through the set up at the left.

Answer: 3, 15, -75, -375, 1875

Comment Stream