Solution to the second order differential equation Hello i have read in a book that second order diferential equation of this form ($\psi$ is a function of $x$): 
$$
\frac{d^2 \psi}{dx^2} = - k^2\, \psi
$$
describes a simple harmonic oscilator and the solution to this second order differential equation is of form: 
$$
\psi = A \sin(k x) + B \cos(kx)
$$
This solution is generaly known, but i want to know the background on how it is calculated out of the first equation. 

Assuming $$ \frac{d^2 \psi}{dx^2} = k^2\psi $$ to be correct,
the Characteristic equation will be $r^2=k^2\implies r=\pm k$
So, $\psi=Ae^{kx}+Be^{-kx}$ where $A,B$ are arbitrary constants  
If $k=i b, \psi=Ae^{ibx}+Be^{-ibx}=A(\cos bx+i\sin bx)+B(\cos bx-i\sin bx)$  using Euler's Formula 
So, $\psi=(A+B)\cos bx+i(A-B)\sin bx$
$\psi=C\cos bx+D\sin bx$ where $C=A+B,D=i(A-B)$ are arbitrary constants  
