How can I recursively define functions of more than one variable? If I want to recursively define a

Emanuel Keith

Emanuel Keith

Answered question

2022-06-24

How can I recursively define functions of more than one variable?
If I want to recursively define a function f : N N , I can follow the following simple schema:
1. Define f(0) explicitly.
2. For each n 0, define f ( n + 1 ) in terms of f(n).
This ensures that each natural number has a unique image under f. Now suppose I want to recursively define a two-variable function g : N × N N . For example, maybe I want to define binomial coefficients, or stirling numbers, or something. Is there an analogous schema I can use?
Note: I'm very new to math, so if you could be as explicit as possible, I would really appreciate it!

Answer & Explanation

humbast2

humbast2

Beginner2022-06-25Added 21 answers

Step 1
You’ve discussed the most basic recursion principle, which states, in more formal terms,
Suppose a A, and suppose g : A A. There is a unique function f : N A such that f ( 0 ) = a and such that for all n, f ( n + 1 ) = g ( f ( n ) ).
In other words, if we define f(0) and then define f ( n + 1 ) in terms of f(n), we’ve defined f.
We can define more general functions in many ways, all derived from this schema. Here’s an illustrative example.
Step 2
Let A = N N . Let a A be defined by a ( 0 ) = 1 and a ( n + 1 ) = 0. Given x A, define g(x) by g ( x ) ( 0 ) = 1 and g ( x ) ( n + 1 ) = x ( n ) + x ( n + 1 ). Then g : A A.
Take f : N A such that f ( 0 ) = a and f ( n + 1 ) = g ( f ( n ) ). Then it turns out that ( n m ) = f ( n ) ( m ). For we see that ( n k ) = ( n 1 k 1 ) + ( n k ) whenever n , k > 0, and the base cases also match up.
Llubanipo

Llubanipo

Beginner2022-06-26Added 9 answers

Step 1
Yes. Again, you need
- one or more "recurrence relation", connecting some term to other terms,
- one or more "initial values", giving explicitly values for certain terms.
For example, the binomial coefficients can be defined by:
- b ( n , n ) = 1 for all n
- b ( n , 0 ) = 1 for all n
- b ( n , k ) = b ( n 1 , k 1 ) + b ( n 1 , k ) for 0 < k < n.
Step 2
Another scheme that works is:
- b ( 0 , 0 ) = 1
- b ( 0 , k ) = 0 for k 0
- b ( n , k ) = b ( n 1 , k 1 ) + b ( n 1 , k ) for all n > 0.

Do you have a similar question?

Recalculate according to your conditions!

New Questions in Discrete math

Ask your question.
Get an expert answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?