Problem
Find the functional $f: \mathbb{R} \to \mathbb{R}$ with $f(x+y)+f(x-y)=2f(x)cosy$
Attempts
Now as I know, the functional equation can be solved more generally as follow:
General problem Find the function$f: \mathbb{R} \to \mathbb{R}$ \begin{align} f(x+y)+f(x-y)=2f(x)h(y) \end{align}
with $h$ being an even function.
General solution
Choose r such that $h(x − 2r) ≡ h(x)$. Let $f_p$ be a particular solution of the problem and $f$ a general solution.
Choose constants $A$ and $B$, not both zero, such that $Af_p(r) + Bf(r) = 0$. Define $F(x) = Af_p(x) + Bf(x)$ so that $F(r) = 0$. Interchanging $x$ and $y$ in the original equation, we see that $f(x+y)-f(x-y)=2f(y)h(x)$
Thus, \begin{align} f(x-y)=f(x)h(y)-f(y)h(x) \end{align}
Now as I see, this is great for odd $f$, but my original problem does not contain that kind of condition, and as I suspect, the solution is $f(x)= acosx+bsinx$ is also not odd.
Is there any way this can be done?
Any help is appreciated.