# Phase difference of driving frequency and oscillating frequency

Suppose a mass is attached to a spring and is oscillating (SHM). If a driving force is applied, it must be at the same frequency as the mass' oscillation frequency. However I'm told that the phase difference between the driving frequency and the mass's frequency must be $\frac{\pi}{2}$.

Why is that? I would have thought they should have to be in phase to be in resonance?

It would depend on damping effects being taken into account or not.

Invoking Newton's 2nd Law of motion, a differential equation for the motion of a damped harmonic oscillator can be written (including an external, sinusoidal driving force term):

$m\frac{d^2x}{dt^2}+2m\xi\omega_0\frac{dx}{dt}+m\omega_0^2x=F_0\sin\left(\omega t\right)$

Where $m$ is the inertial mass of the system, $\omega_0$ is its characteristic frequency, $\xi$ a dimensionless damping factor... And, last but not least, where $F_0$ is the amplitude of the driving force and $\omega$ its frequency.

The stationary ($t\rightarrow\infty$) solution takes the shape $x\left(t\right)=A_0\sin\left(\omega t-\varphi_0\right)$, where $A_0$ is an amplitude factor (whose particular expression in terms of the particular parameters is not relevant to this question) and $\varphi_0$ is phase lag, which is this phase difference you are asking about.

This phase difference can be calculated to be $\varphi_0=\left|\arctan\left(\xi\dfrac{2\omega\omega_0}{\omega^2-\omega_0^2}\right)\right|$. It is a phase lag, so with the (implicitly) chosen phase convention, it has to be positive.

If there was no damping whatsoever in the system, $\xi$ would be zero, and you would be right: $\varphi_0=0$. The stationary motion of the oscillator would be in phase with the driving force (regardless of which is the relationship between $\omega$ and $\omega_0$).

But in an undamped resonant situation the amplitude $A_0$ diverges, which means that the stationary solution is never reached (starting from reasonable, finite initial conditions for the system). Also, in a physical down-to-earth situation, the system would eventually breakdown somewhere, somehow, since energy is being introduced into the system with perfect efficiency (that is what 'resonance' is all about) and without any means to dissipate it. Somewhere, sooner or later, something would go boom or crash. That is how nasty undamped resonances are.

On the other hand, for a non-zero damping, in the resonant case $\omega=\omega_0$, the argument of the $\arctan$ function diverges, so the phase difference turns out in this case to be $\frac{\pi}{2}$.

To sum up, the $\frac{\pi}{2}$ phase appears as an effect of damping in the system, and just a little bit of it is enough to offset the oscillatory response from the system. As it happens, every realistic, down-to-earth harmonic system has some kind of damping in its dynamics. Even if the damping is so small that the induced dephasing in an out-of-resonance situation is negligible for every purpose that the model has, damping has to be taken into account in resonant and closely resonant motion, otherwise the model yields highly unphysical results.

