Find solution to recurrence equation

44 Views Asked by At

Given a recurrence equation $nS(n)-(n+2)S(n-1)-n=0$ I first tried to find the homegeneous solution using the characteristic equation:

$$nr-(n+2)=0$$ which gives me the solution $S_h(n)=a(\frac{n+2}{n})^n$.

Then for the inhomogeneous part I tried a linear ansatz $cn+d$. So I have:

$$n(cn+d)-(n+2)(c(n-1)+d)-n=0$$

which simplifies to $-cn+2c-2d-n=0$.

Putting $-cn+2c=0$ and $-2d-n=0$, I get $c=0,d=-n/2$

However the final solution differs from what WolframAlpha says so I think I made a mistake. Any help would be appreciated!

1

There are 1 best solutions below

2
On

You have indeed :

$$S(n) - S(n-1)(1+\dfrac{2}{n}) =1 $$

Which gives actually (beware of $n$ changing) for homogenous solution :

$$S_h(n)= S(0)\prod_{i=1}^n(1+\dfrac{2}{i})$$

Your particular solution don't work because $d$ cannot depend on $n$.

But taking $ S_p(n)= -(n+1) $ works because cancel the denominator.


Finally

$$ S : n \to S(0)\prod_{i=1}^n(1+\dfrac{2}{i})-(n+1)$$