$f(x+1) + f(x-1) = x^2$ ; $f(x+4) + f(x-4) = 2\sin x$ , then $f(x) =$? Given $f$ is a complex valued function satisfying $$f(x+1) + f(x-1) = x^2 \\ 
f(x+4) + f(x-4) = 2\sin x$$
what is $f(x)$ ?
Here,  only for the first part MathWolfram alpha is showing $f(x)$ to be of type $c_1(i)^x + c_2(-i)^x + \dfrac{x^2 - 1}{2}$ but how are they introducing "$i$"? I used a generating function but was still unable to get those terms containing $i$ . Please help me with this problem.  

The two conditions can be rewritten as
$$f(x+2)+f(x)=(x+1)^2$$
$$f(x+8)+f(x)=2\sin(x+4)$$
Iterating the first one gives
$$f(x+4)+f(x+2)=(x+3)^2$$
$$f(x+6)+f(x+4)=(x+5)^2$$
$$f(x+8)+f(x+6)=(x+7)^2$$
It follows
\begin{align}
2\sin(x+4) &= f(x+8)+f(x)\\
&= (x+7)^2-f(x+6)+f(x)\\
&= (x+7)^2-(x+5)^2+f(x+4)+f(x)\\
&= (x+7)^2-(x+5)^2+(x+3)^2-f(x+2)+f(x)\\
&= (x+7)^2-(x+5)^2+(x+3)^2-(x+1)^2+f(x)+f(x)\\
\end{align}
so
\begin{align}
f(x) &= \frac{2\sin(x+4)+(x+1)^2-(x+3)^2+(x+5)^2-(x+7)^2}{2}\\
&= \sin(x+4)-4x-16
\end{align}
