Solving functional equation $f(x+y)+f(x-y)=2f(x)\cos y$?
If you could assume (or prove) that $f$ belongs to $\mathcal{C}^2(\mathbb{R})$, then you could do something like this:
Fix an arbitrary $x$, and apply $\frac{\mathrm{d}}{\mathrm{d}y}$ to both sides
\begin{align} f(x+y) + f(x-y) &= 2f(x)\cos(y)\\ f'(x+y) - f'(x-y) &= -2f(x)\sin(y)\\ f''(x+y) + f''(x-y) &= -2f(x)\cos(y) \end{align}
adding the first and last equality together yields
$$f''(x+y) + f''(x-y) + f(x+y) + f(x-y) = 0$$
for any $x \in \mathbb{R}$. Now substitute $y = 0$ to get $f''(x) + f(x) = 0$ with general solution $$f(x) = c_1 \sin(x) + c_2 \cos(x).$$
I hope this helps $\ddot\smile$
Let $P(x,y)$ be the FE.
$$P(0,x)\Rightarrow f(x)+f(-x)=2f(0)\cos x=2A\cos x$$ $$P\left (x+\dfrac{\pi}{2}\right )\Rightarrow f(x)+f(x+\pi)=0$$ $$P\left (\dfrac{\pi}{2},\dfrac{\pi}{2}+x\right )\Rightarrow f(-x)+f(x+\pi)=-2f\left (\dfrac{\pi}{2}\right )\sin x=-2B\sin x$$
So, $f(x)=A\cos x+B\sin x$.
Substituting in, the FE works. So we have found the solution.