TITLE: Differential equation, quite weird task
QUESTION [6 upvotes]: I'm having some trouble while trying to understand one task..
The task is as follows:
$$\ddot{x}(t) + \dot{x}(t) + 2x(t) = \sin(\omega t)$$
where $x(0) = 7, t\geq 0$
The solution is in the following form:
$$x(t) = f(t) + A\sin(\omega t + \varphi)$$
And the task is: find $\omega$ so that $A$ is max.
My understanding of this is that $f(t)$ is the solution of the homogeneous differential equation and the rest is the special solution of the nonhomogeneous  equation. Still that does not give me any clue about how to evaluate the relationship between $A$ and $\omega$.
Any clues?

REPLY [4 votes]: The correct value of $\omega$ is not $\frac{\sqrt{7}}{2} \approx 1.32$.  It's $\sqrt{\frac{3}{2}} \approx 1.22$.  We are looking for a near resonance effect, but you can't actually have resonance when the harmonic oscillator is damped.  This makes the analysis is a little different.
A reference is the section on sinusoidal forcing in the Wikipedia page on the harmonic oscillator.  From the formulas there you can see that the relationship between $A$ and $\omega$ is given by 
$$A = \frac{1}{\sqrt{\omega^2 + (2 - \omega^2)^2}}.$$
Solving $\frac{dA}{d \omega} = 0$ yields $\omega = \sqrt{\frac{3}{2}}$.

Update: Here's the derivation.  
The trick is to generalize, and solve the differential equation $x'' + x' + 2x = e^{i \omega t}$.  The resulting solution will have a real part and an imaginary part.  Since $e^{i \omega t} = \cos \omega t + i \sin \omega t$, you actually want the imaginary part of the solution.
As the driving force is an exponential, we know that the particular solution must be of the form $x_p(t) = c e^{i \omega t}$.  Subbing that into the differential equation produces the auxiliary equation $-c \omega^2 + i c\omega + 2c = 1$.  Solving that for $c$ yields $$c = \frac{1}{a + i b} = \frac{a - i b}{a^2 + b^2},$$
where $a = 2 - \omega^2$ and $b = \omega$.  Thus the particular solution to the complex differential equation is 
$$x_p(t) = \frac{a - i b}{a^2 + b^2} (\cos \omega t + i \sin \omega t),$$ of which the imaginary part is $$-\frac{b}{a^2 + b^2} \cos \omega t + \frac{a}{a^2+b^2} \sin \omega t.$$  Since $A$ is just the magnitude of this solution (you're doing a rotation to the vertical axis when converting to $A \sin (\omega t + \phi)$), we get $$A = \frac{1}{\sqrt{a^2+b^2}} = \frac{1}{\sqrt{\omega^2 + (2 - \omega^2)^2}}.$$