<s>[INST] Constrained Optimisation Problem: Confusion with Algebra/Contradiction I completed the following constrained optimisation problem:

Maximum and minimum values of $f(x,y) = x^2 + 2xy + y^2$ on the ellipse $g(x,y) = 2x^2 + y^2 - xy - 4x = 0$.

$\nabla f = \lambda \nabla g$
$\therefore (2x + 2y, 2x + 2y) = \lambda(4x - y - 4, 2y - x)$
We have a system of 3 equations in 3 unknowns:
$2x + 2y = \lambda(4x - y - 4)$,
$2x + 2y = \lambda(2y - x)$,
$2x^2 + y^2 - xy - 4x = 0$.
$\\$
$2x + 2y = \lambda(4x - y - 4)$
$\implies \lambda = \dfrac{2x + 2y}{4x - y - 4} \forall \ 4x - y - 4 \not= 0$
$\\$
$2x + 2y = \lambda(2y - x)$
$\implies \dfrac{2x + 2y}{2y - x} \forall \ 2y - x \not= 0$
$\\$
$\therefore \dfrac{2x + 2y}{4x - y - 4} = \dfrac{2x + 2y}{2y - x} \forall \ y \not= \dfrac{x}{2}, y \not= 4x - 4$ Remember this part: This is where my confusion lies.
But if we continue with our reasoning, we get the following (correct) points of potential maxima/minima:
$(x,y) = (0,0)$, $(x,y) = (1, -1)$, $(x,y) = (2,2)$, and $(x,y) = \left(\dfrac{2}{7}, \dfrac{-6}{-7}\right)$.
And, finally, using these points we find that $f_{max} = 16$ at $(x,y) = (2,2)$, and $f_{min} = 0$ at $(x,y) = (0,0)$ and $(x,y) = (1,-1)$.
But here's the problem: We had above that $y \not= \dfrac{x}{2}$; therefore, $(x,y) = (0,0)$ would get us $0 \not= \dfrac{0}{2} \implies 0 \not= 0$, which is obviously false. Also, as we just saw, $(0,0)$ is a solution for $f_{min}$!
The algebra here is confusing me, since we cannot have $y = \dfrac{x}{2}$, but $(0,0)$ is apparently the minima. Is this not a contradiction? Did I do something wrong? Or am I supposed to discard the solution $(0,0)$ and just have $f_{min} = 0$ at $(1, -1)$? What am I misunderstanding?
I would greatly appreciate it if people could please take the time to clarify this.
 [/INST] You don't have to solve like that and exclude $x=2y$ or other limitations.
The system 
$
\left\{ {\begin{array}{*{20}{l}}
  {2x + 2y = \lambda \left( {4x - y - 4} \right)} \\ 
  {2x + 2y = \lambda \left( {2y - x} \right)} \\ 
  {2{x^2} + {y^2} - xy - 4x = 0} 
\end{array}} \right.
$
can be solved looking at the first two equations
which say
$\lambda \left( {4x - y - 4} \right)= \lambda \left( {2y - x} \right) $
and then
$4x-y-4=2y-x\to y=\frac{1}{3} (5 x-4)$ 
substitute in the third
$2 x^2-\frac{1}{3} (5 x-4) x-4 x+\frac{1}{9} (5 x-4)^2=0$
expand and simplify
$7 x^2-16 x+4=0\to x_1=\dfrac{2}{7};\;x_2=2$
$y_1=-\dfrac{6}{7};\;y_2=2$
Plug these values in the first equation to get
$4+4=\lambda(8-2-4)\to \lambda=4$
Substitute in the second
$2x+2y=4(2y-x) \to 6(x-y)=0 \to x=y$
which can be plugged in the third and give
$2x^2+x^2-x^2-4x^2=0\to x_3=0;\;y_3=0$
this last $(0,0)$ is the minimum for the given function, while according to my calculations $(2,2)$ gives the maximum
</s>