How to solve classic ODE $x'' = a^2x$ $$x'' = a^2x$$
How to solve that ODE? (I know that the solution is $x = A \cdot \sin at + B \cdot \cos at$)
 A: For homogeneous linear differential equations one typically introduces an ansatz of the form $x(t) = e^{\lambda t}$. Differentiating this expression, one gets $x''(t) = \lambda^2 e^{\lambda t}$ and thus $\lambda^2 = a^2$. Hence $\lambda = \pm a$ and we find solutions $e^{at}$ and $e^{-at}$. The general solution is a linear combination of these two terms, so
$$x(t) = Ae^{at}+Be^{-at}.$$
Now, if your equation was instead $x''=-a^2x$, then you would find that $\lambda^2=-a^2$ in our ansatz, meaning $\lambda=\pm ia$. On the other hand, we have the Euler identity $e^{i\theta} = \cos\theta+i\sin\theta$. It is a fact that if a complex-valued expression satisfies a linear ODE with only real coefficients, then both the real and imaginary parts of this complex-valued function satisfy the ODE. Thus $\cos(at)$ and $\sin(at)$ would be solutions in this case, and the general solution to $x''=-a^2x$ would have the form $x(t) = A\cos at+B\sin at$.
A: You can also proceed as follows:
\begin{align*}
x'' = a^{2}x & \Longleftrightarrow x'' - a^{2}x = 0\\\\
& \Longleftrightarrow (x'' - ax') + (ax' - a^{2}x) = 0\\\\
& \Longleftrightarrow (x' - ax)' + a(x' - ax) = 0\\\\
& \Longleftrightarrow u' + au = 0\\\\
& \Longleftrightarrow (\exp(at)u)' = 0\\\\
& \Longleftrightarrow \exp(at)u = b\\\\
& \Longleftrightarrow x' - ax = b\exp(-at)\\\\
& \Longleftrightarrow (\exp(-at)x)' = b\exp(-2at)\\\\
& \Longleftrightarrow x(t) = B\exp(-at) + C\exp(at)
\end{align*}
Hopefully this helps!
BONUS
You can also try to multiply both sides by $x'$.
