How to approach to the recursive sequence in this question

58 Views Asked by At

I am trying to reduce this sequence to something more understandable.

The recursive function is defined as

$ x(0) = 0 \\ x(i) = \frac{x(i-1)+ x(i+1)}{2} +1 \text{ for } i = 1 \dots n-1 \\ x(n) = x(n-1) +1 $.

This is a part of larger question and a solution suggests that it is easy to observe that $x(1)=2n-1 , x(2)=4n-4 , x(i) = 2in-i^2$.

My question is "how?".