<s>[INST] Calculus inequality involving sine and cosine community! I saw the following inequality in a calculus assignment, which I thought was harder to prove than I expected: For every $x\in\mathbb{R},$$$(\sin x + a \cos x)(\sin x + b \cos x)\leq 1+(\frac{a+b}{2})^2.$$
By means of a graphing device, I noticed that when $a=b$, $f(x)=(\sin x + a\cos x)(\sin x + b \cos x)$ has  $1+(\frac{a+b}{2})^2$ as its maximum, but in other cases the maximum of  $f$ is strictly less (and sometimes far less) than this number. I'd appreciate any kind of help :)
 [/INST] 
For any trig0nometric expression of the form $$A\sin x+B\cos x=\sqrt{A^2+B^2}\left(\dfrac{A}{\sqrt{A^2+B^2}}\sin x+\dfrac{B}{\sqrt{A^2+B^2}}\cos x\right)$$ 
  can be written in the form $\sqrt{A^2+B^2}\sin(x+\phi)$ with $\tan\phi=B/A$ and hence $\vert A\sin x+B\cos x|\le\sqrt{A^2+B^2}$ for any $A,B\in\Bbb{R}.$
  In fact these bounds are sharp. 

Here I will use above fact to give a pure trig-solution (without calculus).
First observe that
\begin{align}
f(x)& = (\sin x+a \cos x)(\sin x+b \cos x) \\
 & = \sin^2x+(a+b)\sin x\cos x+ab\cos^2x\\ 
 & =\dfrac{1}{2}\left((1-\cos 2x)+(a+b)\sin 2x+ab(1+\cos 2x)\right) \\
 & =\left(\dfrac{a+b}{2}\right)\sin2x+\left(\dfrac{ab-1}{2}\right)\cos 2x+\left(\dfrac{ab+1}{2}\right).\\
\end{align}
Hence $$-\sqrt{\left(\dfrac{a+b}{2}\right)^2+\left(\dfrac{ab-1}{2}\right)^2}\le f(x)-\left(\dfrac{ab+1}{2}\right)\le\sqrt{\left(\dfrac{a+b}{2}\right)^2+\left(\dfrac{ab-1}{2}\right)^2}.$$ Therefore the function has the maximum value
$$\left(\dfrac{ab+1}{2}\right)+\sqrt{\left(\dfrac{a+b}{2}\right)^2+\left(\dfrac{ab-1}{2}\right)^2}$$
and minimum value
$$\left(\dfrac{ab+1}{2}\right)-\sqrt{\left(\dfrac{a+b}{2}\right)^2+\left(\dfrac{ab-1}{2}\right)^2}.$$
</s>