Finding general solution of $x'' + 2k x' + \omega^2 x = 0$? Problem: Let $k, \omega > 0$. Give the general solution of the differential equation \begin{align*} x'' + 2k x' + \omega^2 x = 0 \end{align*} for a function $x(t)$. Give the general solution for the case that (i) $k > \omega > 0$ and for the case that (ii) $0 < k < \omega$.
Attempt: This a homogeneous differential equation of second order with constant coefficients. Hence the characteristic equation of this ODE is \begin{align*} r^2 + 2k r + \omega^2 = 0. \end{align*} The solutions of this equation are \begin{align*} r_1 = -k + \sqrt{k^2 - \omega^2} \quad \text{and} \quad r_2 = -k - \sqrt{k^2 - \omega^2} \end{align*} Now I'm not sure how to write down the general solution. For case (i) we will have that $r^2 - \omega^2 > 0$ and so the solutions will be real. For case (ii) they will be complex. We cannot have that $r_1 = r_2$, unless $k^2 - \omega^2 = 0$. Should I just write \begin{align*} x(t) = c_1 e^{r_1 t} + c_2 e^{r_2 t}, \end{align*} with $c_1, c_2$ arbitrary constants?
 A: There are three solutions:
if the roots are real(not same  or k>w) the solution is
$$\begin{align*} x(t) = c_1 e^{r_1 t} + c_2 e^{r_2 t}, \end{align*}$$
if the roots are real (same or r=w) the solution is
$$x(t) = c_1 e^{r_1 t} + c_2 te^{r_1 t}$$
if the roots are (real+complex or $k<w$) the solution is
$$x=e^{r1 t}(A\cos(r2 x)+B\sin(r2 x))$$
so
$r1=real part$ and $r2=imaginary part$
A: Notice, if $k^2-\omega^2<0$, the roots are complex given as 
$$r_1, \ r_2=-k\pm i\sqrt{\omega^2-k^2}$$
then you need to write the solution as follows $$x(t)=e^{-kt}\left(c_1\cos t\sqrt{\omega^2-k^2}+c_2\sin t\sqrt{\omega^2-k^2}\right)$$ 
A: For the second part, you have as a general solution $$x=e^{-kt}(A\cos (t\sqrt{\omega^2-k^2})+B\sin(t\sqrt{\omega^2-k^2}))$$
A: This is a slightly odd way of doing it, that separates some of the structure and reduces to an easier equation: set $x(t)=e^{-kt}y(t)$ (where do I get this from? Well, looking at the roots of the charactistic equation, naturally... It's also possible to think of it as a sort of integrating factor.). The derivatives are
$$ x' = e^{-kt}(y'-ky), x'' = e^{-kt}(y'' -2ky' + k^2y), $$
and putting these into the DE, the $e^{-kt}$ cancels, giving
$$ 0 = (y''-2ky'+k^2y)+2k(y'-ky) + \omega^2 y = y''+(\omega^2-k^2)y. $$
Ah, but we know the solutions to this equation: if $\omega^2-k^2=0$, then
$$ y''=0 \implies y=At+B $$
for some constants $A,B$. If $\omega^2-k^2>0$, this is the simple harmonic motion equation, which has solutions of the form
$$ A\cos{\sqrt{\omega^2-k^2}t}+B\sin{\sqrt{\omega^2-k^2}t}, $$
whereas if $\omega^2-k^2<0$, this introduces a factor of $i$ into the above solutions, and using the relationship between trigonometric and hyperbolic functions implies that the general solution can be written as
$$ A\cosh{\sqrt{k^2-\omega^2}t}+B\sinh{\sqrt{k^2-\omega^2}t} $$
or
$$ Ae^{\sqrt{k^2-\omega^2}t}+Be^{\sqrt{k^2-\omega^2}t}; $$
which form is most useful depends on the initial conditions. For the $x$ solution, just multiply these by $e^{-kt}$, of course.
