Differential equation of SHM

Push a swing, pluck a guitar string, watch a block bob on a spring — very different objects, yet the mathematics governing the small back-and-forth motion is identical in every case. The common ingredient is a restoring force that grows in direct proportion to displacement and always points back toward equilibrium: F=−kxF=-kx. Feed that single fact into Newton's second law and out falls one compact differential equation, x¨+ω02x=0\ddot x+\omega_0^2x=0, whose solution is the cosine wave you already associate with oscillation. This article works through that derivation from scratch — not quoting the result but building it, solving the resulting second-order linear ODE by the auxiliary-equation method, and pinning down what the two constants of integration, amplitude AA and phase ϕ\phi, actually mean physically. This is the mathematical seed of the whole oscillations block: the damped and driven equations you meet next simply bolt extra terms onto the same left-hand side.

The core insight

Newton's second law applied to a linear restoring force F=−kxF=-kx produces the differential equation x¨+ω02x=0\ddot x+\omega_0^2x=0 with ω0=k/m\omega_0=\sqrt{k/m}, whose general solution x(t)=Acos⁡(ω0t+ϕ)x(t)=A\cos(\omega_0t+\phi) describes oscillation at a frequency fixed purely by the system, never by how far it was displaced.

The core idea

Setting up the equation. Consider a particle of mass mm moving along one axis under a Hooke's-law restoring force F(x)=−kxF(x)=-kx, where k>0k>0 and xx is displacement from equilibrium. Newton's second law, F=mx¨F=m\ddot x, converts this force law directly into a statement about acceleration:

mx¨=−kx⟹x¨+ω02x=0,ω0≡km.m\ddot{x} = -kx \quad\Longrightarrow\quad \ddot{x} + \omega_0^2 x = 0, \qquad \omega_0 \equiv \sqrt{\frac{k}{m}} .

where: mm is the mass (kg), x(t)x(t) is displacement from equilibrium (m), kk is the force constant (N/m), and ω0\omega_0 is the natural angular frequency (rad/s). This is a linear, second-order, homogeneous, constant-coefficient ordinary differential equation — the defining equation of SHM, and every system that obeys it is, by definition, undergoing simple harmonic motion.

Reading the solution's shape before deriving it. Because the equation is second-order, its general solution needs exactly two independent constants, fixed by two initial conditions — typically the displacement x(0)x(0) and the velocity x˙(0)\dot x(0) at the start of the clock. The full solve-out is carried in the derivation block below; the punchline is x(t)=Acos⁡(ω0t+ϕ)x(t)=A\cos(\omega_0t+\phi), a cosine wave of fixed amplitude AA and fixed angular frequency ω0\omega_0, merely shifted in time by the phase ϕ\phi.

A second realization: the pendulum. The same equation reappears wherever a linear restoring "force" (or torque) exists. For a simple pendulum of length LL, Newton's second law along the arc gives θ¨=−(g/L)sin⁡θ\ddot\theta=-(g/L)\sin\theta, which is not linear in θ\theta and so is not exact SHM. But for small angular amplitude, sin⁡θ≈θ\sin\theta\approx\theta (radians), collapsing the equation to θ¨+(g/L)θ=0\ddot\theta+(g/L)\theta=0 — precisely the SHM form, with ω02=g/L\omega_0^2=g/L and θ\theta playing the role of xx. This confirms the differential equation is a universal template, not a spring-specific accident.

Figure
Displacement versus time for a mass on a spring tracing a cosine curve of amplitude A and period T
x(t) = A cos(omega0 t + phi) — amplitude fixed, frequency fixed time t displacement x A T = 2 pi / omega0 released from rest, x(0) = A
Derivation ASolving the SHM differential equation

The goal is to start from Hooke's-law force F=−kxF=-kx and Newton's second law and end with the fully justified general solution x(t)=Acos⁡(ω0t+ϕ)x(t)=A\cos(\omega_0t+\phi), deriving both the differential equation and its solution through the auxiliary-equation method rather than quoting the cosine answer, so that the origin of the two free constants AA and ϕ\phi is completely traceable to the two initial conditions of the physical system.

Step 1. Write Newton's second law for the restoring force. With F(x)=−kxF(x)=-kx and F=mx¨F=m\ddot x, substitution gives mx¨=−kxm\ddot x=-kx. Dividing through by mm and defining ω02≡k/m\omega_0^2\equiv k/m produces x¨+ω02x=0\ddot x+\omega_0^2x=0, a linear, homogeneous, second-order ODE with constant coefficients.

