Maximizing $3\sin^2 x + 8\sin x\cos x + 9\cos^2 x$. What went wrong? 
Let $f(x) = 3\sin^2 x + 8\sin x\cos x + 9\cos^2 x$. For some $x \in \left[0,\frac{\pi}{2}\right]$, $f$ attains its maximum value, $m$. Compute $m + 100 \cos^2 x$.

What I did was rewrite the equation as $f(x)=6\cos^2x+8\sin x\cos x+3$. Then I let $\mathbf{a}=\left<6\cos x,8\cos x\right>$ and $\mathbf{b}=\left<\cos x,\sin x\right>$.
Using Cauchy-Schwarz, I got that the maximum occurs when $\tan x=\frac{4}{3}$, and that the maximum value is $10\cos x$. However, that produces a maximum of $9$ for $f(x)$, instead of the actual answer of $11$.
What did I do wrong, and how do I go about finding the second part? Thanks!

Using the identity $$\cos^2 x=\frac {1+\cos 2x}{2}$$ and $$2\sin x\cos x=\sin 2x$$ the question changes to finding minimum value of the function
$$6+3\cos 2x+4\sin 2x$$
And now using a standard result that the range of a function $a\sin \alpha\pm b\cos \alpha$ is $[-\sqrt {a^2+b^2},\sqrt {a^2+b^2}]$
Hence the range of the given expression becomes $[1,11]$
Hope you can continue further 
