find the range of the function : $y=(3\sin 2x-4\cos 2x)^2-5$ find the range of the function :
$$y=(3\sin 2x-4\cos 2x)^2-5$$
My try :
$$y=9\sin^22x+16\cos^22x-24\sin 2x\cos 2x-5\\y=9+7\cos^22x-12\sin4x-5$$
now what do I do؟
 A: Hints:

Every real number $t$ can be expressed as $2x$ for some $x$, so the range of the function
$$f(x) = (3\sin 2x-4\cos 2x)^2-5$$
is the same as the range of
$$g(t)=(3\sin t-4\cos t)^2-5$$

But the expression
$$3\sin t-4\cos t$$
can be expressed as
$$5\left({\small{\frac{3}{5}}}\sin t-{\small{\frac{4}{5}\cos t}}\right)$$
which suggests what formula?
A: You can write $$3\sin 2x-4\cos 2x =5\sin(2x+\varphi)$$
for some constant angle $\varphi$, 
so $$ y = 25\sin^2(2x+\varphi)-5$$
so $y_{\max} = 20$ and $y_{\min} = -5$. 
A: Hint: Range of $a \sin x $ is $[-a,a]$ and the range of $b\cos^2x$ is $[0,b]$
A: For real $x,$ $$(a\cos2x-b\sin2x)^2\ge0$$ the equality occurs if $$a\cos2x-b\sin2x=0\iff\dfrac{\cos2x}b=\dfrac{\sin2x}a=\pm\sqrt{\dfrac1{b^2+a^2}}$$
Using Brahmagupta-Fibonacci Identity,
$$(a\cos2x-b\sin2x)^2+(b\cos2x+a\sin2x)^2=(a^2+b^2)(?)$$ 
$$(a\cos2x-b\sin2x)^2=a^2+b^2-(b\cos2x+a\sin2x)^2\le a^2+b^2$$
the equality occurs if $$b\cos2x+a\sin2x=0\iff\dfrac{\cos2x}a=\dfrac{\sin2x}{-b}=\pm\sqrt{\dfrac1{b^2+a^2}}$$
