# Distance from point to z=xy

1. Oct 13, 2011

### sandy.bridge

1. The problem statement, all variables and given/known data
Hello, looking for some help regarding the shortest distance from a point to z=xy.

If R=(X, Y, Z) is the point on the surface closest to P=(0, 0, 1), then L[\b] is a vector normal to the surface and L[\b]=Xi+Yj+(z-1)k

n[\b]=yi+xj-k is the normal vector, and there exists some scalar quantity such that L[\b]=tn[\b]

thus, ty=X, tx=Y, z-1=-t

From here. no matter what it seems like i cant do anything...

2. Oct 13, 2011

### Bacle2

If I understand well, the equation of a plane tangent to the surface at a point is:

zx(x-xo)+zy(y-yo)-(z-zo)=0

Maybe you can minimize the function d((0,0,1), (x,y,xy))

3. Oct 13, 2011

### sandy.bridge

can you elaborate a bit on that???
Ive never seen it done that way haha

4. Oct 13, 2011

### sandy.bridge

Ive tried two different approaches, however, they all seem to end up with variables in the answer..

5. Oct 14, 2011

### Bacle2

Do you mean finding the minimum:

I guess what you were doing, if I understood correctly, was projecting into the normal vector right?

If not, the general distance(squared) from (0,0,1) to (x,y,xy) , i.e., the surface z=xy, is:

(x-0)2+(y-0)2+(xy-1)2

The minimum here would be given by the point in the surface that minimizes the distance.

Just plain calculus gives you the minimum.

6. Oct 14, 2011

### sandy.bridge

as far as I know, I have not learnt how to calculate max/min values with a multivariable function. We are just learning the definition of a partial derivative. I may be mistaken though.

7. Oct 14, 2011

### sandy.bridge

I figured it out. With a little bit of digging I found some notes on critical points for partial derivatives. Thanks again! I found the minimum distance to be 1, as x=0 and y=0 were critical points.

8. Oct 16, 2011

### Bacle2

9. Oct 17, 2011

### HallsofIvy

This problem leads naturally to the "Lagrange multiplier" method. If we want to find the point on the surface closest to point p, we can calculate the gradient, the vector pointing in the direction of fastest increase, of the distance function. Since we want "decrease" to get closest, we would want to move in the direction opposite to the gradient. But that will point off the surface so the best we can do is move in the direction of the "projection" of the (reverse) gradient on the surface. We can do that until there is NO projection. That occurs, as you said initially, when the gradient is perpendicular to the plane. And if we write the plane in the form F(x,y,z)= constant, we know that $\nabla F$ is normal to the surface. That is, to minimize the distance function (or its square) to a point not on the plane, the two gradients must point in the same direction- one must be a multiple of the other.

In this case, it is easier to work with distance squared, $D2(x,y,z)= x^2+ y^2+ (z- 1)^2$ for a any point (x,y,z) on the surface. Its gradient is $2x\vec{i}+ 2y\vec{j}+ 2(z-1)\vec{k}$. We can write the surface as f(x,y,z)= xy- z= 0, a constant. Its gradient is $\vec{i}+ \vec{j}- \vec{k}$.

The two gradients must be parallel so one must be a multiple of the other:
$$2x\vec{i}+ 2y\vec{j}+ 2(z- 1)\vec{k}= \lambda(\vec{i}+ \vec{j}- \vec{k})$$
where $\lambda$, the "Lagrange multiplier" is the constant multiple.
That gives three equations: $2x= \lambda$, $2y= \lambda$, $2(z- 1)= -\lambda$.

I find that the simplest way to eliminate $\lambda$, which is not relevant to the solution, and solve the equations is to divide one equation by another. For example, if we divide the first equation by the second we get $2x/2y= x/y= 1$ or just y= x. If we divide the first equation by the third, we get $2x/2(z-1)= x/(z-1)= 1$ so x= z- 1.

Of course, the point (x,y,z) lies on the plane so we can use the equation of the plane, xy= z together with y= x= z- 1 to find the specific values of x, y, and z.