Skip to main content

Physics I course sequence · Interactive lesson

The SHM Differential Equation

Every simple harmonic oscillator in this course is recognised by one line: acceleration equals minus a positive constant times displacement. Here you write that line from the force law, test a sinusoid against it, read the angular frequency off the constant, and pin down amplitude and phase from how the motion was started.

UPI-14.02 · Lesson 2 of 8 in this unit. Position is not a completion score.
Starting model: The SHM Differential Equationx against t over 2.0 s for a 0.50 kg block on a 32 N m⁻¹ spring, ω = 8.00 rad s⁻¹. The solid curve is x₀ cos ωt + (v₀/ω) sin ωt; the dashed curves are those two parts, with coefficients C₁ = 3.0 cm and C₂ = -4.00 cm. The dot and arrow show x₀ and the starting slope v₀. Dashed horizontals mark ±A = 5.00 cm; the open circle is the first maximum.C₁ = x₀ = 3.0 cm; C₂ = v₀/ω = −4.00 cmsolid: x(t); dashed: its cos and sin partsx+A−At = 0T = 2π/ω = 0.785 s2.0 s
Start with a picture. Change the model in the lab below.
1

Build the model

The equation sets the frequency; the launch sets amplitude and phase.

The key idea

The SHM differential equation, d²x/dt² = −ω²x, says the acceleration is always proportional to the displacement from equilibrium and directed back toward it; every solution is a sinusoid of angular frequency ω whose two constants are set by the initial position and velocity.

Example. A 0.300 kg glider on a 14.7 N m⁻¹ spring obeys d²x/dt² = −49.0x in SI units, so ω = 7.00 rad s⁻¹ and T = 2π/7.00 = 0.898 s, whether it was pulled back 1 cm or 10 cm before release.

The complete physical model and assumptions

Put a block on a spring, measure x from the point where the net force vanishes, and Hooke's law gives F = −kx. Newton's second law then reads m d²x/dt² = −kx. That is not a formula for x but a demand on the whole function x(t): at every instant its second derivative must equal −(k/m) times its own value. The functions that return as a negative multiple of themselves after two differentiations are sines and cosines, and substituting x = cos ωt shows the demand is met only when ω² = k/m. So the equation itself sets the angular frequency, and with it the period 2π√(m/k), from stiffness and inertia alone. It cannot set the size or the timing of the motion, because the equation is linear: any multiple of a solution, and any sum of two, is again a solution. Being second order, it leaves exactly two constants open, C₁ and C₂ in x = C₁ cos ωt + C₂ sin ωt, or equally A and φ in x = A cos(ωt + φ), and the position and velocity at one instant are precisely the two facts that close them. All of this holds only while the net force is strictly proportional to displacement. Overstretch the spring or swing a pendulum wide and the equation gains terms that are not linear in x; then the frequency depends on amplitude and solutions no longer add. Let drag act and a velocity term appears, so the swings die away. In either case the pure sinusoid is at best an approximation.

1From a force law to an equation for a function

Choose the origin where the net force on the block is zero and call the displacement x. Hooke's law gives the spring force as −kx: its size grows in proportion to x, and the minus sign makes it point back toward the origin on either side. Newton's second law turns that into m d²x/dt² = −kx, and dividing by m gives d²x/dt² = −(k/m)x. For a 0.300 kg glider on a 14.7 N m⁻¹ spring, k/m = 49.0 s⁻²; the unit is right, because N m⁻¹ ÷ kg = s⁻². Read the equation as an instruction: at x = +0.020 m the acceleration is −0.98 m s⁻², at x = −0.020 m it is +0.98 m s⁻², and at x = 0 it vanishes. The unknown here is not a number but the entire history x(t), and the equation constrains it at every instant. Three labels describe it. It is second order, since the highest derivative is the second. It is linear, since x and its derivatives appear only to the first power. It is homogeneous, since every term contains x. Each label has a consequence below.

2Guess, differentiate, substitute

