Example 4 Solve the functional equation $f(x+y)+f(x-y)=2 f(x) \cos y, x, y \in \mathbf{R}$
Let $x=0, y=t$, we get $f(t)+f(-t)=2 f(0) \cdot \cos t$  
Let $x=\frac{\pi}{2}+t, y=\frac{\pi}{2}$, we get $\quad f(\pi+t)+f(t)=0$  
Let $x=\frac{\pi}{2}, y=\frac{\pi}{2}+t$, we get $\quad f(\pi+t)+f(-t)=-2 f\left(\frac{\pi}{2}\right) \sin t$  
(1) + (2) - (3), we get $f(t)=f(0) \cos t+f\left(\frac{\pi}{2}\right) \sin t$  

Upon verification, it is a solution to the original equation.