Two variable functional equation: $f(x+y)+f(x-y)=2f(x)\cos y$ [duplicate]

How can I solve this functional equation, where $x,y$ are any real numbers and $f:\mathbb{R}\to \mathbb R$ is a function such that : $$f(x+y)+f(x-y)=2f(x)\cos y$$


I tried substituting $x=0$ to get $f(y)+f(-y)=2f(0)\cos y$ . Taking $x=y$ gives $f(2x)+f(0)=2f(x)\cos x$. I similar get some more relations like that, but its not really helping me in finding anything useful. I also think the function must either be $\sin$ or $\cos$ looking at the product to sum formulae. Can anyone tell me how should I solve this?


Solution 1:

Let $P(x,y)$ be the functional equation $$f(x+y)+f(x-y)=2f(x)\cos y\text{,}\tag{0}\label{0}$$ $A=f(0)$ and $B=f\left (\frac{\pi}{2}\right )$.

$$P(0,x)\implies f(x)+f(-x)=2A\cos x\text{.}\tag{1}\label{1}$$ $$P\left (x+\frac{\pi}{2},\frac{\pi}{2}\right )\implies f(x+\pi)+f(x)=0\text{.}\tag{2}\label{2}$$ $$P\left (\frac{\pi}{2},x+\frac{\pi}{2}\right )\implies f(x+\pi)+f(-x)=-2B\sin x\text{.}\tag{3}\label{3}$$

So, by $\frac{\eqref{1}+\eqref{2}-\eqref{3}}{2}$, $$f(x)=A\cos x+B\sin x\text{.}\tag{4}\label{4}$$

Substituting \eqref{4} in \eqref{0}, the functional equation works, regardless of the values of $A$ and $B$. So we have found all the solutions.

Solution 2:

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$