0% found this document useful (0 votes)
14 views2 pages

AMT-2b. Recursively Defined Functions

Uploaded by

Manish kumawat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views2 pages

AMT-2b. Recursively Defined Functions

Uploaded by

Manish kumawat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Recursively Defined Functions in Discrete

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.

ˆ Base case: f (0) = 1 (by definition).


ˆ Recursive case: f (n) = n × f (n − 1), for n > 0.

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.

2.2 Fibonacci Sequence


The Fibonacci sequence is another common example, where each term is the
sum of the two preceding terms.

ˆ Base case:
F (0) = 0, F (1) = 1

ˆ Recursive case:

F (n) = F (n − 1) + F (n − 2), for n > 1

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:

ˆ Base Case: f (0) = c0 , or some other initial value f (k) = ck .

ˆ Recursive Case: f (n) = g(n, f (n − 1), f (n − 2), . . . ), where g is some


function defining f (n) in terms of previous values.

4 Example: Recursively Defined Summation


Let S(n) be the sum of the first n positive integers:

ˆ Base case: S(0) = 0.

ˆ Recursive case: S(n) = S(n − 1) + n.

For example, S(3) = S(2)+3, and S(2) = S(1)+2, and so on until S(0) = 0.

5 Why Use Recursively Defined Functions?


ˆ Natural Representation: Some problems are naturally solved in terms
of smaller subproblems, such as divide-and-conquer algorithms.
ˆ Mathematical Simplicity: Recursive definitions often provide a clear,
concise way to express a function.

ˆ Relation to Recurrence Relations: Recursive definitions often corre-


spond to recurrence relations, which are used in the analysis of algorithms,
especially in time complexity.

Recursive functions are essential in discrete mathematics as they model pro-


cesses that build upon previous results.

You might also like