<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] $$|\sin x+a\cos x|=\left|\sqrt{1+a^2}\left( \frac{1}{\sqrt{1+a^2}}\sin x+\frac{a}{\sqrt{1+a^2}}\cos x \right)\right|=|\sqrt{1+a^2}(\cos \theta \sin x+\sin \theta \cos x)|=|\sqrt{1+a^2}( \sin(x+\theta) )|\le \sqrt{1+a^2}.$$ So the maximum value of $\sin x+a\cos x=\sqrt{1+a^2}.$ 
\begin{align*}
|(\sin x+a\cos x)(\sin x+b\cos x)|& = |\sin x+a\cos x||\sin x+b\cos x|\\
& \le \sqrt{1+a^2}\sqrt{1+b^2}=\sqrt{(1+a^2)(1+b^2)}\\
& \le \frac{(1+a^2)+(1+b^2)}{2} \tag{1}\\
&=1+\frac{a^2+b^2}{2}
\end{align*}
In $(1)$,  I have used AM-GM Inequality.
</s>