Step 2. Propose a trial solution and find the auxiliary equation. Try x(t)=eλtx(t)=e^{\lambda t} for some constant λ\lambda; then x¨=λ2eλt\ddot x=\lambda^2e^{\lambda t}, and substituting into the ODE gives λ2eλt+ω02eλt=0\lambda^2e^{\lambda t}+\omega_0^2e^{\lambda t}=0. Since eλt≠0e^{\lambda t}\neq0, this requires the auxiliary (characteristic) equation λ2+ω02=0\lambda^2+\omega_0^2=0.

Step 3. Solve the auxiliary equation and identify both independent solutions. λ2=−ω02\lambda^2=-\omega_0^2 gives λ=±iω0\lambda=\pm i\omega_0 — purely imaginary roots, with no real part, because the undamped equation has no term proportional to x˙\dot x. The two independent solutions are therefore eiω0te^{i\omega_0t} and e−iω0te^{-i\omega_0t}, and the general solution of a linear ODE is any combination of them, x(t)=c1eiω0t+c2e−iω0tx(t)=c_1e^{i\omega_0t}+c_2e^{-i\omega_0t}.

Step 4. Convert to real form and name the physical constants. Using Euler's formula and demanding x(t)x(t) be real, this combination can always be rewritten as x(t)=C1cos⁡(ω0t)+C2sin⁡(ω0t)x(t)=C_1\cos(\omega_0t)+C_2\sin(\omega_0t), or equivalently in amplitude–phase form,

x(t)=Acos⁡(ω0t+ϕ),x(t) = A\cos(\omega_0 t + \phi),

where AA (amplitude) and ϕ\phi (phase constant) are the two constants of integration. Being a second-order equation, exactly two constants are needed, and they are fixed uniquely by the two initial conditions x(0)x(0) and x˙(0)\dot x(0) — nothing about AA or ϕ\phi is left free once the system's starting state is specified. Crucially, ω0=k/m\omega_0=\sqrt{k/m} never appears among the constants fixed by initial conditions: it is set entirely by the physical system (kk and mm), so the oscillation frequency is independent of how far the system was initially displaced — the defining signature of true SHM.

Worked example

Problem. A block of mass m=0.50m=0.50 kg is attached to a spring of spring constant k=200k=200 N/m and rests on a frictionless horizontal surface. The block is pulled 6.06.0 cm from equilibrium and released from rest at t=0t=0. Find (a) the angular frequency, (b) the period, (c) the position x(t)x(t), and (d) the position at t=0.10t=0.10 s.

Step 1. Find ω0\omega_0 from the physical constants of the system, exactly as the derivation prescribes: ω0=k/m=200/0.50=400=20 rad/s\omega_0=\sqrt{k/m}=\sqrt{200/0.50}=\sqrt{400}=20\ \text{rad/s}. Note this uses only kk and mm — the release distance of 6.06.0 cm has not entered yet, confirming frequency is amplitude-independent.

Step 2. Convert to the period: T=2π/ω0=2π/20≈0.314 sT=2\pi/\omega_0=2\pi/20\approx0.314\ \text{s}.

Step 3. Apply the two initial conditions to fix AA and ϕ\phi in x(t)=Acos⁡(ω0t+ϕ)x(t)=A\cos(\omega_0t+\phi). Here x(0)=0.06x(0)=0.06 m and x˙(0)=0\dot x(0)=0 (released from rest). Differentiating, x˙(t)=−Aω0sin⁡(ω0t+ϕ)\dot x(t)=-A\omega_0\sin(\omega_0t+\phi); setting x˙(0)=0\dot x(0)=0 forces sin⁡ϕ=0\sin\phi=0, so ϕ=0\phi=0 or π\pi. Since x(0)=Acos⁡ϕ=0.06>0x(0)=A\cos\phi=0.06>0, the consistent root is ϕ=0\phi=0, giving A=x(0)=0.06A=x(0)=0.06 m. So

x(t)=0.06cos⁡(20t) m.x(t) = 0.06\cos(20t)\ \text{m}.

