AMT-2b. Recursively Defined Functions
AMT-2b. Recursively Defined Functions
Mathematics
1 Introduction
In discrete mathematics, recursively defined functions are functions that
are defined using their own values from previous steps. Recursive definitions
consist of two parts:
Base case(s): Specifies the value of the function for a specific input (often
the smallest possible input, such as 0 or 1).
Recursive case(s): Defines the value of the function in terms of previous
values of the function.
2 Examples
2.1 Factorial Function
The factorial function f (n) = n! is a classic example of a recursively defined
function.
This means that to calculate f (n), we need to know f (n − 1), which in turn
depends on f (n − 2), and so on, until we reach the base case f (0) = 1.
Base case:
F (0) = 0, F (1) = 1
Recursive case:
1
For example, to compute F (5), you first need to know F (4) and F (3), which
depend on F (2) and F (1), and so on, until you reach the base cases.
3 General Structure
A recursively defined function typically follows the structure:
For example, S(3) = S(2)+3, and S(2) = S(1)+2, and so on until S(0) = 0.