Q:

How do I prove that both solutions to this differential equation $y"+k^2y=0$ are equivalent?

Consider the following differential equation $y''+k^2y=0$, where $y''$ is the 2nd derivative of y with respect to x. The solution to this equation is $y = A\exp(ikx) + B\exp(-ikx)$. However, another equivalent solution is $y = D\cos(kx+E)$. How do I prove that both solutions are equivalent? Are $A$, $B$, $D$, $E$ complex or real constants?
I have been told that B is the complex conjugate of A, so let $A = a+bi$ and $B = a-bi$, where $a$ and $b$ are real. $$y = (a+bi)(coskx + isinkx) +(a-bi)(coskx-isinkx) = 2acoskx -2bsinkx$$ Let $2a =DcosE$ and $2b=DsinE$ and we can get the answer. Is this working correct? 

A:

Here is the simplified approach of this problem:
We are given that
$$y = Ae^{ikx} + Be^{-ikx}$$
and
$$y = D\cos(kx + E)$$
are solutions of the differential equation $y'' + k^2y = 0$.  We treat $A$, $B$, $D$, $E$ to be any constants (no restrictions).
First expression
By Frank Lu's comment, we use Euler's formula for the first expression to simplify the terms, which turns out to be
$$\begin{aligned}
y &= Ae^{ikx} + Be^{-ikx}\\
&= A(\cos(kx) + i\sin(kx)) + B(\cos(-kx) + i\sin(-kx))\\
&= A(\cos(kx) + i\sin(kx)) + B(\cos(kx) - i\sin(kx))\\
&= (A + B)\cos(kx) + (Ai - Bi)\sin(kx)
\end{aligned}$$
Fix $A + B$ to be any constant $C_1$ and $Ai - Bi$ to be any constant $C_2$.  Then, we have
$$y(x) = C_1\cos(kx) + C_2\sin(kx)$$
Second expression
For the second expression, we use compound angle identity, which is
$$\cos(kx + E) = \cos(kx)\cos(E) - \sin(kx)\sin(E)$$
The expression turns out to be...
$$\begin{aligned}
y &= D\cos(kx + E)\\
&= D(\cos(kx)\cos(E) - \sin(kx)\sin(E))\\
&= D\cos(E)\cos(kx) - D\sin(E)\sin(kx)
\end{aligned}$$
Treating $D\cos(E)$ and $-D\sin(E)$ as any constants, we see that those two solutions are equivalent (by comparing both simplified equations).

