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. 
 A: 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  
A: You can do this two ways:


*

*Try a solution of the form $\Psi(t) = c e^{\alpha t}$ gives you that $c$ is arbitrary, and $\alpha = \pm k i$, where $i = \sqrt{-1}$. So you have solutions $\Psi(t) = c_1 e^{i k t} + c_2 e^{- i k t}$. By Euler's formula, you can write this in terms of $\sin k t$ and $\cos k t$.

*Note that $\dfrac{d^2}{d t^2} \sin c t = - c^2 \sin c t$ and $\dfrac{d^2}{d t^2} \cos c t = - c^2 \cos c t$, so this is a promising lead to fugde up a pair of solutions.

A: There are many ways, as you already know it, you can prove that it is a solution by just plugging it in. But that is not really satisfying I guess. We can write 
\[ \frac{d^2 \psi}{dx^2}=- k^2 \psi \]
 as a first order differential equation system 
\begin{align*}
\psi_1 &= \psi'\\
\psi_1' &= - k^2 \psi
\end{align*}
We can write this equation system as 
\[ \begin{pmatrix} \psi \\ \psi' \\ \end{pmatrix}' = 
\begin{pmatrix} 0 & 1\\
-k^2 & 0 \\ \end{pmatrix} \cdot \begin{pmatrix} \psi \\ \psi' \end{pmatrix}\]
Here we gonna use the matrix exponential function for which we only need to know the eigenvalues und their multiplicity. The Matrix exponential function comes from the idea that the solution of the 1 dimensional linear ode 
\[ y'= a y \]
is the exponential function, so with a bit luck 
\[ y'=A y\] 
will be solved by $y=\exp( A t )$. In fact that is true and as the characteristic polynomial is 
$$x^2+k^2=(x+ik)\cdot (x-ik)$$ 
So you get your solutions by a linear combination of $\exp(ikt )$ and $\exp(-ikt )$ and 
with the identiy 
\begin{align*}
\sin(x)&=\frac{1}{2} \cdot (e^{ix} - e^{-ix})\\
\cos(x)&=\frac{1}{2} \cdot (e^{ix} + e^{-ix})
\end{align*}
A: You can also do this. Rewrite your equation as:
$$\psi''+k^2 \psi=0$$
$$\psi'' +ik\psi'-ik\psi'+k^2 \psi=0$$
$$\psi''+ik\psi'-ik(\psi'+ik \psi)=0$$
Suppose $z=\psi'+ik\psi.$
We now have turned our 2nd order differential equation into a 1st order one.
$z'-ikz=0$
Separate variables to see:
$z=De^{ikx}, D\in\mathbb{C}$
Replace this solution $z$ in $z=\psi'+ik\psi$ so you get 
$$De^{ikx}=\psi'+ik\psi$$
Now solve this equation by integrating factors: 
$$\psi(x)=\frac{\int{D\mu(x)e^{ikx}}+E}{\mu(x)}$$ where $\mu(x)=e^{\int ik dx}=e^{ikx}$
So $$\psi(x)=\frac{\int De^{2ikx}+E}{e^ikx}=\frac{\frac{D}{2ik}e^{2ikx}+E}{e^{ikx}}=De^{ikx}+Ee^{-ikx}$$. The result follows upon using Euler's formula and combining constants together. 