The most direct way to solve an equation like this one is to propose a function and test it. We need a function whose second derivative is a negative multiple of itself. A polynomial cannot do it: t² differentiates twice to the constant 2, never to −49.0t². A real exponential cannot either: x = e(λt) has second derivative λ²x, and λ² = −49.0 s⁻² has no real solution. That is the minus sign speaking; with a plus sign the exponentials would work and the block would run away. Try x = cos(pt) with p unknown. Then dx/dt = −p sin(pt) and d²x/dt² = −p² cos(pt), so the equation demands −p² cos(pt) = −49.0 cos(pt) at every t. The cosine cancels and leaves p² = 49.0 s⁻², so p = 7.00 rad s⁻¹. The same test passes sin(7.00t) and fails any other positive p. Define ω = √(k/m). Notice what cancelled: had the trial been 5 cos(pt) or 0.01 cos(pt), the factor in front would have dropped out too. The equation fixes how fast the argument of the cosine advances, and says nothing about how big the motion is.

3Why there are exactly two free constants

Because the equation is linear and homogeneous, solutions can be scaled and added. If x₁ and x₂ each satisfy d²x/dt² = −ω²x, then for C₁x₁ + C₂x₂ the second derivative is C₁(−ω²x₁) + C₂(−ω²x₂) = −ω²(C₁x₁ + C₂x₂), so the combination satisfies it as well. Taking x₁ = cos ωt and x₂ = sin ωt gives the family x(t) = C₁ cos ωt + C₂ sin ωt. That this family is complete reflects the order of the equation: recovering x from its second derivative takes two integrations, and each leaves one constant undetermined. You have met this before. For constant acceleration, d²x/dt² = a integrates to x = x₀ + v₀t + ½at², and the two constants are the initial position and velocity. The oscillator is the same story with a different right-hand side. Newton's second law fixes accelerations, so a motion is determined only when a position and a velocity at one instant are supplied, and then it is determined uniquely: two oscillators with the same ω, x₀ and v₀ move identically for all time.

4The initial state fixes C₁ and C₂

Put t = 0 into x = C₁ cos ωt + C₂ sin ωt. The sine vanishes and the cosine is 1, so C₁ = x₀. Differentiate to get v = −ωC₁ sin ωt + ωC₂ cos ωt and put t = 0 again: v₀ = ωC₂, so C₂ = v₀/ω. Two pure cases are worth recognising on sight. A block pulled aside and released from rest has v₀ = 0, so x = x₀ cos ωt. A block struck while it sits at equilibrium has x₀ = 0, so x = (v₀/ω) sin ωt, and the combination v₀/ω is a length: the distance that launch speed carries it. A general start mixes the two. Give the glider with ω = 7.00 rad s⁻¹ the start x₀ = +0.024 m, v₀ = −0.49 m s⁻¹. Then C₁ = 0.024 m and C₂ = −0.49/7.00 = −0.070 m, so x(t) = 0.024 cos(7.00t) − 0.070 sin(7.00t) in metres. Check it against the equation at t = 0: differentiating twice gives a(0) = −49.0 × 0.024 = −1.18 m s⁻², which is exactly −(k/m)x₀.

5One sinusoid: amplitude and phase constant

A sum of a cosine and a sine of the same ω is a single shifted cosine. Expand A cos(ωt + φ) = A cos φ cos ωt − A sin φ sin ωt and match terms: C₁ = A cos φ and C₂ = −A sin φ. Squaring and adding gives A = √(C₁² + C₂²). For the glider, A = √(0.024² + 0.070²) = 0.074 m, about three times the starting displacement, because most of the motion came from the launch speed. Then cos φ = 0.024/0.074 = 0.324 and sin φ = +0.070/0.074 = 0.946, both positive, so φ = 1.24 rad and x(t) = 0.074 cos(7.00t + 1.24). Use both signs. The shortcut tan φ = −v₀/(ωx₀) cannot tell φ from φ + π, which is a block on the other side of equilibrium moving the other way. The phase constant is a statement about timing. The maximum belongs to phase zero, which here occurred at t = −φ/ω = −0.177 s, before the clock started; the next one comes when the phase reaches 2π, at t = (2π − 1.24)/7.00 = 0.720 s. The gap between them is T = 0.898 s.

6Recognise the form, and test whether it applies

