Simple way to derive the equation of simple harmonic motion

Why this exists

In the physics lecture I attended in my university, the professor said he would begin from the necessary condition F=−kxF = -kx for simple harmonic motion and solve the differential equation, giving us x=A sin⁡(ω t)x = A\,\sin(\omega\,t). His approach was fine, but there were some things missing in his solution that left me unsatified::

  1. He solved it assuming that, for t0=0,x0=0t_0=0, x_0=0, meaning he solved a special case and didn't get a general solution.
  2. He did say that he chose the constant AA so that it doesn't violate the previous equation, but he didn't go that much in depth.
  3. He more-or-less said that the ±s which we will see later cancelled out, but he didn't go that much in depth.
  4. There was a point where the same cosine is at both sides of an equation and he cancelled them out, but didn't justify why that's fine, considering that these cosines might as well be equal to zero

Truth be told, I am studying engineering, and a couple of my professors have told my class that we don't have to prove things as rigously as mathematicians; this is their job, not our.

Nevertheless, here is my attempt at covering these gaps. I did use mathematical concepts I don't quite understand (or have properly learned) in some points, but overall, even if this isn't an accepted solution, it should be good enough to show someone why the solution to the equation is what it is.

And yes, this is more-or-less an excuse to mess with LaTeX\LaTeX.

Solution

Let there be a body moving along the x-axis, such that for t0=0t_0 = 0, x=x0x = x_0, and U=u0U = u_0, and upon which the total force exerted is:

F=−kxma=−kxa=−kmxdudt=−kmxdudxdxdt=−kmx\begin{aligned} F &= -kx \\ ma &= -kx \\ a &= -\frac{k}{m}x \\ \frac{du}{dt} &= -\frac{k}{m}x \\ \frac{du}{dx}\frac{dx}{dt} &= -\frac{k}{m}x \end{aligned}

And since dxdt=u\frac{dx}{dt} = u:

dudxu=−kmxu du=−kmx dx∫u0uu du=∫x0x−kmx dx12(u2−u02)=−12km(x2−x02)(1)dxdt=±u02−km(x2−x02)(2)\begin{aligned} \frac{du}{dx}u &= -\frac{k}{m}x \\ u\,du &= -\frac{k}{m}x\,dx \\ \int_{u_0}^{u} u\,du &= \int_{x_0}^{x} -\frac{k}{m}x\,dx \\ \frac{1}{2}(u^2 - u_0^2) &= -\frac{1}{2}\frac{k}{m}(x^2 - x_0^2) \quad (1) \\ \frac{dx}{dt} &= \pm\sqrt{u_0^2 - \frac{k}{m}(x^2 - x_0^2)} \quad (2) \end{aligned}

We substitute x=Asin⁡θx = A\sin\theta, and by differentiating we get dx=Acos⁡θ dθdx = A\cos\theta\,d\theta.

Then, (2) becomes:

Acos⁡θ dθdt=±u02−km(A2sin⁡2θ−x02)(3)\frac{A\cos\theta\,d\theta}{dt} = \pm\sqrt{u_0^2 - \frac{k}{m}(A^2\sin^2\theta - x_0^2)} \quad (3)

To continue further, we need to set AA so that we can write that square root in
the form B1−sin⁡2θB\sqrt{1 - \sin^2\theta}:

B1−sin⁡2θ=±u02−km(A2sin⁡2θ−x02)B2(1−sin⁡2θ)=u02−km(A2sin⁡2θ−x02)B2−B2sin⁡2θ=u02+kmx02−kmA2sin⁡2θ\begin{aligned} B\sqrt{1 - \sin^2\theta} &= \pm\sqrt{u_0^2 - \frac{k}{m}(A^2\sin^2\theta - x_0^2)} \\ B^2(1 - \sin^2\theta) &= u_0^2 - \frac{k}{m}(A^2\sin^2\theta - x_0^2) \\ B^2 - B^2\sin^2\theta &= u_0^2 + \frac{k}{m}x_0^2 - \frac{k}{m}A^2\sin^2\theta \end{aligned}

