Sub topic 5
The sinusoidal solution
This chapter assumes you know Newton's second law, radians, the derivatives of sine and cosine, and the equation of motion a = −ω²x from the previous chapter. The goal is to show that a sinusoid solves that equation, to say what the constants in the solution mean, and to avoid the usual mistakes when using it.
From the equation to a function
The SHM equation says that the second derivative of position is proportional to the negative of position:
d²x/dt² = −ω²x
You need a function x(t) whose second derivative is the same function, multiplied by −ω². Sine and cosine have this property, because differentiating them twice returns the original function with a sign flip. The ω² factor comes from the chain rule.
Try x(t) = A cos(ωt + φ), where A, ω and φ are constants:
- First derivative: dx/dt = −Aω sin(ωt + φ)
- Second derivative: d²x/dt² = −Aω² cos(ωt + φ)
- Compare: d²x/dt² = −ω² · [A cos(ωt + φ)] = −ω²x
The equation holds for every A and φ, and for the specific ω in the equation. For a mass on a spring, that ω is √(k/m). Because ω is fixed by the physics while A and φ are free, the solution describes a whole family of motions.
What the three constants mean
| Symbol | Name | Unit | Set by |
|---|---|---|---|
| A | Amplitude | m | How far the system is displaced at the start |
| ω | Angular frequency | rad/s | The physics (k and m, or g and L) |
| φ | Phase constant | rad | When you start the clock |
The cosine oscillates between −1 and +1, so x stays between −A and +A. Amplitude is the maximum displacement from equilibrium. It is not the peak-to-peak distance, which is 2A.
The cosine repeats when its argument increases by 2π. If the time changes by T, the argument changes by ωT, so ωT = 2π and:
T = 2π/ω, f = 1/T = ω/(2π)
You can use the same relationships to convert between ω, f and T in any problem.
Why two constants
The SHM equation is a second-order differential equation, so its general solution has two independent constants. In A cos(ωt + φ) these are A and φ. Specifying both the starting position and the starting velocity fixes them, and then the motion is determined for all time. Starting position alone leaves the velocity free, so it does not determine the motion.
Equivalent forms
Several forms of the solution appear in textbooks. They are the same function written differently.
| Form | Constants |
|---|---|
| x = A cos(ωt + φ) | A, φ |
| x = A sin(ωt + φ′) | A, φ′ = φ + π/2 |
| x = a cos ωt + b sin ωt | a, b |
Expanding the cosine with the angle-sum identity gives:
A cos(ωt + φ) = A cos φ · cos ωt − A sin φ · sin ωt
Matching coefficients with the third form gives a = A cos φ and b = −A sin φ. Going the other way:
- A = √(a² + b²)
- φ = atan2(−b, a)
The third form is convenient because the constants map directly onto initial conditions. At t = 0, x(0) = a. The velocity is v = −aω sin ωt + bω cos ωt, so v(0) = bω. This gives a = x₀ and b = v₀/ω.
Use atan2 rather than a plain arctangent. A plain arctangent cannot tell (a, b) from (−a, −b), so it returns the wrong quadrant for half of all inputs.
Worked example: from initial conditions to amplitude and phase
A 0.5 kg mass on a 20 N/m spring is released from x₀ = 0.05 m with velocity v₀ = 0.3 m/s. Find A and φ.
First, ω = √(20/0.5) = 6.325 rad/s. Then a = 0.05 m and b = 0.3/6.325 = 0.0474 m. The amplitude is A = √(0.05² + 0.0474²) ≈ 0.0689 m. The phase is φ = atan2(−0.0474, 0.05) ≈ −0.759 rad.
The amplitude, 0.0689 m, is larger than the 0.05 m starting displacement. The mass was already moving when released, so it travels past its starting point before turning around. The code below confirms the result.
import math
k, m = 20.0, 0.5
x0, v0 = 0.05, 0.3
omega = math.sqrt(k / m)
a = x0
b = v0 / omega
A = math.hypot(a, b)
phi = math.atan2(-b, a)
print(f"omega = {omega:.3f} rad/s")
print(f"A = {A:.4f} m, phi = {phi:.3f} rad")
# check that the single-cosine form reproduces x(0) and v(0)
x_check = A * math.cos(phi)
v_check = -A * omega * math.sin(phi)
print(f"x(0) = {x_check:.4f} m, v(0) = {v_check:.4f} m/s")The last line should print x(0) = 0.0500 m and v(0) = 0.3000 m/s, matching the initial conditions.
Checking a solution numerically
You can test whether any candidate function satisfies a = −ω²x without doing calculus by hand. Estimate the second derivative with a central finite difference and compare it with −ω²x:
d²x/dt² ≈ [x(t + h) − 2x(t) + x(t − h)] / h²
import math
k, m = 20.0, 0.5
omega = math.sqrt(k / m)
A, phi = 0.10, 0.4
def x(t):
return A * math.cos(omega * t + phi)
h = 1e-4
worst = 0.0
for i in range(200):
t = i * 0.01
second = (x(t + h) - 2 * x(t) + x(t - h)) / h**2
residual = abs(second + omega**2 * x(t))
worst = max(worst, residual)
print(f"largest residual |x'' + omega^2 x| = {worst:.2e}")
print(f"for scale, omega^2 * A = {omega**2 * A:.2f}")The residual should come out many orders of magnitude below the scale value of about 4. It is not exactly zero because finite differences carry a small truncation and rounding error. Replace x with A * math.cos(omega * t) ** 2 and the residual becomes large. That function is periodic, but it does not satisfy the equation.
Common errors
- Calculator in degree mode. The argument ωt + φ is in radians. In degree mode, cos(6.325 × 1) is evaluated as 6.325 degrees, and every answer is wrong.
- Mixing up ω and f. Plugging f into the cosine in place of ω gives a motion that is too slow by a factor of 2π.
- Treating A as fixed by the spring. The amplitude depends on how the system was started. Only ω comes from k and m. Doubling the amplitude does not change the period.
- Forgetting the sign in φ. With the cosine form, a mass released from rest at x = +A has φ = 0. A mass released from rest at x = −A has φ = π. Mixing these up flips the whole motion.
- Using a plain arctangent for φ. The result may land in the wrong quadrant, which shows up as a motion that starts moving the wrong way.
- Applying the solution outside its range. The solution holds only while the restoring force is proportional to displacement. A spring stretched beyond its elastic limit, or a pendulum at large angles, does not follow it. Later chapters treat these cases.
Exercise
A 2.0 kg mass on a spring with k = 50 N/m is released from rest at x = +0.12 m. (a) Write x(t) in the form A cos(ωt + φ) with numerical values. (b) At what time does the mass first reach x = 0?
Show answer
(a) ω = √(50/2.0) = 5.0 rad/s. Released from rest at +0.12 m, so A = 0.12 m and φ = 0. Therefore x(t) = 0.12 cos(5.0t) m. (b) x = 0 when cos(5.0t) = 0, so 5.0t = π/2 and t = π/10 ≈ 0.314 s. This is a quarter of the period, T = 2π/5.0 ≈ 1.257 s, as expected for travel from the extreme to the equilibrium point.
Exercise
A student writes x(t) = 0.08 cos(4t) and says the motion has frequency 4 Hz. What is the actual frequency and period, and what error was made?
Show answer
The 4 is the angular frequency ω in rad/s, not f. The frequency is f = ω/(2π) = 4/(2π) ≈ 0.64 Hz, and the period is T = 2π/4 ≈ 1.57 s. The student confused ω with f.