Find maximum of $f(x)=3\cos{2x}+4\sin{2x}.$ Find maximum of $f(x)=3\cos{2x}+4\sin{2x}.$ The shortest way to do this is to only consider $2x\in[0,2\pi)$, set $t=2x$ and note that


*

*Max$(\cos{t})=1$ for $t=0.$

*Max$(\sin{t})=1$ for $t=\frac{\pi}{2}.$


Max of these two functions added is when $t$ equals the angle exactly in the middle of $[0,\pi/2]$, which is $t=\pi/4.$ For this $t$ we have that $\cos{\pi/4}=\sin{\pi/4}=\sqrt{2}/2.$ So; $$f\left(\frac{\pi}{4}\right)=3\frac{\sqrt{2}}{2}+4\frac{\sqrt{2}}{2}=\frac{7\sqrt{2}}{2}.$$
Correct answer: $5$. My answer is slightly less than $5$. Why?

This is a well-known problem: the maximum of $a\cos x+b\sin x$ is
$\sqrt{a^2+b^2}$. One way to see this is to use Cauchy-Schwarz:
$$a\cos x+b\sin x\le\sqrt{a^2+b^2}\sqrt{\cos^2x+\sin^2x}=\sqrt{a^2+b^2}$$
and then get equality by finding an $x$ with $\cos x=a/\sqrt{a^2+b^2}$
and $\sin x=b/\sqrt{a^2+b^2}$.