Comparing both sides gives:

{B2=u02+kmx02B2=kmA2\begin{cases} B^2 = u_0^2 + \frac{k}{m}x_0^2 \\ B^2 = \frac{k}{m}A^2 \end{cases}

A2=mku02+x02\gdef\Asqr{\frac{m}{k}u_0^2 + x_0^2} A^2 = \Asqr

We will pick AA such that it is positive, so we get:

A=mku02+x02A = \sqrt{\Asqr}

Equation (3) becomes:

Acos⁡θ dθdt=±(u02+kmx02)(1−sin⁡2θ)Acos⁡θ dθdt=±u02+kmx02(±cos⁡θ)\begin{aligned} \gdef\Csqr{u_0^2+\frac{k}{m}x_0^2} \frac{A\cos\theta\,d\theta}{dt} &= \pm\sqrt{(\Csqr)(1 - \sin^2\theta)} \\ \frac{A\cos\theta\,d\theta}{dt} &= \pm\sqrt{\Csqr}(\pm \cos\theta) \end{aligned}

Since we picked AA to be positive, and with C=u02+kmx02C=\sqrt{\Csqr}, this simplifies to:

Acos⁡θ dθ=Ccos⁡θ dtA\cos\theta\,d\theta = C\cos\theta\,dt

For cos⁡θ≠0\cos\theta \neq 0, we get:

A dθ=C dtA\,d\theta = C\,dt

Since cos⁡θ≠0\cos\theta \neq 0 almost everywhere, we can integrate per Lebesgue (or at least so I think. If you think I am wrong, contact me):

∫θ0θA dθ=∫0tC dt(θ−θ0)mku02+x02=C tθ=Cmku02+x02t+θ0\begin{aligned} \int_{\theta_0}^{\theta} A\,d\theta &= \int_{0}^{t} C\,dt \\ (\theta - \theta_0)\sqrt{\Asqr} &= C\,t \\ \theta &= \frac{C}{\sqrt{\Asqr}}t + \theta_0 \end{aligned}

However, the term in from of tt simplifies to:

u02+kmx02mku02+x02=km(mku02+x02)mku02+x02=km\sqrt{\frac{\Csqr}{\Asqr}} = \\ \def\comterm{\frac{m}{k}u_0^2+x_0^2} \sqrt{\frac{\frac{k}{m}(\comterm)}{\comterm}} = \sqrt{\frac{k}{m}} \gdef\angle{\sqrt{\frac{k}{m}}t+\theta_0}

And we get:

x=(mku02+x02) sin⁡(kmt+θ0)x = \left(\sqrt{\Asqr}\right)\,\sin(\angle)

Comparing this with the standard form of the simple harmonic motion equation:

x=Asin⁡(ωt+ϕ0)(4)x = A\sin(\omega t + \phi_0) \quad (4)

We get that:

amplitude: A=mku02+x02angular velocity: ω=kminitial phase: ϕ0=arcsin⁡x0A, (4) for t=t0=0,x=x0\begin{aligned} \text{amplitude:}\,A &= \sqrt{\Asqr} \\ \text{angular velocity:}\,\omega &= \sqrt{\frac{k}{m}} \\ \text{initial phase:}\,\phi_0 &= \arcsin\frac{x_0}{A}, \,(4)\,\text{for}\,t=t_0=0, x=x_0 \end{aligned}

Note

We have solved for the case where for x0=0x_0 = 0, the body is at equilibrium (F=−kx0↔F=0F = -k x_0 \harr F = 0). If that wasn't the case and the point of equilibrium was at another point for x=x1x = x_1, we could either change our point of reference so that x0=0x_0 = 0, or solve the whole equation again for that case.

Either way, the solution would be:

x=x1+Asin⁡(ωt+ϕ0)x = x_1 + A\sin(\omega t + \phi_0)