The Equation of Simple Harmonic Motion found that $x = A\cos(\omega t + \phi)$ solves the spring equation for any $A$ and $\phi$. The physics picks them: where the mass starts and how fast it is moving. Finding $\phi$ needs Inverse Trig Functions, with care about quadrants.
Why it works
At $t = 0$: $x_0 = A\cos\phi$ and $v_0 = \dot{x}(0) = -A\omega\sin\phi$. So $\cos\phi = \dfrac{x_0}{A}$ and $\sin\phi = -\dfrac{v_0}{A\omega}$. Squaring and adding (since $\cos^2 + \sin^2 = 1$): $$A = \sqrt{x_0^2 + \left(\dfrac{v_0}{\omega}\right)^2}.$$ The ratio gives $\tan\phi = -\dfrac{v_0}{\omega x_0}$, but a tangent alone can't tell quadrant I from III or II from IV. The signs of $\cos\phi$ (same as $x_0$) and $\sin\phi$ (opposite to $v_0$) decide.
Key idea
$$A = \sqrt{x_0^2 + (v_0/\omega)^2}, \qquad \cos\phi = \dfrac{x_0}{A}, \quad \sin\phi = -\dfrac{v_0}{A\omega}.$$ Equivalently, $x(t) = x_0\cos\omega t + \dfrac{v_0}{\omega}\sin\omega t$, which needs no phase at all.
Worked example: Amplitude and phase
A block with $\omega = 5\ \text{rad/s}$ starts at $x_0 = 0.06\ \text{m}$ moving at $v_0 = +0.40\ \text{m/s}$. Find $A$ and $\phi$.
- $v_0/\omega = 0.08\ \text{m}$, so $A = \sqrt{0.06^2 + 0.08^2} = 0.10\ \text{m}$.
- $\cos\phi = 0.06/0.10 = 0.6 > 0$ and $\sin\phi = -0.08/0.10 = -0.8 < 0$: quadrant IV.
- $\phi = -0.927\ \text{rad}$. Check: $x = 0.1\cos(5t - 0.927)$ starts at $0.06$ and is rising, as given.
Answer: $A = 0.10\ \text{m}$; $\phi = -0.927\ \text{rad}$.
Worked example: Where the calculator goes wrong
Same block, but starting at $x_0 = -0.06\ \text{m}$ with $v_0 = +0.40\ \text{m/s}$. Find $\phi$.
- $A = 0.10\ \text{m}$ again. $\cos\phi = -0.6 < 0$ and $\sin\phi = -0.8 < 0$: quadrant III.
- A calculator's $\arctan\left(\dfrac{-v_0}{\omega x_0}\right) = \arctan(1.333) = 0.927$ lands in quadrant I, which would put the block at $+0.06$ moving left.
- Correct: $\phi = 0.927 - \pi = -2.21\ \text{rad}$.
Answer: $\phi = -2.21\ \text{rad}$.
- Released from rest at $x_0 = +A$: $\phi = 0$, so $x = A\cos\omega t$.
- Released from rest at $x_0 = -A$: $\phi = \pi$.
- Starting at equilibrium moving in $+x$: $\phi = -\pi/2$, so $x = A\cos(\omega t - \pi/2) = A\sin\omega t$ with $A = v_0/\omega$.
- Starting at equilibrium moving in $-x$: $\phi = +\pi/2$.
Common mistake
Picking the phase from $\tan\phi$ alone without checking the sign of the starting velocity. Two phases half a turn apart have the same tangent but describe opposite motions. Check by substituting back: $A\cos\phi$ must equal $x_0$ and $-A\omega\sin\phi$ must equal $v_0$, signs included.