Recursive Function — Definition, Formula & Examples
A recursive function is a function that defines its output for a given input by referring back to its own output at one or more previous inputs. It always requires at least one starting value, called an initial condition or base case, to get the sequence going.
A recursive function on the natural numbers is defined by specifying (1) one or more initial values and (2) a recurrence relation that expresses in terms of for all beyond the initial values.
Key Formula
Where:
- = The value of the function at position n
- = Previously computed values the current term depends on
How It Works
To evaluate a recursive function, you start from the given base case(s) and apply the recurrence relation step by step. Each new term depends on terms you have already computed, so you build the sequence forward one term at a time. For example, if and , you find from , then from , and so on. You cannot skip ahead to without first computing through (unless you convert the recursive rule into an explicit formula).
Worked Example
Problem: The Fibonacci sequence is defined by , , and for . Find .
Base cases: Write down the initial values.
Compute forward: Apply the recurrence relation for each successive term.
Find F₆: Use the two most recent terms.
Answer:
Why It Matters
Recursive functions appear throughout discrete math, computer science, and financial modeling. Algorithms like merge sort and binary search are defined recursively. In precalculus and AP courses, you will often need to convert between recursive and explicit formulas for arithmetic and geometric sequences.
Common Mistakes
Mistake: Forgetting to state or use the base case, then trying to apply the recurrence relation indefinitely.
Correction: A recursive definition is incomplete without its initial condition(s). Always identify the base case first; without it, the function has no starting point and no term can be computed.
