How does $3\cos x + 4\sin x$ become $5\cos(x - \arctan\frac{4}{3})$? I'm not sure how any rule is being applied to manipulate the $4\sin x$
None of the double angle/compound angle formulas have the trig functions in this layout

First observe that $\sqrt{3^2 + 4^2} = 5,$ and so $\sqrt{\left( \frac 3 5 \right)^2 + \left( \frac 4 5 \right)^2} = 1.$ So there is some angle $\varphi$ for which $\cos\varphi=\frac 3 5$ and $\sin\varphi=\frac 4 5.$ Since the sine and cosine of that angle are both positive, it is in the first quadrant. Its tangent is its sine divide by its cosine, so that is $4/3.$ Hence $\varphi = \arctan \frac 43.$
So
\begin{align}
& 3\cos x + 4\sin x = 5\left( \tfrac 3 5 \cos x + \tfrac 4 5 \sin x \right) \\[8pt]
= {} & 5\left( \cos\varphi \cos x + \sin\varphi \sin x \right) \\[8pt]
= {} & 5\cos(x-\varphi) = 5\cos(x - \arctan \tfrac 4 3).
\end{align}