Step 4. Evaluate at t=0.10t=0.10 s: the argument is 20×0.10=2.020\times0.10=2.0 rad, and cos⁡(2.0 rad)≈−0.416\cos(2.0\ \text{rad})\approx-0.416, so x(0.10)≈0.06×(−0.416)≈−0.025 mx(0.10)\approx0.06\times(-0.416)\approx-0.025\ \text{m}.

The block sits at x≈−2.5x\approx-2.5 cm at t=0.10t=0.10 s — it has already swung past equilibrium onto the other side of its motion.

Competitive stretch

Swap the spring for a simple pendulum of length L=1.0L=1.0 m near Earth's surface (g=9.8 m/s2g=9.8\ \text{m/s}^2), released from a small angle at rest. By the small-angle result derived above, ω0=g/L=9.8/1.0≈3.13 rad/s\omega_0=\sqrt{g/L}=\sqrt{9.8/1.0}\approx3.13\ \text{rad/s} and T=2π/ω0≈2.01 sT=2\pi/\omega_0\approx2.01\ \text{s} — over six times slower than the stiff spring above, purely because g/Lg/L is smaller than k/mk/m, with the underlying differential equation and solution method unchanged.

Common traps

  • Writing F=−kxF=-kx and jumping straight to x(t)=Acos⁡ω0tx(t)=A\cos\omega_0t without solving the ODE — a complete derivation must pass through the auxiliary equation and identify both independent solutions before combining them, or the origin of AA and ϕ\phi stays mysterious.
  • Believing ω0\omega_0 depends on amplitude AA — for genuine SHM, ω0=k/m\omega_0=\sqrt{k/m} is fixed by the system alone, completely independent of how far it is displaced.
  • Applying the pendulum's small-angle formula ω0=g/L\omega_0=\sqrt{g/L} to large swings, where sin⁡θ≈θ\sin\theta\approx\theta breaks down and the motion is no longer strictly simple harmonic.
  • Guessing the sign or value of ϕ\phi instead of checking it against the actual initial conditions — both roots of sin⁡ϕ=0\sin\phi=0 or cos⁡ϕ=0\cos\phi=0 must be tested against x(0)x(0) and the sign of x˙(0)\dot x(0).

Ask the tutor: if the auxiliary-equation method, the imaginary-roots step, or picking the correct root for ϕ\phi from initial conditions feels shaky, ask the AI tutor to walk through another worked derivation or check your own algebra.

Why do we need the auxiliary equation at all — can't we just guess x equals A cos omega0 t and check it works?

Guessing and checking does confirm that Acos⁡(ω0t)A\cos(\omega_0t) satisfies x¨+ω02x=0\ddot x+\omega_0^2x=0, but it silently throws away information: it hides where the two constants of integration (AA and ϕ\phi, or equivalently a sine term) come from, and it gives no way to be sure you have found the general solution rather than one lucky special case. The auxiliary-equation method proves systematically that e±iω0te^{\pm i\omega_0t} are the only two independent solutions, so any real solution must be some combination of them — that completeness is exactly what a check-by-substitution cannot give you.

Why are the roots of the auxiliary equation imaginary here but real for something like exponential decay?

The sign of the coefficient in front of xx decides this. For SHM, x¨+ω02x=0\ddot x+\omega_0^2x=0 has λ2=−ω02\lambda^2=-\omega_0^2, a negative number, whose square roots are imaginary — that is precisely what produces oscillation rather than growth or decay, since eiω0te^{i\omega_0t} traces a circle in the complex plane, not a drifting exponential. A decay equation like x˙+kx=0\dot x+kx=0 instead has a first-order structure whose root is real and negative, giving e−kte^{-kt}. The imaginary roots here are the mathematical fingerprint of an undamped restoring force.

Since the pendulum equation is only approximately SHM, why does it still get called simple harmonic motion in this course?

Because for the amplitudes this course cares about — a few degrees at most — the approximation sin⁡θ≈θ\sin\theta\approx\theta is excellent, and the resulting equation θ¨+(g/L)θ=0\ddot\theta+(g/L)\theta=0 matches the exact SHM template x¨+ω02x=0\ddot x+\omega_0^2x=0 term for term. The pendulum is therefore SHM in the small-angle limit, not in general; at larger swings the true period grows with amplitude (unlike genuine SHM, where it cannot), which is exactly why this article flags amplitude-independence as a defining test you can use to check whether a system is really undergoing SHM.

Before this

Where this leads