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!
 A: $f(x)=2\sin^2x+8\sin x\cos x+8\cos^2x+1=2(\sin x+2\cos x)^2+1$
Let $\displaystyle \alpha\in\left[0,\frac{\pi}{2}\right]$ and $\displaystyle\cos\alpha=\frac{2}{\sqrt{5}}$. Then $\displaystyle\sin\alpha=\frac{1}{\sqrt{5}}$ and
$$\sin x+2\cos x=\sqrt{5}(\sin x\sin\alpha+\cos x\cos\alpha)=\sqrt{5}\cos(x-\alpha).$$
attaining its maximum when $x=\alpha$.
So, $m=2(\sqrt{5})^2+1=11$ and $\displaystyle m+100\cos^2\alpha=11+100\left(\frac{4}{5}\right)=91$.
A: 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 
A: Let's ignore the condition that $x\in[0,\pi/2]$ for the moment.
We are maximising $3u^2+8uv+9v^2$ subject to the constraint $u^2+v^2=1$.
For a given $a$, $3u^2+8uv+9v^2=a$ is soluble under this constraint
iff $3u^2+8uv+9v^2=a(u^2+v^2)$ is. This means that $Q(u,v)=(3-a)u^2+8uv+(9-a)v^2=0$. If this has a solution $\ne(0,0)$ it can be scaled to one with
$u^2+v^2=1$. This is the case if the quadratic form $Q$ factors over the
reals, that is if $8^2-4(3-a)(9-a)\ge0$. This gives $a^2-12a+11\le0$,
equivalently $(a-1)(a-11)\le0$. The possible values of $a$ form
the interval $[1,11]$.
Does $11$ occur as a maximum for some acute angle $x$? When $a=11$,
$Q(u,v)=-8u^2+8uv-2v^2=-2(2u-v)^2$, so at a maximum, $v=2u$. The
solutions of this when $u^2+v^2=1$ are $(1/\sqrt5,2/\sqrt5)$
and $(-1/\sqrt5,-2/\sqrt5)$ and the first comes from the acute
angle $x=\tan^{-1}2$.
