And that the upper bound is achieved for some choice of $\theta$. This exercise shows up in the Cauchy-Schwarz section of a textbook I am looking through but I don't see how to apply CS to prove. I would prefer a hint towards how to use this ineq. specifically.
Through standard techniques, you can see that the maximum of $$ f(t)=a\cos t+b\sin t-\sqrt{a^2+b^2} $$ occurs for $\arctan\frac{a}{b}$ provided $t\ne \frac{\pi}{2},\frac{3\pi}{2}$. Not sure if I can do much from there though.