If $1−a\cos x−b\sin x−A\cos2x−B\sin2x\geq0$ for all real $x$, then $a^2+b^2\leq2$ and $A^2+B^2\leq1$ 
Four real constants $a$, $b$, $A$, $B$ are given, and
  $$
f(x) = 1 − a\cos(x) − b\sin(x) − A\cos(2x) − B\sin(2x)
$$
  Prove that if $f(x)\geq 0$ for all real $x$, then
  $$
a^2+b^2\leq 2 \quad \mbox{and} \quad A^2 + B^2 \leq 1
$$ 

Edit: I know that 
$$-\sqrt{a^2+b^2}\leq a\sin(x)+b\cos(x) \leq \sqrt{a^2+b^2}$$ 
But I don't know how to apply this one to prove the question.
 A: Observe
\begin{align}
a \cos()+b\sin()
&= \sqrt{a^2+b^2}\left(\frac{a}{\sqrt{a^2+b^2}}\cos(x)+\frac{b}{\sqrt{a^2+b^2}}\sin(x) \right)\\
&= \sqrt{a^2+b^2} \sin(x-\theta_0) 
\end{align}
for some $\theta_0$ and likewise
\begin{align}
A \cos(2)+B\sin(2) = \sqrt{A^2+B^2} \sin(2x-\phi_0).
\end{align}
Then we see that
\begin{align}
f(x)= 1-\sqrt{a^2+b^2} \sin(x-\theta_0)-\sqrt{A^2+B^2} \sin(2x-\phi_0)\geq 0
\end{align}
for all $x$. 
Set $x=\theta_0+\frac{3\pi}{4}$ then, we see that
\begin{align}
1-\frac{1}{\sqrt{2}}\sqrt{a^2+b^2}+\sqrt{A^2+B^2}\cos(2\theta_0-\phi_0)\geq 0.
\end{align}
If we also set $x=\theta_0+\frac{\pi}{4}$ then we get
\begin{align}
1-\frac{1}{\sqrt{2}}\sqrt{a^2+b^2}-\sqrt{A^2+B^2}\cos(2\theta_0-\phi_0)\geq 0.
\end{align}
Finally, we see that
\begin{align}
2-\frac{2}{\sqrt{2}}\sqrt{a^2+b^2} \geq 0
\end{align}
which is the desired inequality. 
The other inequality is derived in a similar manner, i.e. set $x=\frac{\phi_0}{2}+\frac{\pi}{4}$ and $ \frac{\phi_0}{2}+\frac{5\pi}{4}$.
