<s>[INST] Expressing in the form $A \sin(x + c)$ 

Express in the form $A\sin(x+c)$
  a) $\sin x+\sqrt3\cos x$; b) $\sin x-\cos x$
sol: a) $A=\sqrt{1+3}=2$, $\tan c=\frac{\sqrt 3}1$, $c=\frac\pi3$. So $\sin x+\sqrt3\cos x=2\sin(x+\frac\pi3)$
  b) $\sqrt 2\sin(x-\frac\pi4)$

Can someone please explain the method used in the provided solution above? (I'm not familiar with this way of solving whatsoever.)
Thanks in advance =]
 [/INST] The anonymous commenter has already answered your question, but in case you have any remaining doubts, I will provide a detailed answer.
For starters, do note that
$A \, \sin (x + c) = \left(A \, \cos(c) \right) \, \sin(x)  + \left( A \, \sin(c)\right) \, \cos(x)$
Since you have $\sin (x) + \sqrt{3} \, \cos (x)$, it follows that $A \, \cos(c) = 1$ and $A \, \sin(c) = \sqrt{3}$. Therefore, since $\sin^2 (x) + \cos^2 (x) = 1$, we have that $A^2 = 4$, which yields $A = 2$, and $2 \cos (c) = 1$, which yields $c = \pi / 3$. Finally, we conclude that
$\sin (x) + \sqrt{3} \, \cos (x) = 2 \sin (x + \pi / 3)$.
</s>