Let's say we have a mass on a spring being driven by a forcing function. Given hook's law, $F = -kx$, and a forcing function of $$F(t) = F_0\sin(\omega t) .$$ We can write:

$$ m\frac{d^2x}{dt^2} = -kx + F_0\sin(\omega t) $$

All the physics resources I've come across assume that the motion of the spring follows the applied force, and present the solution as some form of:

$$ x = C\sin(\omega t) $$

They typically then go onto substitute x into the differential equation and obtain:

$$ C = \frac{F_0}{m(\omega_0^2-\omega^2)} $$

This is a pretty cool formula. I really wanted understand, why, if $\omega>\omega_0$, $C$ becomes negative and our motion is exactly out of phase with our force. This is not intuitive to me, and in an effort to better understand it, I decided to run a numerical analysis.

I started my mass initially at rest at position zero and to my horror, my numerical analysis yielded these results: Forced Harmonic Oscillation Solution

Clearly the motion of the mass can not be described by a single sine! What's going on here? After pulling my hair out a bit, I realized that my numeric analysis was in fact correct, and it was the analytical solution that was lacking. The full solution to our equation of motion is:

$$ x(t) = A\sin(\omega_0 t) + B\cos(\omega_0 t) + \frac{F_0 \sin(\omega t)}{m(\omega_0^2-\omega^2)} $$

And when we setup out initial conditions correctly, this analytical solution agrees with the numerical solution! Our earlier solution is a special case of this solution - but the initial conditions must be set to very specific values for this to happen.

So my question is - what the heck is going on here? Is this solution just not important, or not relevant? It seems to me that unless the initial conditions are exactly right, you won't even see the behavior shown in most physics resources. In real applications, does the solution taught typically just not happen, or am I missing something?

  • 1
    $\begingroup$ Good job on exploring this for yourself numerically. Have to say that I'm surprised the homogeneous component was not made clear in your course/textbook. $\endgroup$
    – Keith
    Commented Apr 10, 2015 at 5:52

2 Answers 2


Usually, the (sinusoidal) driven harmonic oscillator is damped, and the first two parts of your solution (which depend on the initial conditions, while the third term does not) are transient, i.e. not relevant after a short time. That the solution $$ x(t) = \frac{F_0\sin(\omega t)}{m(\omega_0^2 - \omega^2)}$$ cannot be the "full" solution to the equation of motion is already clear from the fact that it does not depend on the intitial conditions $x(0)$ and $\dot{x}(0)$, as the full solution to a second-order differential equation should.

In your case of an undamped driven harmonic oscillator the initial condition-dependent parts are not transient, because there is no damping to take them away.

Since absense of damping is an idealization in almost all cases, almost no real-world forced oscillator will show the behaviour you have simulated.


Clearly the motion of the mass can not be described by a single sine! What's going on here?

The general solution to the simple harmonic oscillator is the sum of the unforced response (homogeneous solution) and the forced response.

The homogeneous solution is

$$x_h(t) = x_h(0) \cos(\omega_0 t) + \frac{\dot x_h(0)}{\omega_0}\sin(\omega_0 t)$$

Thus, for non-zero initial conditions, the general solution for a sinusoidal forcing function with angular frequency $\omega \ne \omega_0$ will be the sum of two sinusoids, one at the natural frequency and one at the driving frequency.

If there is damping, the homogeneous solution decays with time as $e^{-t/\tau}$ leaving essentially only the driving frequency component for $t \gt 5 \tau$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.