The mathematics never used the word spring. Any coordinate q obeying d²q/dt² = −(positive constant) × q moves sinusoidally with ω² equal to that constant. For small swings a pendulum of length 0.500 m obeys d²θ/dt² = −(g/L)θ = −19.6θ, so ω = 4.43 rad s⁻¹ without any further work; later topics derive such equations, and this one tells you what to do once you have them. A constant extra force adds a term without x, so the equation stops being homogeneous, but the cure is simple. The constant only moves the equilibrium point, and measuring x from the new equilibrium restores d²x/dt² = −ω²x with the same ω. What does spoil the form is a force whose graph against x is not a straight line, or one that depends on velocity. A drag force adds a term in dx/dt. A spring that stiffens as it stretches adds a term in x³, and then doubling a solution no longer gives a solution, so the period starts to depend on amplitude. That suggests the experimental test of the model: time the oscillation at two quite different amplitudes. Equal periods support F = −kx over that range; a period that drifts with amplitude falsifies it.

2

Key equations

Read the units, assumptions and limits before substituting.

Equation of motion from Hooke's law

m d²x/dt² = −kx ⇒ d²x/dt² = −ω²xω² = k/m

Whatever the system, once its equation has this form the positive coefficient of x is ω², and the motion is simple harmonic.

x in m from equilibrium, t in s, m in kg, k in N m⁻¹; ω² in s⁻², since N m⁻¹ ÷ kg = s⁻²

General solution

x(t) = C₁ cos ωt + C₂ sin ωt

Linear, so solutions add; second order, so exactly two constants are free. No other function satisfies the equation.

C₁ and C₂ in m, ω in rad s⁻¹, ωt in rad; valid for any pair of constants

Constants from the initial state

C₁ = x₀C₂ = v₀/ω

Set t = 0 in x and in v: position fixes the cosine part, velocity divided by ω fixes the sine part.

x₀ in m and v₀ in m s⁻¹, both at t = 0; from v = −ωC₁ sin ωt + ωC₂ cos ωt

Amplitude–phase form

x(t) = A cos(ωt + φ)A = √(x₀² + (v₀/ω)²)

The same family written as one sinusoid. A is the largest displacement, and it exceeds |x₀| whenever v₀ is not zero.

A in m, φ in rad; C₁ = A cos φ and C₂ = −A sin φ

Phase constant, with its quadrant

cos φ = x₀/Asin φ = −v₀/(ωA)

Use both signs. For φ between 0 and π the velocity at t = 0 is negative, and the last maximum came a time φ/ω before the clock started.

φ in rad; tan φ = −v₀/(ωx₀) alone leaves φ uncertain by π

Period and frequency

T = 2π/ω = 2π√(m/k)f = 1/T = ω/(2π)

The motion repeats when the phase ωt + φ has advanced by 2π, so every solution of one equation keeps the same time.

T in s, f in Hz, ω in rad s⁻¹; A and φ do not appear
3

Interactive lab

Predict first. Explore the model. Compare the result.

Explore the model

3 cm
−8 to 8 cm; steps of 1.
−32 cm s⁻¹
−40 to 40 cm s⁻¹; steps of 4.
32 N m⁻¹
8 to 50 N m⁻¹; steps of 2.

Try this. Set v₀ to 0: the sine part vanishes, A equals x₀ and the maximum sits at t = 0. Restore v₀ = −32 cm s⁻¹: A grows to 5 cm and the first maximum waits most of a period, because the block heads inward first. Then raise k to 50 N m⁻¹: the start is unchanged, yet A shrinks, because C₂ = v₀/ω does.

Live results

ω = √(k/m)
8.00 rad s⁻¹
AMPLITUDE A
5.00 cm
PHASE CONSTANT φ
0.93 rad
FIRST MAXIMUM AT t
0.669 s

Results follow this lesson’s model and assumptions. Displayed values are rounded.

Interactive Physics I modelx against t over 2.0 s for a 0.50 kg block on a 32 N m⁻¹ spring, ω = 8.00 rad s⁻¹. The solid curve is x₀ cos ωt + (v₀/ω) sin ωt; the dashed curves are those two parts, with coefficients C₁ = 3.0 cm and C₂ = -4.00 cm. The dot and arrow show x₀ and the starting slope v₀. Dashed horizontals mark ±A = 5.00 cm; the open circle is the first maximum.C₁ = x₀ = 3.0 cm; C₂ = v₀/ω = −4.00 cmsolid: x(t); dashed: its cos and sin partsx+A−At = 0T = 2π/ω = 0.785 s2.0 s
x against t over 2.0 s for a 0.50 kg block on a 32 N m⁻¹ spring, ω = 8.00 rad s⁻¹. The solid curve is x₀ cos ωt + (v₀/ω) sin ωt; the dashed curves are those two parts, with coefficients C₁ = 3.0 cm and C₂ = −4.00 cm. The dot and arrow show x₀ and the starting slope v₀. Dashed horizontals mark ±A = 5.00 cm; the open circle is the first maximum.

