# Crazy optimization/Lagrange questino

1. Nov 4, 2004

### daBish

Ok this is the question I had on a test today:

given this constraint equation z^2-xy+1=0 find the min. distance from the origin using Lagrange method.

so basically you use D^2=x^2+y^2+z^2 as the other equation. however, it basically goes nuts from there. especially if you set it up like you are suppose to.
Fx=(lambda)Gx
Fy=(lambda)Gy
Fz=(lambda)Gz
g=0

(capitals are partial derivatives)

with f as the distance formual and g as the constraint

this one sucks but if someone could help it would be greatly appreciated

2. Nov 8, 2004

### Galileo

Try not to minimize $D=\sqrt{x^2+y^2+z^2}$, but $D^2=x^2+y^2+z^2$.

3. Nov 8, 2004

### HallsofIvy

2. You want to minimize F= x2+ y2+ z2 subject to the condition G= z^2-xy+1=0.
so 2x= -&lambda;y, 2y= -&lambda;x, and 2z= -2&lambda;z

Divide the first equation by the second, x/y= y/x so x2= y[/sup]2[/sup] and y= x or y= -x.
From 2z= -2&lambda;z, either z= 0 or &lambda= -1.

With x= y, z= 0, since z^2-xy+1=0, we have -x2+ 1= 0 so x= +1 or -1:
(1, 1, 0) and (-1,-1,0) are possible points.

With x= -y, z= 0, since z^2-xy+1=0, we have x2+ 1=0 which is impossible.

If z is not 0, then &lambda= -1 so 2x= -&lambda;y become 2x= y and 2y= -&lambda;x becomes 2y= x: 2y= 2(2x)= 4x= x so x= y= 0. In that case z^2-xy+1=0 becomes z2+ 1= 0 which is impossible.

The two minimum distance points are (1,1, 0) and (-1,-1,0). The are both distance &radic;(2) from (0,0,0).