Using an auxiliary triangle to find the range of a trig function such as $f(x)=a\sin x\pm b\cos x$ I read online that when finding range of a trigonometric function such as
$$f(x) = a\sin x \pm b\cos x$$
as shown in the image, we make a triangle and assign those values of constant in it.

*

*I did not understand that why is $a$ the base and $b$ perpendicular, and why not the opposite way.

*How did we predict by looking at that equation #3 and say the range?


 A: You can also do the other way as you stated.
Now,
$\cos\theta = \frac{b}{\sqrt{a^2+b^2}}$ and $\sin\theta = \frac{a}{\sqrt{a^2+b^2}}$
$\Rightarrow a= \sqrt{a^2+b^2}\sin\theta$ and $b= \sqrt{a^2+b^2}\cos\theta$
$\Rightarrow f(x) = \sqrt{a^2+b^2}\left[\sin\theta\sin x \pm \cos\theta\cos x\right] =  \sqrt{a^2+b^2}\left[\mp\cos(x\pm\theta)\right]$
The range of $\cos\alpha $ is $[-1,1]$
So, range of $f(x)$ is $[-\sqrt{a^2+b^2},\sqrt{a^2+b^2}] $
A: Do you know dot product? If you do, regard the formula as a dot product and take $(a,b)$ as a vector. Since $\vec v=(\cos (\theta ),\sin (\theta ))$ is the vector moving along the unit circle, and the dot product can be interpreted as a projection [in this case the  $\vec v$  is projected to  $(a,b)$]. Also, if you admit that $\cos (\theta )$ is nothing more than $\vec v\cdot (1,0) $ i.e the projection to axis, then the phase difference will be the included angle between $(a,b)$ and the axis which is $\arctan (b/a)$ and $\cos$ [or  $\sin$] of which is  $\frac{a}{\sqrt{a^2+b^2}}$ and  $\frac{b}{\sqrt{a^2+b^2}}$ respectively. As for the range, try to picture like this: rotate the $(a,b)$ to the position of the axis and project the vector  $\vec v$ onto them, you can see the real difference is nothing more than  $(a,b)$ possess an additional length comparing with $(1,0)$[or $(0,1)$ ]
