Recursive Function in Maths

Last Updated : 22 Aug, 2025

Mathematics often deals with patterns and sequences. One powerful way to define such sequences is through recursive functions. A recursive function is a function that refers to itself in its definition. This concept is widely used in sequences, series, and even in computer algorithms.

It usually has two main components:

  • Base Case: The simplest instance of the problem, which has a direct answer.
  • Recursive Case: Defines the function in terms of itself for smaller inputs.

Mathematically, a general recursive function can be expressed as:

h(x) = a0h(0) + a1h(1) + a2h(2) + ... + ax - 1h(x - 1)

where,

  • ai ≥ 0
  • i = 0, 1, 2, 3, ... ,(x - 1)

The recursion formulas are the formulas that are used to write the recursive functions or recursive series.

Recursive Formula

The recursion formula is the formula used to write recursive functions or recursive series. It provides a way to generate the sequence step by step using previous terms.

  • Base case: Gives the first term(s) of the sequence.
  • Recursive formula: Expresses the xxx-th term using one or more previous terms.

Recursive Formulas For Various Sequences

Recursive Sequences are sequences in which the next term of the sequence is dependent on the previous term. One of the most important recursive sequences is the Fibonacci Sequence:

The recursive formulas or the recursion formulas for different kinds of sequences are,

Sequence TypeRecursive FormulaDescription
Arithmetic Sequencean = a(n-1) + d for n ≥ 2Each term is obtained by adding a constant d to the previous term.
Geometric Sequencean = an-1 ·r for n ≥ 2Each term is obtained by multiplying the previous term by a constant ratio r.
Fibonacci SequenceFn = Fn−1 + Fn−2 for n ≥ 2Each term is the sum of the two preceding terms, starting with F0 = 0 and F1 = 1.
Triangular NumbersTn = Tn−1 + nThe nth triangular number is the sum of the first n natural numbers.
Factorialn! = n⋅(n−1)!The factorial of n is the product of all positive integers up to n, with 0! = 1.

Solved Question

Example 1: Given a series of numbers with a missing number in middle 1, 11, 21, ?, 41. Using recursive formula find the missing term.

Solution:

Given: 1, 11, 21, ..., 41

First term (a) = 1

d = T2 - T1 = T3 - T2
⇒ d = 11 - 1 = 21 - 11 = 10

Recursive Function in AP an = an-1 + d

a4 = a4-1 + d
⇒ a4 = a3 + d
⇒ a4 = 21 + 10
⇒ a4 = 31

Example 2: Given series of numbers 5, 9, 13, 17, 21,... From the given series, find the recursive formula.

Solution:

Given number series: 5, 9, 13, 17, 21,...

First Term (a) = 5

d = T2 - T1 = T3 - T2
⇒ d = 9 - 5 = 13 - 9 = 4

Recursive Formula for AP an = an-1 + d

an = an-1 + 4

Example 3: Given a series of numbers with a missing number in the middle 1, 3, 9,..., 81, 243. Using recursive formula find the missing term.

Solution:

Given: 1, 3, 9,..., 81, 243

First Term (a) = 1

  • a2/a1 = 3/1 = 3
  • a3/a2 = 9/3 = 3
  • a5/a4 = 243/81 = 3

Common Ratio (r) = 3

Recursive Function to find nth term in GP an = an-1 × r

a4 = a4-1 × r
⇒ a4 = a3 × r
⇒ a4 = 9 × 3
a4 = 27

Example 4: Given series of numbers 2, 4, 8, 16, 32, ... From the given series find the recursive formula.

Solution:

Given number series,

2, 4, 8, 16, 32, ...

First term (a) = 2

  • a2/a1 = 4/2 = 2
  • a3/a2 = 8/4 = 2
  • a4/a3 = 16/8 = 2

Common Ratio (r) = 2

Recursive Formula an = an-1 × r

an = an-1 × 2

Example 5: Find the 5th term in a Fibonacci series if the 3rd and 4th terms are 2, 3 respectively.

Solution:

Given,

  • a3 = 2
  • a4 = 4

Then in Fibonacci Sequence, a5 = a3 + a4

a5 = 2 + 3
a5 = 5

Unsolved Question on Recursive Function

Question 1: Define a sequence recursively as: a1 = 2, an+1 = 3an + 1 for n ≥ 1. Find a3.

Question 2: A sequence is defined recursively as: b1 = 1, b2 = 1, bn = bn−1 + bn−2 for n ≥ 3 Find b5​.

Question 3: A function is defined recursively as: g(0) = 0, g(n) = g(n − 1) + 2n − 1 for n ≥ 1. Find g(4).

Question 2: A sequence is defined recursively as: b1 = 1, b2 = 1, bn = bn−1 + bn−2 for n ≥ 3. Find b5​.

Question 4: A function is defined recursively as: h(0) = 1, h(n) = n⋅h(n − 1) for n ≥ 1. Find h(4).

Comment

Explore