This page is a worked-example machine for the solution $x=A\cos(\omega t+\phi)$ . The equation is solved once; the art is in choosing the two constants A (amplitude) and ϕ (phase) correctly for whatever starting state you are handed. Every possible starting state — sign of position, sign of velocity, starting at the wall, starting at the centre, zero everything — gets its own worked cell below.
Intuition What we are actually doing every single time
The physics fixes ω (a number set by the spring, pendulum, etc.). The starting snapshot — where the particle is (x 0 ) and how fast and which way it moves (v 0 ) — fixes the shape of the cosine curve on the time axis. Two facts in, two constants out. That's the whole game. Master the four quadrants of ϕ once and no problem can surprise you.
Before symbols do any work, recall the two master formulas (both derived in the parent note, never guessed):
tan ϕ = − v 0 / ( ω x 0 ) works for every start."
Why it feels right: it's the one formula for ϕ . The fix: it divides by x 0 , so it is undefined when x 0 = 0 (starting at the centre). In that case skip it entirely and use the direct rule cos ϕ = 0 ⇒ ϕ = ± π /2 , choosing the sign from v 0 (see Examples 3 and 4).
At t = 0 our solution and its derivative read:
x 0 = A cos ϕ , v 0 = − A ω sin ϕ .
Since A > 0 and ω > 0 :
ϕ from the starting snapshot
cos ϕ has the same sign as x 0 (are you starting on the + side or − side?).
sin ϕ has the opposite sign to v 0 (moving right ⇒ sin ϕ < 0 ).
Two signs ⇒ exactly one quadrant of ϕ . No ambiguity ever remains.
The picture above is the phase compass: pin cos ϕ 's sign (left/right) and sin ϕ 's sign (up/down) and the arrow lands in one quadrant. Refer back to it in every example.
Every SHM "find x ( t ) " problem is one of these cells. The Example that covers each cell is named. The four nonzero sign combinations of ( x 0 , v 0 ) are all present (Cells E, F, G, K).
Cell
Starting position x 0
Starting velocity v 0
Which quadrant is ϕ ?
Covered by
A
+ A (at wall)
0 (released from rest)
ϕ = 0
Ex 1
B
− A (at far wall)
0
ϕ = π
Ex 2
C
0 (centre)
+ (moving right)
ϕ = − π /2
Ex 3
D
0 (centre)
− (moving left)
ϕ = + π /2
Ex 4
E
+
+
Quadrant IV: − π /2 < ϕ < 0
Ex 5
F
+
−
Quadrant I: 0 < ϕ < π /2
Ex 6
G
−
−
Quadrant II: π /2 < ϕ < π
Ex 7
K
−
+
Quadrant III: − π < ϕ < − π /2
Ex 8
H
0 and 0
0
degenerate: no motion
Ex 9
I
word problem (pendulum)
given period + push
full pipeline
Ex 10
J
exam twist (find first time at a position)
—
inverting the cosine
Ex 11
For every example we use the same spring unless told otherwise: m = 0.5 kg , k = 200 N/m , so
ω = k / m = 200/0.5 = 400 = 20 rad/s .
The spring mass is pulled to x 0 = + 0.1 m and released from rest (v 0 = 0 ). Find x ( t ) and the max speed.
Forecast: where in the cosine cycle does "starting stationary at the far right" sit? (Guess ϕ before reading.)
1. Amplitude. A = x 0 2 + v 0 2 / ω 2 = 0. 1 2 + 0 = 0.1 m .
Why this step? With v 0 = 0 the whole energy is stretch-energy, so the start point is the turning point — that is literally the definition of amplitude.
2. Phase. cos ϕ has the sign of x 0 > 0 (positive) and sin ϕ has the opposite sign of v 0 = 0 (zero). Positive cosine, zero sine ⇒ ϕ = 0 .
Why this step? tan ϕ = − v 0 / ( ω x 0 ) = 0 gives ϕ = 0 or π ; the positive-cosine check kills π .
3. Assemble. x ( t ) = 0.1 cos ( 20 t ) m ; v m a x = A ω = 0.1 × 20 = 2 m/s .
Why this step? Plugging the two constants back into the master solution x = A cos ( ω t + ϕ ) is the whole point — the constants were the only unknowns left.
Verify: At t = 0 : x = 0.1 cos 0 = 0.1 ✓, v = − 0.1 ⋅ 20 sin 0 = 0 ✓. Units of A ω : m ⋅ s − 1 = m/s ✓.
Same spring, pulled to x 0 = − 0.1 m , released from rest (v 0 = 0 ). Find x ( t ) .
Forecast: starting at the left wall must be a half-turn different from Example 1. Which ϕ ?
1. Amplitude. A = ( − 0.1 ) 2 + 0 = 0.1 m .
Why this step? Amplitude is a distance , so the sign of x 0 drops out — squaring erases it.
2. Phase. cos ϕ takes the sign of x 0 < 0 (negative); sin ϕ = 0 . Negative cosine, zero sine ⇒ ϕ = π .
Why this step? tan ϕ = 0 again offers 0 or π ; now the negative-cosine requirement forces π . This is exactly why the mistake "always ϕ = 0 " fails.
3. Assemble. x ( t ) = 0.1 cos ( 20 t + π ) = − 0.1 cos ( 20 t ) m .
Why this step? We substitute A = 0.1 and ϕ = π into x = A cos ( ω t + ϕ ) ; the identity cos ( θ + π ) = − cos θ then rewrites it in the cleaner mirror form.
Verify: x ( 0 ) = 0.1 cos π = − 0.1 ✓. v ( 0 ) = − 0.1 ⋅ 20 sin π = 0 ✓.
The mass passes through x 0 = 0 moving in + x with v 0 = + 2 m/s . Find x ( t ) .
Forecast: at the centre it is fastest, so this is the moment of v m a x . That should turn cosine into a sine . Which sign of sine?
1. Amplitude. A = 0 + v 0 2 / ω 2 = ( 2/20 ) 2 = 0.1 m .
Why this step? At the centre all energy is kinetic, so A = v 0 / ω — the reach is entirely bought by speed.
2. Phase. Here x 0 = 0 , so the formula tan ϕ = − v 0 / ( ω x 0 ) is undefined (division by zero) — we drop it and use the direct rule instead. x 0 = 0 ⇒ cos ϕ = 0 ⇒ ϕ = ± π /2 . Then v 0 > 0 needs sin ϕ < 0 (because v 0 = − A ω sin ϕ ). Negative sine ⇒ ϕ = − π /2 .
Why this step? tan ϕ → − ∞ can't distinguish + π /2 from − π /2 ; only the velocity sign does.
3. Assemble. x ( t ) = 0.1 cos ( 20 t − π /2 ) = 0.1 sin ( 20 t ) m .
Why this step? Substituting the constants and using cos ( θ − π /2 ) = sin θ reveals the pure sine — the signature of a centre-crossing start.
Verify: x ( 0 ) = 0.1 cos ( − π /2 ) = 0 ✓. v ( 0 ) = − 0.1 ⋅ 20 sin ( − π /2 ) = + 2 ✓.
Same spring, passing x 0 = 0 but moving in − x : v 0 = − 2 m/s . Find x ( t ) .
Forecast: mirror of Example 3 — same amplitude, opposite phase sign.
1. Amplitude. A = 0 + ( − 2/20 ) 2 = 0.1 m (velocity squared ⇒ sign gone).
2. Phase. Again x 0 = 0 makes tan ϕ undefined, so use the direct rule: cos ϕ = 0 ⇒ ϕ = ± π /2 ; now v 0 < 0 needs sin ϕ > 0 ⇒ ϕ = + π /2 .
Why this step? The single sign flip in v 0 swings ϕ across zero to the other vertical quadrant of the phase compass.
3. Assemble. x ( t ) = 0.1 cos ( 20 t + π /2 ) = − 0.1 sin ( 20 t ) m .
Why this step? Substituting the constants and using cos ( θ + π /2 ) = − sin θ gives the negative sine — a mirror of Example 3.
Verify: x ( 0 ) = 0.1 cos ( π /2 ) = 0 ✓. v ( 0 ) = − 0.1 ⋅ 20 sin ( π /2 ) = − 2 ✓.
The mass is at x 0 = + 0.06 m and moving outward to the right with v 0 = + 1.6 m/s . Find A and ϕ .
Forecast: starting on the + side and still speeding outward — it hasn't reached the wall yet, so it's before the turning point in its cycle. Is ϕ positive or negative?
1. Amplitude. A = 0.0 6 2 + ( 1.6/20 ) 2 = 0.0036 + 0.0064 = 0.01 = 0.1 m .
Why this step? Position gives part of the reach, leftover speed gives the rest; Pythagoras adds them because energy (kinetic + potential) adds.
2. Phase. cos ϕ sign = sign of x 0 > 0 (+); sin ϕ sign = opposite of v 0 > 0 ⇒ negative. Positive cosine + negative sine = Quadrant IV , so − π /2 < ϕ < 0 .
tan ϕ = − v 0 / ( ω x 0 ) = − 1.6/ ( 20 ⋅ 0.06 ) = − 1.3 3 ⇒ ϕ = arctan ( − 1.333... ) = − 0.9273 rad (this lands in Quadrant IV, so it's the correct answer directly).
Why this step? Because the raw arctan already returns a Quadrant IV angle, no ± π correction is needed — the compass confirms it.
3. Assemble. x ( t ) = 0.1 cos ( 20 t − 0.9273 ) m .
Why this step? We drop the found constants into the master solution; nothing simplifies further, so we leave ϕ as the numeric radian value.
Verify: A cos ϕ = 0.1 cos ( − 0.9273 ) = 0.06 ✓ (= x 0 ). − A ω sin ϕ = − 0.1 ⋅ 20 ⋅ sin ( − 0.9273 ) = 1.6 ✓ (= v 0 ).
Same numbers as Example 5 but now the mass at x 0 = + 0.06 m is moving inward (returning), v 0 = − 1.6 m/s . Find ϕ .
Forecast: it's past the wall and heading home — the later part of the outgoing swing. Should ϕ be positive now?
1. Amplitude. Identical: A = 0.0 6 2 + ( − 1.6/20 ) 2 = 0.1 m (velocity squared).
2. Phase. cos ϕ sign = x 0 > 0 (+); sin ϕ sign = opposite of v 0 < 0 ⇒ positive. Positive cosine + positive sine = Quadrant I , so 0 < ϕ < π /2 .
Now tan ϕ = − v 0 / ( ω x 0 ) = − ( − 1.6 ) / ( 20 ⋅ 0.06 ) = + 1.3 3 and arctan ( 1.333... ) = + 0.9273 rad — already in Quadrant I. ✓
Why this step? The sign of v 0 flipped , which flipped the sign of tan ϕ , sending the same-magnitude angle from Quadrant IV (Ex 5) to Quadrant I. Same position, opposite travel ⇒ mirror-image phase.
3. Assemble. x ( t ) = 0.1 cos ( 20 t + 0.9273 ) m .
Why this step? Substituting the constants completes the solution; the positive ϕ shifts the curve so the mass is already on its way back at t = 0 .
Verify: A cos ϕ = 0.1 cos ( 0.9273 ) = 0.06 ✓. − A ω sin ϕ = − 2 sin ( 0.9273 ) = − 1.6 ✓.
The mass is at x 0 = − 0.06 m moving left with v 0 = − 1.6 m/s (heading toward the far wall). Find ϕ . Watch the arctan trap.
Forecast: on the − side and moving further −. The compass says cosine negative and sine positive → Quadrant II. Will the raw calculator give that?
1. Amplitude. A = ( − 0.06 ) 2 + ( − 1.6/20 ) 2 = 0.1 m .
2. Phase (the trap). cos ϕ sign = x 0 < 0 (−); sin ϕ sign = opposite of v 0 < 0 ⇒ positive. Negative cosine + positive sine = Quadrant II , so π /2 < ϕ < π .
But tan ϕ = − v 0 / ( ω x 0 ) = − ( − 1.6 ) / ( 20 ⋅ ( − 0.06 )) = 1.6/ ( − 1.2 ) = − 1.3 3 , and a calculator returns arctan ( − 1.333... ) = − 0.9273 rad — that's Quadrant IV , the wrong place! Add π : ϕ = − 0.9273 + π = 2.2143 rad (Quadrant II ✓).
Why this step? tan repeats every π , so arctan can be off by exactly π . The sign compass tells you when to add it — here cosine must be negative, so we push the angle into Quadrant II.
3. Assemble. x ( t ) = 0.1 cos ( 20 t + 2.2143 ) m .
Why this step? We substitute the corrected constants; the large positive ϕ places the mass on the negative side heading outward at t = 0 .
Verify: A cos ϕ = 0.1 cos ( 2.2143 ) = − 0.06 ✓. − A ω sin ϕ = − 2 sin ( 2.2143 ) = − 1.6 ✓.
The figure plots the same magnitude problem for Cells E, F and G on one time axis: identical amplitude, three different phases sliding the curve left/right. That sliding is ϕ .
The mass is at x 0 = − 0.06 m but moving right (back toward the centre) with v 0 = + 1.6 m/s . Find ϕ . This is the last missing sign combination.
Forecast: on the − side but heading home. The compass says cosine negative, sine negative → Quadrant III. Will the calculator land there, or must we correct?
1. Amplitude. A = ( − 0.06 ) 2 + ( 1.6/20 ) 2 = 0.0036 + 0.0064 = 0.1 m (signs squared away).
2. Phase (the trap again). cos ϕ sign = x 0 < 0 (−); sin ϕ sign = opposite of v 0 > 0 ⇒ negative. Negative cosine + negative sine = Quadrant III , so − π < ϕ < − π /2 .
But tan ϕ = − v 0 / ( ω x 0 ) = − ( 1.6 ) / ( 20 ⋅ ( − 0.06 )) = − 1.6/ ( − 1.2 ) = + 1.3 3 , and a calculator returns arctan ( 1.333... ) = + 0.9273 rad — that's Quadrant I , wrong! Subtract π : ϕ = 0.9273 − π = − 2.2143 rad (Quadrant III ✓).
Why this step? arctan collapsed the two-cosine-signs into one; the compass demands negative cosine, so we shift by − π into Quadrant III. This mirrors Example 7 but with the velocity reversed.
3. Assemble. x ( t ) = 0.1 cos ( 20 t − 2.2143 ) m .
Why this step? Substituting the corrected constants finishes the solution; the negative ϕ places the mass on the negative side heading inward at t = 0 .
Verify: A cos ϕ = 0.1 cos ( − 2.2143 ) = − 0.06 ✓. − A ω sin ϕ = − 2 sin ( − 2.2143 ) = + 1.6 ✓.
The mass sits at x 0 = 0 with v 0 = 0 . What is x ( t ) ?
Forecast: no position, no push — will it ever move?
1. Amplitude. A = 0 + 0/ ω 2 = 0 .
Why this step? Amplitude is total reach; with no displacement and no speed there is zero energy to fund any reach.
2. Phase. With A = 0 , ϕ does not matter — 0 ⋅ cos ( anything ) = 0 . The phase becomes meaningless (undefined but irrelevant).
Why this step? This is the honest edge case: the two constants collapse to a single trivial solution. Don't hunt for a quadrant that doesn't exist.
3. Assemble. x ( t ) = 0 for all t — the mass stays at equilibrium forever.
Why this step? Substituting A = 0 into x = A cos ( ω t + ϕ ) leaves the zero function — the physically obvious "nothing happens" state.
Verify: x ¨ + ω 2 x = 0 + ω 2 ⋅ 0 = 0 ✓ — the zero function trivially solves the ODE. Physically: equilibrium is a valid (boring) SHM state.
A simple pendulum swinging through small angles has period T = 2 s . At t = 0 its bob is at the bottom (x 0 = 0 ) and is given a push producing v 0 = + 0.15 m/s along the arc. Find ω , A , ϕ , and x ( t ) .
Forecast: bottom of the swing = centre of the motion. Same shape as Example 3, only ω comes from the period instead of from k / m .
0. Legality check. A pendulum only obeys x ¨ = − ω 2 x in the small-angle approximation , where sin θ ≈ θ makes the restoring force linear in displacement. Because the push is small, the swing stays small and this linear SHM solution is valid — otherwise the period would depend on amplitude and x = A cos ( ω t + ϕ ) would not apply.
Why this step? The whole matrix assumes true (linear) SHM; we must confirm the system qualifies before using the formulas.
1. Angular frequency. ω = 2 π / T = 2 π /2 = π ≈ 3.1416 rad/s .
Why this step? The cosine repeats when its argument grows by 2 π , so one full period corresponds to ω T = 2 π . We invert that.
2. Amplitude. A = 0 + v 0 2 / ω 2 = v 0 / ω = 0.15/ π ≈ 0.04775 m .
Why this step? Starting at the centre ⇒ all kinetic ⇒ reach = v 0 / ω , exactly Cell C's logic.
3. Phase. x 0 = 0 makes tan ϕ undefined, so use the direct rule: cos ϕ = 0 and v 0 > 0 needs sin ϕ < 0 ⇒ ϕ = − π /2 .
4. Assemble. x ( t ) = π 0.15 cos ( π t − 2 π ) = π 0.15 sin ( π t ) m .
Why this step? Substituting the three found constants and using cos ( θ − π /2 ) = sin θ gives the clean sine of a centre-start swing.
Verify: x ( 0 ) = 0 ✓. v ( 0 ) = − A ω sin ( − π /2 ) = A ω = ( 0.15/ π ) ⋅ π = 0.15 ✓. Units of 2 π / T : rad / s ✓.
Using Example 1's motion x ( t ) = 0.1 cos ( 20 t ) : at what first time t 1 > 0 does the mass reach x = 0.05 m ? Also find its speed there.
Forecast: 0.05 is halfway to the wall. Because cosine is steep near the top and flat later, will t 1 be more or less than a quarter period?
1. Set up the equation. 0.05 = 0.1 cos ( 20 t ) ⇒ cos ( 20 t ) = 0.5 .
Why this step? We know the position and want the time , so we must undo the cosine — that is what arccos is for: "which angle has this cosine?"
2. Invert. 20 t = arccos ( 0.5 ) = π /3 rad (the smallest positive solution). So t 1 = 20 π /3 = 60 π ≈ 0.05236 s .
Why this step? arccos returns the first angle in [ 0 , π ] ; dividing by ω = 20 converts angle back to seconds. (Later times would be 2 π − π /3 , etc. — we want the first.)
3. Speed there — use the time-free relation. v = ± ω A 2 − x 2 = − 20 0. 1 2 − 0.0 5 2 = − 20 0.0075 ≈ − 1.732 m/s .
Why this step? The mass started at + A moving inward, so at x = + 0.05 on the way down it moves in − x ⇒ negative sign. Using v = ± ω A 2 − x 2 avoids re-differentiating.
Verify: Period T = 2 π /20 ≈ 0.314 s ; a quarter period (to reach centre) is 0.0785 s , and t 1 ≈ 0.0524 s < 0.0785 ✓ (reaches the halfway point before the centre — cosine falls fast near the top, matching the forecast). Speed magnitude 1.732 < v m a x = 2 m/s ✓.
Recall One-line recipe for ANY starting snapshot
Compute A = x 0 2 + v 0 2 / ω 2 ; get the magnitude of ϕ from tan ϕ = − v 0 / ( ω x 0 ) (unless x 0 = 0 , where you use ϕ = ± π /2 directly) ; then set the quadrant using: cos ϕ shares the sign of x 0 , and sin ϕ is opposite to v 0 .
Which cell has ϕ = 0 ? Released from rest at + A (positive position, zero velocity).
Which cell has ϕ = π ? Released from rest at − A (negative position, zero velocity).
Centre, moving right — what is ϕ ? − π /2 (so x = A sin ω t ).
Centre, moving left — what is ϕ ? + π /2 (so x = − A sin ω t ).
Negative position, positive velocity — which quadrant is ϕ ? Quadrant III (− π < ϕ < − π /2 ); subtract π from the raw arctan.
When must you add π to the raw arctan for ϕ ? When the required sign of cos ϕ (i.e. of x 0 ) disagrees with what arctan returned — usually x 0 < 0 .
When is tan ϕ = − v 0 / ( ω x 0 ) unusable? When x 0 = 0 (division by zero); then use ϕ = ± π /2 chosen by the sign of v 0 .
In the zero-zero degenerate case, what is ϕ ? Undefined and irrelevant — A = 0 so the phase multiplies nothing.