# Phase difference of driving frequency and oscillating frequency

If 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's 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?

-
The answer to this question is addressed here: thiscondensedlife.wordpress.com/2016/05/02/… – Xcheckr yesterday

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