# Problem with RSolve function

When I use RSolve to solve the recurrence: $$S(n)=\dfrac{1}{-S(n-1)-2},S(1)=-2/3$$, it gives an empty solution:

however the solution should be:$$S(n)=-\dfrac{n+1}{n+2}$$

Did I do something wrong?

• FindSequenceFunction[ RecurrenceTable[{s[n] == 1/(-2 - s[n - 1]), s[1] == -2/3}, s, {n, 1, 10}], n] finds the solution \$-(n+1)/(n+2).
– kglr
May 29, 2019 at 13:33
• @kglr I know this method, but how Mathematica gives an empty solution? May 29, 2019 at 13:42
• Because,Mathematica is not a magic box that'll spit out a solution to any problem. May 29, 2019 at 15:12

This seems to be a "feature" of RSolve[]. Notice the following code

RSolve[{s[n] == 1/(-2 - s[n - 1])}, s[n], n] // Simplify


returns {{s[n] -> -1}} and this does satisfy the recursion equation, but not the intial condition which is why it returned no solutions in your attempt. However, as you found out, there is a parametrized family of solutions given by

s[ n_] := -(n + k)/(n + k + 1);


which apparently RSolve does not find. You should be aware that the capabilities of RSolve and other *Solve functions are limited and subject to change. Perhaps in a later version of Mathematica it will be able to find this family of solutions.

Also, as user 'kgir' mentioned in a comment, it is possible to use

FindSequenceFunction[ RecurrenceTable[
{s[n] == 1/(-2 - s[n - 1]), s[1] == -2/3}, s, {n, 1, 10}], n ]]
`

to find the solution you are looking for. Both of these functions also have limititations on their capabilities but they can be a good alternative.