Discrete Mathematics

CS 2610

October 21, 2008

Docsity.com

2

Recursively Defined Functions

We are familiar with the use of formulae to define

functions. But it is also possible to define some

functions using recursion.

Example:

f(n) = n2 for n ∈ Z≥0

or…

f(0) = 0

f(n+1) = f(n) + (2n + 1), for n ∈ Z≥0

Docsity.com

3

Recursively Defined Functions

Defining a function recursively requires a basis step

(or steps) and a recursive step,

just like induction

.

Example: f(n) = n!, for n ∈ Z≥0

Basis: f(0) = 1

Yup, that’s the def. of 0!

Rec. Step: f(n+1) = f(n) ⋅ (n+1), n ∈ Z≥0

Example:

Fibonacci sequence

: 0, 1, 1, 2, 3, 5, 8, …

Basis: f(0) = 0, f(1) = 1

Rec. Step: f(n+2) = f(n+1) + f(n), for n ∈ Z≥0

Docsity.com

4

Recursively Defined Sets

We can define sets in the same manner, by

establishing a basis and recursive step.

Example: S = { x | x is an odd, positive integer }

Basis: 1 ∈ S

Rec. Step: if x ∈ S, then x + 2 ∈ S

Docsity.com

##### Document information

Uploaded by:
atasi

Views: 1229

Downloads :
0

University:
Islamic University of Science & Technology

Subject:
Discrete Mathematics

Upload date:
27/04/2013