# Generation function of recurrence sequence

I'm trying to find generation function of recurrence sequence

ClearAll[c];
c := 0;
c := 1;
c[n_] := (2 + 2*(n - 2)*c[n - 2] + (n - 2) (n - 1) c[n - 1])/(n (n - 1));
Table[c[i], {i, 1, 15}]
FindGeneratingFunction[%, x]


but Mathematica just output

FindGeneratingFunction[{0, 1, 2/3, 5/6, 4/5, 37/45, 52/63, 349/420, 338/405,
873/14175, 14554/17325, 157567/187110, 466498/552825,
11994551/14189175, 41582906/49116375}, x]


How I can find GeneratingFunction?

Let y[x]=Sum[c[n]x^n,{n,0,Infinity}] be the generation function of c[n]. Then y[x] satisfys a 2rd order ODE (1-x)y''[x]-2xy'[x]-2/(1-x)==0. Try to find solution with DSolve and the result is

y[x] -> (1 + C E^(-2x))/(1 - x) + C - (2 C ExpIntegralEi[2 - 2 x])/E^2


We have initial conditions y'=c=1, y''=2c=2*1=2. Thus,the undetermined coefficents(upper case "C") C and C will be obtained immediately by adding them to the DSolve function above.

However Mathematica returns

"DSolve::bvnul:For some branches of the general solution, the given boundary
conditions lead to an empty solution."


That error massage means C or C can't be determined. This may be due to the value of c, c and c. Turn to the recurrence relation, then we get c=(2+0*c+0*c)/2=1.

That is to say, c and c can be any value!! No wonder that we can't find a proper solution to that ODE.

By the way, you will get a result of c[n] (a long long expression involved n) by inputing following command

RSolve[{c[n] == (2 + 2*(n - 2)*c[n - 2] + (n - 2) (n - 1) c[n - 1])/(n (n - 1)),
c == 0, c == 1}, c[n], n]


I realise that it is not the answer for your question about generating function but it may help a little.

I will abuse the fact that you do not ask why. I have no experience with this area in Mathematica. But using documentation I was able to find a solution.

That's what is the best in Mathematica!

For your list, I've added an iterator so it will fit FindSequenceFunction

list = Table[{i, c[i]}, {i, 1, 15}]

f = FindSequenceFunction[list]

DifferenceRoot[
Function[{y, n},
{-2 - 2*n*y[n] - n*(1 + n)*y[1 + n] + (1 + n)*(2 + n)*y[2 + n] == 0,
y == 0, y == 1}]]

 Array[f, 15] == Array[c, 15]

True

• I didn't notice you hit 10k, congrats! – rcollyer Oct 25 '13 at 14:13
• @rcollyer I don't know why I have not seen your comment earlier :/ Thanks! :) – Kuba Mar 12 '14 at 9:50