The constraint function, #g(x,y)# must be written in a form that is equal to zero:
#g(x,y) = xy-1 = 0#
Write the Lagrange function:
#\mathcalL(x,y,lambda) = f(x,y)+lambdag(x,y)#
#\mathcalL(x,y,lambda) = xy^2e^y-e^x+lambda(xy-1)#
#\mathcalL(x,y,lambda) = xy^2e^y-e^x+lambdaxy-lambda#
Compute the partial derivatives:
#(del\mathcalL(x,y,lambda))/(delx) = y^2e^y-e^x+lambday#
#(del\mathcalL(x,y,lambda))/(dely) = 2xye^y+ xy^2e^y+lambdax#
#(del\mathcalL(x,y,lambda))/(dellambda) = xy-1#
Set the partial derivatives equal to 0 and solve as a system of non-linear equations:
#0 = y^2e^y-e^x+lambday" [1]"#
#0 = 2xye^y+ xy^2e^y+lambdax" [2]"#
#0 = xy-1" [3]"#
Write equation [1] as #e^x = ...#
#e^x = y^2e^y+lambday" [4]"#
Because #g(x,y)# stipulates that #x!=0#, we can divide equation [2] by x:
#0 = 2ye^y+ y^2e^y+lambda#
Solve for lambda
#lambda = -2ye^y- y^2e^y" [5]"#
Substitute into equation [4]:
#e^x = y^2e^y+y(-2ye^y- y^2e^y)" [6]"#
Write equation [3] and as y in terms of x:
#y = 1/x" [7]"#
Here is a graph of equations [6] and [7]:
graph{(y^2e^y+y(-2ye^y- y^2e^y)-e^x)(xy-1)=0 [-10, 10, -5, 5]}
The intersection points are:
#(-0.459806,-2.17483)# and #(-0.224898,-4.44647)#
#f(-0.459806,-2.17483) = -0.87853#
#f(-0.224898,-4.44647)= -0.85071#