Same algebraic function behaves differently when it's form changes In a previous question I succeeded in converting the solution of the ODE $m{\ddot x}+kx=mg$ from this form:
\begin{align}
x(t) = A\cos \left(\sqrt \frac k m t\right)+B\sin\left(\sqrt \frac k m t\right) +\frac {mg} k
\tag 1\\
\end{align}
to this form:
\begin{align}
x(t)=
\sqrt {A^2+B^2}\sin\left(\arctan \frac A B + \sqrt \frac k m t\right)+\frac {mg} k
\tag 2\\
\end{align}
Applying the initial conditions $x(0) = x_0$ and $\dot x(0) = v_0 $ to the first form (Eqn. 1), I ended up with $A = x_0-\frac {mg} k$ and $B = v_0 \sqrt \frac m k$. Substituting this into Eqn. 1, we get:
\begin{align}
x(t) = \left(x_0-\frac {mg} k\right)\cos \left(\sqrt \frac k m t\right)+\left(v_0 \sqrt \frac m k\right)\sin\left(\sqrt \frac k m t\right) +\frac {mg} k
\tag 3\\
\end{align}
Substituting this into Eqn. 2, we get:
\begin{align}
x(t)=
\sqrt {\left(x_0-\frac {mg} k\right)^2+\left(v_0 \sqrt \frac m k\right)^2}\sin\left(\arctan \frac { x_0-\frac {mg} k} {v_0 \sqrt \frac m k} + \sqrt \frac k m t\right)+\frac {mg} k
\tag 4\\
\end{align}
My initial conditions happen to be $x(0) =x_0 = 0$ and $\dot x(0) = v_0=0$. It can be observed that Eqn  3. can handle $v_0 = 0$ whereas Eqn. 4 cannot. Why, if they are essentially the same functionn, do they behave differently for $v_0= 0$ ?
 A: You are facing an identity like
$$A\cos t+B\sin t=\sqrt{A^2+B^2}\cos\left(t-\arctan\frac BA\right).$$
When $A=0$, anyway, it reduces to
$$B\sin t=|B|\cos\left(t\pm\arctan\frac\pi2\right),$$ (depending on the sign of $B$) and this cannot be expressed with the arc tangent function.
The complex numbers allow a more general representation with the "argument" operator,
$$A\cos t+B\sin t=|A+iB|\cos\left(t-\angle(A+iB)\right).$$
Alternatively,
$$A\cos t+B\sin t=\sqrt{A^2+B^2}\cos\left(t-\arctan_2(B,A)\right),$$
where the function $\arctan_2$ cares about the quadrants.

Similar reasoning holds for the $\sin(t+\phi)$ representation.
A: That is because when $v_0=0$, in equation (3), the $\sin$ component becomes $0$. There is only the $\cos$ component left. In Equation (4), when $v_0\rightarrow 0$, the $\arctan(..)$ goes to $\pi/2$. Then $\sin(\pi/2+..)$ is exactly $\cos(..)$.
You'll have to make $v_0=0$ a special case. Give equation (4) with the condition $v_0\ne 0$. When $v_0=0$, $x(t)$ is just represented by $\cos$. This is in some sense like projection to $\sin$ component or $\cos$ component. If $x(t)$ does not have $\sin$ component, you have to represent it using $\cos$ component only.