Predict → change one variable → check

Plan a change before running it. Every other input stays at the saved baseline.

Saved baseline. Initial position x₀: 3 cm; Initial velocity v₀: −32 cm s⁻¹; Stiffness k (m = 0.50 kg): 32 N m⁻¹

Baseline 3; choose −8 to 8, in steps of 1.
4. Compared with the saved baseline, this result will…

This experiment is kept only while this page is open. It does not change saved course progress.

4

Catch the common trap

Many students carry x = A cos ωt around as the solution, and then handle initial conditions by setting A = x₀. That is one member of the family, the one that starts from rest at a turning point, and using it quietly assumes v₀ = 0. If the block is moving at t = 0 the starting displacement is not the amplitude. A glider with ω = 7.00 rad s⁻¹ that starts at x₀ = 0.024 m with v₀ = −0.49 m s⁻¹ reaches A = √(0.024² + 0.070²) = 0.074 m, about three times x₀, and a block struck at equilibrium has x₀ = 0 yet certainly oscillates, with A = |v₀|/ω. A second-order equation needs two pieces of starting information, so an answer with only one adjustable constant cannot be general. Keep both C₁ and C₂, or both A and φ, until x₀ and v₀ have each been used once.

5

Practice & worked examples

3 authored examples. Make an attempt, then reveal the reasoning one step at a time.

EasyExample 1

A 0.150 kg puck on a frictionless table is attached to a spring of stiffness 5.40 N m⁻¹. Write its equation of motion, find ω and the period, and test two proposed solutions by substitution: x = 0.020 sin(6.00t) and x = 0.020 sin(36.0t), with x in metres and t in seconds.

Sketch your answer or reasoning, then compare it with the authored solution. Your writing is not automatically graded or saved.

0 of 4 steps revealed.

MediumExample 2

A 0.800 kg block on a 20.0 N m⁻¹ spring slides on a frictionless surface. At t = 0 it is at x₀ = +0.060 m and moving outward at v₀ = +0.40 m s⁻¹. Find C₁ and C₂ in x = C₁ cos ωt + C₂ sin ωt, rewrite the motion as A cos(ωt + φ), and find the time at which the block first comes to rest.

Sketch your answer or reasoning, then compare it with the authored solution. Your writing is not automatically graded or saved.

0 of 5 steps revealed.

HardExample 3

A 0.500 kg glider on an air track is tied to the left-hand post by a spring of stiffness 5.0 N m⁻¹ and to the right-hand post by one of 7.5 N m⁻¹. Both springs are stretched when the glider rests at x = 0, and stay stretched throughout. At t = 0 the glider is at x₀ = −0.036 m, moving at v₀ = −0.075 m s⁻¹. Derive its equation of motion, write x(t) as A cos(ωt + φ), and find when it first passes through x = 0.

Sketch your answer or reasoning, then compare it with the authored solution. Your writing is not automatically graded or saved.

0 of 5 steps revealed.

6

Quick check

Select an answer and explain it before checking.

A cart on a spring obeys d²x/dt² = −16x, with x in metres and t in seconds. At t = 0 it passes through x = 0 moving in the −x direction at 0.20 m s⁻¹. Which function describes its motion?
7

Review & continue

The SHM differential equation, d²x/dt² = −ω²x, says the acceleration is always proportional to the displacement from equilibrium and directed back toward it; every solution is a sinusoid of angular frequency ω whose two constants are set by the initial position and velocity.

  • Explain the relationship without looking at the equation.
  • Check a sign, a unit and a model assumption in your working.
  • Return to the lab or worked example if a step is still unclear.

Optional supporting lessons

These chapter resources can help with earlier ideas; they are not additional required Physics I completion tasks.

Extra challenging questions

Connect several ideas, explore supplied data, and compare your reasoning with a worked solution.