How does WolframAlpha solve this recursion?

103 Views Asked by At

I have the following recursion: $$x_n=\frac{n-1}{n}x_{n-1}+\frac{1}{n}\left\lfloor\frac{n}{2}\right\rfloor.$$ WolframAlpha gives a solution to this recursion as $$x_n=\frac{C_1+\left\lceil\frac{1-n}{2}\right\rceil^2-\left\lceil\frac{1-n}{2}\right\rceil+\left\lfloor\frac{n}{2}\right\rfloor^2+\left\lfloor\frac{n}{2}\right\rfloor}{2n},$$ for some arbitrary parameter $C_1$. How is this solution found? Moreover, is this solution unique?

1

There are 1 best solutions below

0
On BEST ANSWER

If you set $y_n = n x_n$ then the recursion is $y_n = y_{n-1} + \left\lfloor\frac n2\right\rfloor$ which may in turn be simplified by considering even and odd $n$ separately.

All you need to know then is that $\sum_{k=1}^n k = \frac{n^2+n}2$. The parameter $C_1$ appears because no initial value for the recursion is given.

As for the question of uniqueness, once you are given, e.g. $x_0$ or $x_1$, the whole sequence is fixed, so the correctness of the solution implies it is the unique solution.