TITLE: How to minimize $x^2+4xy+5y^2-4x-6y+7$ without using calculus
QUESTION [5 upvotes]: I would like to find the smallest possible value of the function

$$f(x,y)=x^2+4xy+5y^2-4x-6y+7$$

without taking any derivatives. My thoughts were to complete the square on both $x$ and $y$ and choose appropriate values to make the nonnegative squared terms equal to $0$. Completing the square two times the function becomes
$$\left(x+2y \right)^2 + \left(y-3 \right)^2-4x-2$$ 
And then it seems appropriate to take $x=-2y$ and $y=3$. These values do not appear to be minimizers though, as calculus and the following graph can verify. The minimizing values appear to be $y=-1$ and $x=4$ instead.

Have I done something wrong in the above? 
Thank you.

REPLY [2 votes]: Here is an alternative way. When you see there is an extra $x$ term there, you can do a change of variable $u=x+2y$ and $v=y-3$. Then $x=u-2y=u-2(v+3)$. Then the equation can be changed into
$$u^2+v^2-4u+8v+22$$
Using this you can do another normal completing the square.