d'Alembert-like functional equation: $f(x+y)+g(x-y)=\lambda f(x)g(y)$

The D'Alembert functional equation is $f(x+y)+f(x-y)=2f(x)f(y)$. Let $f:\mathbb{R}\rightarrow\mathbb{R}$ satisfy the functional equation for all $x,y\in\mathbb{R}$. It's well known that $f$ is of the form $f(x)=\frac{E(x)+E^∗(x)}{2}$, for some $E:\mathbb{R}\rightarrow\mathbb{C}$. How can I use this functional equation to solve the following problem?

Let $\lambda$ be a nonzero real constant. Find all functions $f,g:\mathbb{R}\rightarrow\mathbb{R}$ that satisfy the functional equation $f(x+y)+g(x-y)=\lambda f(x)g(y)$ for all $x,y\in\mathbb{R}$.


$$f(x)+g(x)=\lambda g(0)f(x)$$ $$\therefore g(x)=\big(\lambda g(0)-1\big)f(x)$$ $$\therefore f(x+y)+\big(\lambda g(0)-1\big)f(x-y)=\big(\lambda g(0)-1\big)f(x)f(y)\tag0\label0$$ $$\therefore f(y+x)+\big(\lambda g(0)-1\big)f(y-x)=\big(\lambda g(0)-1\big)f(y)f(x)$$ Subtracting the last two equations and putting $y=0$: $$\therefore\big(\lambda g(0)-1\big)\big(f(x)-f(-x)\big)=0$$ Now if $\lambda g(0)-1=0$ then $f$ and $g$ are both equal to the constant zero function. Else, $f$ must be an even function. In this case, substituting $-y$ for $y$ in \eqref{0}: $$\therefore f(x-y)+\big(\lambda g(0)-1\big)f(x+y)=\big(\lambda g(0)-1\big)f(x)f(-y)\tag1\label1$$ Adding \eqref{0} and \eqref{1} and using evenness of $f$ we get: $$\lambda g(0)\big(f(x+y)+f(x-y)\big)=2\big(\lambda g(0)-1\big)f(x)f(y)$$ Now if $g(0)=0$ then by the last equation $f(x)^2=0$ and so $f$ is equal to the constant zero function. Otherwise, we get: $$f(x+y)+f(x-y)=\mu f(x)f(y)$$ where $\mu=\frac{2(\lambda g(0)-1)}{\lambda g(0)}$. Now if we define the function $h$ by the equation $h(x)=\frac{\mu}{2}f(x)$ then $h$ satisfies D'Alembert functional equation.