Recursive Functions: Definition & Examples

Instructor: Yuanxin (Amy) Yang Alcocer

Amy has a master's degree in secondary education and has taught math at a public charter high school.

After reading this lesson, you'll know how to identify recursive functions and how they work. You'll learn how to figure out the terms of these recursive functions, and you'll learn about a famous recursive function.

Definition

A recursive function is a function that calls itself, meaning it uses its own previous terms in calculating subsequent terms. This is the technical definition. Now, let's look at what this means in a real-world math problem.

This is a real-world math recursive function. This is actually a really famous recursive sequence that can be seen in nature.

What Makes It Recursive

What makes this function a recursive one is that it requires its own terms to figure out its next term. For the function we are looking at right now, to find the nth term, you need to know the previous term and the term before that one. So, you need to know the previous two terms for this special sequence.

This is how you can determine whether a particular function is recursive or not. If the function requires a previous term in the same sequence, then it is recursive.

Note how this function specifically states the beginning two values. Most recursive functions will give you the beginning value or values that are needed to fully calculate the sequence. Without these beginning values, there is no way to determine what the real values for each term should be.

Expanding It

Now, let's look at how you work with this recursive formula.

Recursive functions are usually sequences. It gives you the formula to find the next term, if you know the previous terms. So, to calculate your terms from a recursive formula, you begin by writing out your beginning numbers. So with the beginning recursive formula that you saw, the first two terms in the sequence are 1 and 1. Now, to find the third number in the sequence, when n is 3, you calculate your function for (a sub 3).

This function is telling you that the third term in the sequence is equal to the second term plus the first term. So, the third term is equal to 1 + 1 = 2.

The fourth term, according to the function, is this:

You begin to see the pattern here. Each term is the sum of the previous two terms.

n Value
1 1
2 1
3 1 + 1 = 2
4 2 + 1 = 3
5 3 + 2 = 5
6 5 + 3 = 8

And there you have the beginning of this famous recursive function: 1, 1, 2, 3, 5, 8.

To unlock this lesson you must be a Study.com Member.

Register to view this lesson

Are you a student or a teacher?

See for yourself why 30 million people use Study.com

Become a Study.com member and start learning now.
Back
What teachers are saying about Study.com

Earning College Credit

Did you know… We have over 160 college courses that prepare you to earn credit by exam that is accepted by over 1,500 colleges and universities. You can test out of the first two years of college and save thousands off your degree. Anyone can earn credit-by-exam regardless of age or education level.