Minimum value of $\cos^2\theta-6\sin\theta \cos\theta+3\sin^2\theta+2$ Recently I was solving one question, in which I was solving for the smallest value of this expression

$$f(\theta)=\cos^2\theta-6\sin\theta \cos\theta+3\sin^2\theta+2$$

My first attempt:
$$\begin{align}
f(\theta) &=3+2\sin^2\theta-6\sin\theta \cos\theta \\
&=3(1-2\sin\theta \cos\theta)+2\sin^2\theta \\
&=3(\sin\theta-\cos\theta)^2 + 2\sin^2\theta
\end{align}$$
Hence the minimum value of $f(\theta)=2\sin^2\theta$ when $\theta=\pi/4$
hence minimum value of $f(\theta)=1$.
But then again I tried to do question differently by making substitutions in order to change the whole $f(\theta)$ in the form of $\cos x+\sin x$ 
Then $f(\theta)$ came out to be 
$$f(\theta)= 4-(\cos(2\theta)+3\sin(2\theta))$$
The minimum value of this expression is surely $$(f(\theta))_{min}=4-\sqrt{10}$$
Can anybody explain me algebraically why my first method gave the wrong result?
 A: $f'(\theta)=3(sin\theta-cos\theta)^2 + 2sin^2\theta = 6 (\sin\theta -\cos\theta )(\cos\theta + \sin\theta) + 4 \sin \theta \cos\theta$
$
=6 (\sin^2 \theta - \cos^2 \theta) + 4 \sin \theta \cos\theta =-6\cos(2\theta) +2\sin(2\theta)\ge 0 \implies \frac{2}{6} \tan (2\theta)\ge 1
$
$
\implies \tan(2\theta)\ge 3 \implies 2\theta\ge \arctan(3) \implies \theta \ge \arctan(3)/2
$
What that tells us is that first derivative is bigger than $0$ when $\theta \ge \arctan(3)/2$ that is function is growing and after that its smaller than $0$ - meaning its decreasing so we know that the function has a minimum in point $\theta = \arctan(3)/2$
With that
$$
f(\theta)=\cos^2\theta-6\sin\theta \cos\theta+3\sin^2\theta+2=\frac{1+\cos(2\theta)}{2} - 3\sin(2\theta) +3\frac{1-\cos(2\theta)}{2} + 2=4-\cos(2\theta)-3\sin(2\theta) = 4-\frac{1}{\sqrt{10}} - 3\frac{3}{\sqrt{10}}=4 - \sqrt{10}
$$
Since we know that 
$\cos^2 (2\theta)+\sin^2 (2\theta)=1 \implies 1+9=1/\cos^2 (2\theta) \implies cos^2(2\theta)=\frac{1}{10}$
A: $f(\theta) = 4 - \sqrt{10}$ is correct.
so what is the error here:
$f(\theta) = 3(\sin \theta-\cos\theta)^2 + 2\sin^2\theta$
That part is a true statement but then you say.
Hence the minimum value of $f(θ)=2\sin^2θ,$ when $θ=π/4$ hence minimum value of $f(θ)=1.$
It is a logical jump that was a step too far.
If you had had, 
$f(\theta) = 3(\sin \theta-\cos\theta)^2 + k$
it would be okay to zero out the term in parentheses.  It must be greater than or equal to zero, so set it to zero.
But in your actual expression
$f(\theta) = 3(\sin \theta-\cos\theta)^2 + 2\sin^2\theta$
Minimizing either term doesn't minimize the sum.
Furthermore, when you say the minimum of $f(θ)=2\sin^2θ,$ occurs when  $θ=\pi/4$ that is just wrong.
A: hint: Alternatively, using Lagrange Multiplier we have: 
$x = \cos \theta, y = \sin \theta\implies f(x,y) = x^2-6xy+3y^2+2, x^2+y^2 = 1\implies f(x,y) = (x^2+y^2)+2y^2+2 - 6xy = 3-6xy+2y^2 \implies f_x = -6y= 2\lambda x, f_y = 4y-6x= 2\lambda y\implies4\lambda y - 6\lambda x = 2\lambda^2y\implies 4\lambda y+18y=2\lambda^2y\implies y(\lambda^2-2\lambda-9) = 0\implies y = 0 $  or $\lambda = 1\pm \sqrt{10}$ . Can you continue at this point?
