closed form of f(n,k) = f(n-1,k-1) + f(n-1,k) + f(n-2,k-1)

306 Views Asked by At

I am stuck at solving linear recurrence relation of 2 variables :

f(n,k) = f(n-1,k-1) + f(n-1,k) + f(n-2,k-1)

what would be closed form for f(n,k)?

Base condition :
f(1,1) = 2 , f(2,1) = 4 , f(2,2) = 2
&
f(x,0) = 1 { x is a whole number } ,
also f(n,k) = 0 if k>n or k<0 or n<0

1

There are 1 best solutions below

4
On BEST ANSWER

If in the given recurrence $$ f(n,k) = f(n - 1,k - 1) + f(n - 1,k) + f(n - 2,k - 1) $$ we put $$ f(n,k) = D(n - k,k) $$ then we get $$ D(n - k,k) = D(n - k,k - 1) + D(n - k - 1,k) + D(n - k - 1,k - 1) $$ i.e. $$ D(n,k) = D(n,k - 1) + D(n - 1,k) + D(n - 1,k - 1) $$ and this is the recurrence relation defining the Delannoy Number

Therefore putting

and since $$ D(n,k) = \sum\limits_{j = 0}^{\min (n,k)} { \binom{n+k-j}{n} \binom{n}{j} } = \sum\limits_{j = 0}^{\min (n,k)} {2^{\,j} \binom{n}{j} \binom{k}{j} } $$ whose derivation is well exposed in the link above, then $$ f(n,k) = \sum\limits_{j = 0}^{\min (n - k,k)} { \binom{n-j}{n-k} \binom{n-k}{j} } = \sum\limits_{j = 0}^{\min (n - k,k)} {2^{\,j} \binom{n-k}{n-k-j} \binom{k}{k-j} } $$

Other interesting properties and relations are provided in OEIS sequence A008288.

With the "standard" initial conditions given above the $f(n,k)$ triangle starts as

Delannoy_N_1

If your initial conditions are different, then an appropriate combination and shifting of the standard triangle shall be considered.

For instance, $f(n,k)+f(n-1,k-1)$ would give

Delannoy_N_2

which looks to match your initial conditions