# Solving recursion equation with two parameters

I am trying to solve the following recursion equation, a(l,m)=l*a(l,m-1)+a(l-1,m) with initial condition; a(l,m)==0 if l=0 , a(l,m)==1 if m=1

I am trying to solve it using RSolve as following,

RSolve[{a[l, m] == l*a[l, m - 1] + a[l - 1, m], a[l, 0] == 1,
a[0, m] == 0}, a[l, m], {l, m}]


I am wondering if this is a correct way to define the initial conditions, since I am not able to find a solution...

• You can just skip the initial conditions and Mathematica will specify them. In this case, it doesn't find a solution so there may not be one. Are you sure there should be one? – Sjoerd C. de Vries Jan 31 '15 at 22:43

Your equations are inconsistent (what happens if $l = 0, m = 1$?) but in general you can use RecurrenceTable even if RSolve fails. The following code would, if the conditions were consistent, give a table of $a(l, m)$ for $m, l \in \{0, \dots, 10 \}$:

RecurrenceTable[{a[l, m] == a[-1 + l, m] + l a[l, -1 + m],
a[l, 0] == 1, a[0, m] == 0}, a, {l, 0, 10}, {m, 0, 10}]


Note value of (1,1) does not influence values in array. Here mat[[1,1]] is set as 1. In this example 10 x 10 array. Just adapt to needs:

mat = SparseArray[{{_, 1} -> 1, {1, _} -> 0}, 10];
Table[mat[[i, j]] = i mat[[i, j - 1]] + mat[[i - 1, j]], {i, 2,
10}, {j, 2, 10}];


To illustrate:

mat//MatrixForm


Just re-label (indices) (1,1)->(0,0) etc

• Hi Sjoerd C. de Vries,Thank you so much for replying. I am not sure if this recursive equation should have any solution, in fact I tried to do it analytically with converting it to differential equation, but mathematica also wasn't able to solve that differential equation. Anyway seems there is no way that I could be able to solve this equation,though thanks for helping me on this. Now I can generate the coefficient with mathematica... – setareh Feb 1 '15 at 17:29