If you are given:
\(\displaystyle A\cdot \cos(\theta) \, + \, B\cdot \sin(\theta)\)
then define:
\(\displaystyle \cos(\phi) \, = \, \frac{A}{\sqrt{A^2 \, + \, B^2}}\)
and
\(\displaystyle \sin(\phi) \, = \, \frac{B}{\sqrt{A^2 \, + \, B^2}}\)
and
\(\displaystyle \tan(\phi) \, = \, \frac{B}{A}\)
then
\(\displaystyle A\cdot \cos(\theta) \, + \, B\cdot \sin(\theta) \,\)
\(\displaystyle = \, \sqrt{A^2 \, + \, B^2}[\frac{A}{\sqrt{A^2 \, + \, B^2}}\cdot \cos(\theta) \, + \, \frac{B}{\sqrt{A^2 \, + \, B^2}}\cdot \sin(\theta)]\)
\(\displaystyle = \, \sqrt{A^2 \, + \, B^2}[\cos(\phi)\cdot \cos(\theta) \, + \, \sin(\phi)\cdot \sin(\theta)]\)
\(\displaystyle = \, \sqrt{A^2 \, + \, B^2}[\cos(\theta \, + \, \phi)]\)