• Everything is good except it does not answer the question why the external force phase should be shifted with respect to the particle position phase to obtain a resonance. Imagine an oscillator with initially high amplitude and a weak external force. If the phase shift condition is not respected, it may take long time before the force starts to increase the oscillator energy. – Vladimir Kalitvianski Jan 8 '13 at 12:26
• I gather you mean 'why it should be so?', with physical intuition? You're right, in fact I find that your answer is much more intuitive in that respect. – user17581 Jan 8 '13 at 12:42
• In fact, I intended to answer from a similar point of view, but when I was done you had already posted your answer, so I completely changed the scope of mine, since I didn't intend to repeat what you had already said :-P Even if it takes a long time before the external influence starts to increase the energy, in the end the stationary solution would be the same. Of course, it all comes down to what the purpose of the model is, and its typical timescales. – user17581 Jan 8 '13 at 12:51
• Your post is good, and it is probably I who did not understand the original question. – Vladimir Kalitvianski Jan 8 '13 at 12:51
• Thanks for your answer, with the help of a friend we are able to somewhat understand it. However we're unsure why it's $\frac{\pi}{2}$ all the time? (we are at quite a basic level, (A2 level in the UK, which is the year before university) – Jonathan. Jan 8 '13 at 15:03

The oscillator frequency $\omega$ says nothing about the actual oscillator phase. Let us suppose that your oscillator oscillates freely like this: $$x(t) = A_0\cdot\cos(\omega t + \phi_0),\; t<0.$$ At $t=0$ it has a phase $\phi_0$. Depending on its value the oscillator can be moving forward or backward with some velocity. If you switch your external force on at $t=0$ and onwards, say, to push your particle in a positive direction, then, depending on the particle phase, the force will accelerate or decelerate the particle.

Generally you write down the external force in the same way: $$F_\text{ext}(t)=F_0\cdot \cos(\omega t +\Phi_0).$$ This expression stays in the driven oscillator equation, namely, in the right-hand side. The resonance happens always, i.e., the external force will supply energy to the particle, but this supplying can start immediately if the force direction and the particle velocity direction coincide. Otherwise the external force first slows down the particle and only then starts pumping its amplitude.

The particle velocity phase is shifted with respect to the particle coordinate $$v(t) = -A \sin(\omega t + \phi_0)=A\cos(\omega t + \phi_0 +\pi/2),\; t<0.\;$$ So, when $\Phi_0 =\phi_0 +\pi/2\;$ the force is in phase with velocity (not with coordinate) - you have not only the same direction for the velocity and for the force, but also coincidence of instants when both the velocity and the force become zero (no time intervals with their opposite signs).

EDIT: The permanent phase shift of $\pi/2$ in a resonant case with friction (as described in user17581 answer) is a self-established thing and its meaning is simple - the external force in the end compensates exactly the friction force; the latter being proportional to velocity which is shifted by $\pi/2$ with respect to the coordinate time-dependence (so the oscillator oscillates as if it were free, without losses).

• This answer was the most helpful to me personally but I think the other answer will be most useful to people who come across the question. So the bounty goes to you. – Jonathan. Jan 14 '13 at 12:43

For resonance to occur (at $$\gamma$$=0 and $$\omega=\omega_0$$), the system must be able to absorb all the energy input coming from the external driving force, and this results in incessant growth in the amplitude. For this to happen, the external force, which does not have to be in sine/cosine form, should be positive (pushing forward) while the oscillator is traveling from $$-A$$ (amplitude) to $$+A$$, and the external force should be negative (pulling back) while the oscillator is traveling from $$+A$$ to $$-A$$.

The plot below shows the solution of $$\ddot{x}(t)+\omega_0^2x(t)=f(\omega_0 t)$$ where $$f(\omega t)$$ is a square-wave of which frequency $$\omega$$ here matches the natural frequency of the harmonic oscillator $$\omega_0$$. The amplitude grows in time due to the resonance ($$\omega=\omega_0$$) as expected. One can observe from the plot above that the force is positive while the oscillator is traveling in the forward direction (green shaded region), and the force is negative while the oscillator is traveling in the backward direction (pink shaded region); this leads to a complete absorption of the energy from the driving force.

Now let's have a sine-wave external force instead of a square wave. The result is the same, but this time we can discuss the phase difference between the two sine waves (the amplitude and the external force). From the plot, one can see how $$x(t)$$ and the force have a phase difference of $$\phi=\pi/2$$. In layman terms, the force should be positive (forward) while the oscillator is moving forward, and vice verse. (Note that this statement does not say the force should be positive when the oscillator amplitude is positive.)

Finally, that the phase $$\phi = \arctan \left( \frac{2 \xi \omega \omega_0}{\omega^2 -\omega_0^2} \right)$$ becomes equal to $$\pi/2$$ when $$\omega \rightarrow \omega_0$$ (here $$\omega_0=3$$) and $$\xi \rightarrow 0$$ can be seen from the plot below. For $$\omega \rightarrow \omega_0=3$$, we get $$\phi=\pi/2$$ for all nonzero values of $$\xi$$. When $$\xi=0$$, we get a step function (not shown in the plot), but we can consider $$\phi=\pi/2$$ for any value of $$\xi$$ that is arbitrarily close to zero. Want to see all of these in action? Here's a video from MIT: https://www.youtube.com/watch?v=aZNnwQ8HJHU

Hope all these help.

The reason becomes clear if you sketch the graphs of displacement against time and velocity against time. You'll notice that the displacement time graph is a cosine curve (assuming it starts at max amplitude) and the velocity graph is a sine curve, thus it has been shifted by pi/2 to the right. Therefore, at a phase difference of pi/2 the velocities are in phase which gives max kinetic energy: increasing the amplitude.