<s>[INST] Find $f:\mathbb{R} \to [-1, 1]$ which satisfies these two conditions: 
Find $f:\mathbb{R} \to [-1, 1]$ which satisfies these two conditions:


$f(x+y)=f(x)f(a-y)+f(y)f(a-x)$, $f(a-x-y)=f(a-x)f(a-y)-f(x)f(y).$ ($a$: constant.)

My expectation of $f$ is $f(x)=\sin(\frac {\pi x} {2a} +2\pi n).$ But, how can we prove this? Or, are there other functions that satisfy those conditions?
If we substitute $f(x)=\sin(\frac{\pi x}{2a}+2\pi n)$, we get:
$\newcommand{\x}{\dfrac{\pi x}{2a}} \newcommand{\y}{\dfrac{\pi y}{2a}} \newcommand{\pin}{\pi n} \sin\left(\x+\y+2\pin\right)=\sin\left(\x+\y\right)\\
=\sin\left( \x+2\pin \right)\sin\left( \dfrac {\pi}{2}-\y+2\pin \right)+\sin\left(\y+2\pin\right)\sin\left(\dfrac{\pi}{2}-\x+2\pin\right) \\
=\sin\left(\x\right)\cos\left(\y\right)+\sin\left(\y\right)\cos\left(\x\right). \\
\ \\
\ \\
\sin\left(\dfrac{\pi}{2}-\x-\y+2\pin\right)= \cos\left(\x+\y\right)\\
=\sin\left(\dfrac{\pi}{2}-\x+2\pin\right)\sin\left(\dfrac{\pi}{2}-\y+2\pin\right)-\sin\left(\x+2\pin\right)\sin\left(\y+2\pin\right) \\
=\cos\left(\x\right)\cos\left(\y\right)-\sin\left(\x\right)\sin\left(\y\right).$
Uh... Can we show that $f'(x)=f(a-x)?$
 [/INST] If we let $g(x) = f(a-x) + i.f(x)$, the two equations are equivalent to $g(x+y) = g(x).g(y)$. This resembles Cauchy exponential functional equation from $\mathbb{R}$ to $\mathbb{C}$, and there are infinitely many solutions via Hamel's basis.
If $f$ is continuous on the other hand, plugging $x=0$ yields $g(y) = g(0)g(y)$. Excluding trivial solution $g = 0$, pick some $g(y) \ne 0$, so $g(0) = 1$. Plugging $x \rightarrow a-x$ to $g$'s definition yields $g(a-x) = i.g(x)$, so $g(a) = i.g(0) = i$. For integers $m, n$ with $n \ne 0$, we have $g(\frac{m}{n}a)^{n} = g(ma) = g(a)^m = i^m = e^{\frac{\pi i m}{2}}$, so $g(\frac{m}{n}a) = e^{\frac{\pi i m}{2n} + \frac{2 \pi i k}{n}}$ for some $k \in \mathbb{Z}$. Since $\mathbb{Q}$ is dense in $\mathbb{R}$ and $g$ is continuous, we "plug $x = \frac{m}{n} a$" to get $g(x) = e^{(\frac{1}{2} + 2k(x)) \frac{\pi i x}{a}}$ for some integer function $k$. Notice that in order for $g$ to be continuous, $k$ must be continuous except when $x \in a \mathbb{Z}$, where $k$ is free to be any integer. In another words, $k(x) = \sum k_n 1_{x \in (na, (n+1)a)} + \sum l_n 1_{x = na}$ for constant integers $\{k, l\}_n$. Now, $g(na)$ stays the same when $l_n$ change, so WLOG $l = 0$, and $k(x) = \sum k_n 1_{x \in (na, (n+1)a)}$.
Thus $f(x) = Im(g(x)) = \sin(\frac{(4k(x)+1) \pi x}{2a})$, which along with $f(x) = 0$ satisfies the original equations.
</s>