<s>[INST] How to apply Lagrange Multipliers with modulus ?? 
I had the question $$x^2+y^2+xy=1$$ and I had to find maximum value of $$\vert xy(x^2+y^2) \vert$$

I tried using Lagrange multipliers by forming
$x^3+3xy^2 = \lambda (2y+x)$
And $y^3+3yx^2 = \lambda (2x+y)$
Now I subtract it to get $(x-y)^3 = \lambda (y-x)$
And as $\lambda ≠ 0 , x=y.$ This gives$ x = {1 \over \sqrt{3}}$ and the expression gives max as $\frac{2}{9}$ but the answer is $2$ . What have I done wrong.
I know it's modulus , but with negative too, there will only be a change in the sign of $\lambda$ which will not affect any working.
Also Lagrange Multipliers is something I read as an extra piece of info online, so maybe I might be missing something trivial here.
Also is there any requirement on $\lambda$ to be positive ??
 [/INST] Hint.
Following the fact
$$
\max |f| = \max(-f,f) \ \ \text{and}\ \ \min |f| = \min(-f,f)
$$
With $f = x y(x^2+y^2)$ the lagrangian can be established as
$$
L(x,y,\lambda) = s f+\lambda(x^2+y^2+x y -1)
$$
where $s=\pm$
The stationary points are given by
$$
\nabla L = 0 = \left\{
\begin{array}{rcl}
 2 s y x^2+\lambda  (2 x+y)+s y \left(x^2+y^2\right)&=&0 \\
 2 s x y^2+\lambda  (x+2 y)+s x \left(x^2+y^2\right)&=&0 \\
 x^2+y x+y^2-1 &=&0\\
\end{array}
\right.
$$
and solving we have
$$
\left[
\begin{array}{ccc}
s f & x & y \\
 -2 s & -1 & 1 \\
 -2 s & 1 & -1 \\
 \frac{2 s}{9} & -\frac{1}{\sqrt{3}} & -\frac{1}{\sqrt{3}} \\
 \frac{2 s}{9} & \frac{1}{\sqrt{3}} & \frac{1}{\sqrt{3}} \\
\end{array}
\right]
$$
NOTE
Due to its homogeneity the problem, using $y = \mu x$, can be transformed into one without restrictions as
$$
f(\mu) = \frac{\mu(1+\mu^2)}{(1+\mu+\mu^2)^2}
$$
</s>