How do you obtain this formula?

I saw this in my textbook that asin(x)+bcos(x) can be written as Rsin(x+@). And there is a similar formula for cosine as well. It also says that R^{2}=a^{2}+b^{2}. How and why do we obtain these relations? And what about putting in some variations like putting powers on the trig functions. In the textbook these types of questions continually keep cropping up like: convert 3sin(x)+2cos(x) in the form Rsin(x+@). Can you explain how doing it by using double angle or addition formulae of trig functions, if possible. Or what if we have to convert it to Rcos(x+@).Or if there are powers on trig functions.

Re: How do you obtain this formula?

Let

Divide both members by :

We have that and .

Then such as and

So

and

If we note then