I'm doing some Lagrange multiplier examples that I thought up and I was trying to think of an example where the method of 'solving the constraint explicitly' fails. I'm trying to maximize
$$f(x,y)=x^2 y + y^2 x$$
given the constraint
$$g(x,y)=xe^x +ye^y -1 =0$$
I made this constraint up because I'm pretty sure it can't be solved explicity for either variable. Now, I form the Lagrange function
$$F(x,y)=f(x,y)-\lambda g(x,y)$$
and differentiate w.r.t. $x$ and $y$ and solve the system of equations:
$$0=2xy+y^2- \lambda (x+1) e^x$$ $$0=2xy+x^2- \lambda (y+1) e^y$$
Theoretically I should be able to solve this for $x$ and $y$ that depend on $\lambda$ and then choose the $\lambda$ so the constraint is actually satisfied, but I don't know how to do that.
Instead, I tried 'solving' for $\lambda$ from the first one and substitute into the other and I get
$$(2xy+y^2)(y+1)e^y=(2xy+x^2)(x+1)e^x$$
Dividing by $xy$ (this excludes any points on either axis), I get
$$(2+\frac{y}{x})(y+1)e^y=(2+\frac{x}{y})(x+1)e^x$$
Which is like saying $$h(x,y)=h(y,x)$$ where $h$ is either side of the previous equation. Again, I'm not sure what to do at this point.
The constraint and function are unchanged by swapping $x$ and $y$, so the point with $y=x$ must be a maxima or minima, in this case $x=W(\frac{1}2)$ where $W$ is the Lambert W function.