# Solutions to damped harmonic oscillator?

For the damped harmonic oscillator equation $$\frac{d^2x}{dt^2}+\frac{c}{m}\frac{dx}{dt}+\frac{k}{m}x=0$$ we get that the general solution is $$x(t)=Ae^{-\gamma t}e^{i\omega_d t}+Be^{-\gamma t}e^{-i\omega_d t}$$ where $$\gamma = \frac{c}{2m}$$ and $$\omega_d=\sqrt{\omega^2-\gamma ^2}$$.Using Eulers equation, we can expand this as follows: $$Ae^{-\gamma t}(\cos(\omega _dt)+i\sin(\omega_d t))+Be^{-\gamma t}(\cos(\omega _dt)-i\sin(\omega_d t))$$ $$\Rightarrow e^{-\gamma t}(A+B)\cos(\omega_d t) +e^{-\gamma t}(Ai-Bi)\sin(\omega_d t)$$ But now we are dealing with a physical problem so we only examine the real part which is $$e^{-\gamma t}(A+B)\cos(\omega_d t)$$. But this does not have any phase difference. Yet textbooks always make the claim that the real part of the solution is $$e^{-\gamma t}(C)\cos(\omega_d t+\phi)$$ where $$\phi$$ is some arbitrary initial phase. But where does that initial phase come from if the real part of the solution does not have a phase change in it? I understand that $$A$$ and $$B$$ themselves need not be real however I do not understand how this fact could ever lead to a non zero initial phase in the real part of the solution.

This issue has bothered me for quite some time now so any help would be immensely appreciated!

As you've said, $$A$$ and $$B$$ are not necessarily real, they can be complex. In fact, if you want a physical solution, you don't need the $$\sin$$ term to be $$0$$, but rather you want to impose $$\overline{x(t)} = x(t)$$, which is equivalent to $$\overline{A} = B$$.

From here, you can rewrite the last part of the solution as:

$$x(t) = e^{-\gamma t} 2\, \mathrm{Re}(A)\cos(\omega_d t) - e^{-\gamma t} 2\, \mathrm{Im}(A)\sin(\omega_d t),$$

where $$\mathrm{Re}(A)$$ and $$\mathrm{Im}(A)$$ are respectively the real and imaginary part of the complex number $$A$$. With some trigonometry, you can rewrite it as $$x(t) = e^{-\gamma t} C\cos(\omega_d t + \phi)$$.

• Thanks for the response! Dont you mean that $x(t)=e^{-\gamma t}2 Re(A)cos(\omega_d t)-e^{-\gamma t}2 Im(A)sin(\omega_d t)$ ? Also, are you saying that if we want a physical solution we simply cant have a non zero imaginary part ? Since the requirement that $x^*(t)=x(t)$ requires that the entire solution solution be real. I was under the impression that if $x(t)=a+bi$ where both a and b are non zero, then we can simply take $x(t)=a$ as the physical solution discarding the non zero (or it could even happen to be zero, it doesn't matter since we are concerned with the real part) imaginary part? Sep 3, 2020 at 9:57
• Yes sorry for the mistake, I've made a correction. Let me be a little clearer with what I meant regarding the physical solution. You're trying to solve a second order differential equation involving a real variable, $x(t)$. You can solve the equation on $\mathbb{R}$ directly and it will give you $x(t) = e^{-\gamma t} C \cos(\omega_d t + \phi)$.Or, if you want to be more general, you can solve the equation on a larger set ($\mathbb{C}$), because it makes it easier to solve it using complex exponentials. Sep 3, 2020 at 12:17
• However, because you solved the equation in a larger frame, you need to put a constraint on the solution to ensure that it corresponds to a physical one (i.e, here, that $x(t)$ is real). You can also just "disregard" the imaginary part as you've suggested, but I don't think this is necessarily good practice. In any case, I think your mistake came from the fact that you assumed that $A$ and $B$ were real and thus $A i - B i$ must be purely imaginary and can be discarded (which is not the case if you consider $A$ and $B$ to be non real). Sep 3, 2020 at 12:18
• Another way to phrase it (because now I see what might have confused you) is that "discarding the imaginary part of the solution" isn't the same as "discarding the imaginary part of $A$ and $B$". You should do the former and not the latter. Sep 3, 2020 at 12:21
• This looks correct to me, yes. You can also use the quicker method by enforcing $\overline{x(t)} = x(t)$, which simplifies the calculation a bit earlier but in the end that's the same. I've skipped the last part where you transform the sum of a cos and a sin into a single cos with a phase but you can check @Eli answer for details. Sep 4, 2020 at 12:32

The general solution for your ODE is:

$$x(t)=(a+i\,b)\,e^{-\gamma t}e^{i\omega_d t}+(a-i\,b)e^{-\gamma t}e^{-i\omega_d t}\tag 1$$

Where $$a=x(0)$$ and $$b=D(x)(0)$$ are the initial conditions

expand equation (1) you obtain:

$$x(t)=2\,e^{-\gamma t}(a\,\cos(\omega_d t)-b\,\sin(\omega_d t))\tag 2$$

thus the solution is real

you can also write the solution equation (2) with two new constants $$~C$$ and $$\phi$$ instead of $$~a$$ and b :

$$x(t)=C\,\,e^{-\gamma t}\,\cos(\omega_d t+\phi)=C\,\,e^{-\gamma t}\,[\cos(\omega_d t)\,\sin(\phi)-\sin(\omega_d t)\,\cos(\phi)]\tag 3$$

comparing equation(3) with (2) you obtain:

$$\tan(\phi)=\frac{b}{a}~,C=2\,\sqrt{a^2+b^2}$$