# When to use sine or cosine when computing simple harmonic motion

For simple harmonic motion (SHM), I am aware you can start of using either sine or cosine, but I am a bit confused as to when you would start off with sine rather than cosine. I know that a sine graph starts at $$y=0$$ and a cosine graph starts at $$y=1$$. So therefore, I would say you use sine for equilibrium positions?

However, I came across a question asking to write down the equations for position, velocity and acceleration of a particle starting from rest at time $$t=0$$, then undergoing SHM with maximum amplitude 0.2 m and period 5 sec.

I worked out the angular frequency to be $$2\pi/5$$ from the period formula. And then used the position formula to be of the form with sine and differentiated to get cosine velocity equation, etc. However, the answer says I should have started with cosine and I am now unsure when I should start with sine or cosine.

• Either answer is correct. If you would normally use sin and you used cos, there should be a phase correction of 90 deg in your cos argument. – David White Nov 30 '18 at 16:06

The function $$x(t) = A \sin \omega t$$ starts from zero with maximum speed, while the function $$x(t) = A \cos \omega t$$ starts from $$x=A$$ (the amplitude) with zero speed, and starts to move towards $$x=0$$. Starting from rest doesn't imply starting at the equilibrium position: if you start from rest at $$x=0$$, nothing moves, so this is not an interesting solution! For a harmonic oscillator, starting from rest means starting at the maximum value of $$x$$, so $$\cos \omega t$$ is the appropriate solution.

"a particle starting from rest at time t=o" This is the key to why you start with cosine. So you know that instantaneous velocity is the derivative at that point. Look at a sine graph at t=0 there is a positive gradient thus the particle doesn't start at rest with sine. But with cosine at t = 0 the gradient is zero thus the particle is initially at rest.

Since the return force in general can be taken to be $$F(x)=-kx$$, Newton's second law renders the following differential equation: $$-kx=m\frac{d^2x}{dt^2}$$ whence $$\boxed{\frac{d^2x}{dt^2}+\omega^2x=0}$$ where I substituted $$\omega\equiv \sqrt{k/m}$$.

A solution to this equation in its most general form is $$x=A\sin\omega t +B\cos\omega t$$ where $$A,B$$ are constants. A so-called initial condition such as $$x(t=0)=0$$ will rule out the cosine solution, since $$x(0)=B=0$$ according to the condition. Another one such as $$x'(0)=a$$ (meaning the velocity be $$v=x'(t)=a$$ at $$t=0$$) would then give you $$A=a/\omega$$ which completely determines $$x(t)$$ as $$\boxed{x(t)=(a/\omega)\sin\omega t}$$

Of course, these initial conditions can't be chosen arbitrarily for a specific problem. They're always "imposed" by the problem itself.

Two completely equivalent general solutions, however, are $$x_1(t)=A\cos(\omega t+\phi_1)$$ and $$x_2(t)=B\cos(\omega t+\phi_2)$$ where $$\phi$$ is called a phase constant. These can be taken to be separate general solutions to the problem - they don't need to be added! Initial conditions will determine the two constants $$A$$ and $$\phi_1$$ or $$B$$ and $$\phi_2$$.

For example, take $$x_1(t)=A\cos(\omega t+\phi_1)$$. $$x_1(0)=0$$ renders $$A\cos\phi_1=0$$. Setting $$A=0$$ would be boring, because then $$x_1(t)$$ would simply be zero. Thus, we need $$\phi_1$$ to be any odd multiple of $$\pi/2$$, since that's where the cosine vanishes. $$\phi=\pi/2$$ will do the job. $$x_1'(0)=a$$ would give you $$-A\omega\sin(\pi/2)=a,$$ whence $$A=-a/\omega$$. The solution to our problem then becomes $$\boxed{x(t)=(-a/\omega)\cos(\omega t + \pi/2)}$$ where I dropped the subscript one. This is completely equivalent to $$x(t)=(a/\omega)\sin\omega t$$, since $$\cos(\omega t+\pi/2)=\cos(\pi/2 -(-\omega t))=\sin(-\omega t)=-\sin\omega t.$$ Plugging this into our second solution $$x(t)=(-a/\omega)\cos(\omega t + \pi/2),$$ we again get $$x(t)=(a/\omega)\sin\omega t.$$

This should demonstrate that when done carefully, any two different mathematical approaches to the same problem must render the same solution.