2
$\begingroup$

I tried solving following partial difference equation in Mathematica by typing

RSolve[{C[n, k] == C[n-1, k] + C[n-1, k-1], C[n, 0] == 1, C[n, n] == 1}, C[n, k], {n, k}]

but returns the following error message

RSolve::conarg: The arguments should be ordered consistently. >>

but it does not work, please someone help me in this regard. Thanks and regards in advance.

$\endgroup$
8
  • $\begingroup$ And when it failed it did not got you thinking ... ? $\endgroup$
    – Sektor
    Mar 17, 2014 at 17:55
  • $\begingroup$ @Sektor Do you imply that there is a trivial error? I fail to see it, could you please be more specific? $\endgroup$ Mar 17, 2014 at 19:10
  • $\begingroup$ @IstvánZachar No, imply that he ran into some kind of trouble and the first thing to do is: Help me ! $\endgroup$
    – Sektor
    Mar 17, 2014 at 19:17
  • $\begingroup$ @IstvánZachar C[n, n] == 1 isn't an init.cond nor a rec.rel. $\endgroup$ Mar 17, 2014 at 20:23
  • 1
    $\begingroup$ @IstvánZachar To me, most Mma errors (including this one) sound more like an invitation to exegesis. $\endgroup$ Mar 17, 2014 at 21:16

1 Answer 1

1
$\begingroup$

It seems that Mathematica's RSolve[] simply can't solve this rather simple type of partial recurrence. However, the problem itself can easily be solved completely with Mathematica as follows. This is also a hint to try alternative formulations in mathematica if a specific one does not succeed. See Why does Mathematica not evaluate the difference recurrence using `RSolve` or `RecurrenceTable`? for a similar problem and its solution.

As a first step to solve the given recurrence we rewrite the recurrence relations as function definitions (henceforth writing a[n,k] instead of C[n,k] because C is a reserved symbol in Mathematica)

Clear[a]
a[n_, k_] := a[n, k] = a[n - 1, k] + a[n - 1, k - 1]
a[n_, n_] := a[n, n] = 1
a[n_, 0] := a[n, 0] = 1

The first few a[n,k] are then

nn = 10;
t = Table[a[n, k], {n, 0, nn}, {k, 0, n}]

(*
Out[217]= {
{1}, 
{1, 1}, 
{1, 2, 1}, 
{1, 3, 3, 1}, 
{1, 4, 6, 4, 1}, 
{1, 5, 10, 10, 5, 1}, 
{1, 6, 15, 20, 15, 6, 1}, 
{1, 7, 21, 35, 35, 21, 7, 1}, 
{1, 8, 28, 56, 70, 56, 28, 8, 1}, 
{1, 9, 36, 84, 126, 126, 84, 36, 9, 1}, 
{1, 10, 45, 120, 210, 252, 210, 120, 45, 10, 1}}
*)

Now we proceed to find the general formula for the elements. We could guess it immediately from the numbers obtained to be a binomial coefficient. But let us proceed differently.

The generating function of the a[n,k] is easily found to be

Clear[g]

g[x_, y_] := 1/(1 - (x +  x y))

In fact the coefficients of the series expansion of g, given by

Clear[b]

b[n_, k_] := 1/(n! k!) D[g[x, y], {x, n}, {y, k}] /. {x -> 0, y -> 0}

are identical to a[n,k] as can be seen from the first few values.

Expansion of g in a geometrical series and using the binomial theorem leads to the explicit formula for the solution of the recurrence equation:

c[n_, k_] := Binomial[n, k]

which we probably have already recognized earlier from the numbers.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.