# Distance from origin to a surface

1. Jan 18, 2014

### noelo2014

Had this question on a test today, Find the shortest distance from the origin to the surface

xyz2=2

I figured out by intuition that the shortest line between the origin to the surface will also be normal to the surface.

I haven't done much of these functions in 3 variables, I read somewhere that the gradient at the point on the surface will denote the normal line.

Last edited: Jan 18, 2014
2. Jan 19, 2014

### JJacquelin

z²=2/(xy)
d²=x²+y²+z²=x²+y²+2/(xy)
Partial derivative relative to x :
2x-2/(x²y)=0
Partial derivative relative to y :
2y-2/(xy²)=0
Solving the equations y*(x^3)=x*(y^3)=1 leads to :
x=y=1
then z=sqrt(2)
min.distance d=2

3. Jan 19, 2014

### noelo2014

I'm not that smart, you'll have to explain a bit more clearly.
I'm guessing d is the distance.
I guess you're using the distance formula in line 2. I guess x,y and z refer to the x,y and z coordinate of the point on the surface nearest the origin.

I think you need some more brackets too. I think I see what you're doing though... Too bad 2 was the first number I guessed, should have just wrote it down!

4. Jan 19, 2014

### JJacquelin

Write it yourself. So, it will be possible to correct you if there is something that you don't make correctly.

5. Jan 21, 2014

### HallsofIvy

Another way to do this: we want to minimize the distance from (0, 0, 0) to (x, y, z) subject to the condition that $xyz^2= 2$. You say you know that "the shortest line between the origin to the surface will also be normal to the surface." Okay, the normal to that surface at any point will be in the direction of the vector $\nabla (xyz^2)= yz^2\vec{i}+ xz^2\vec{j}+ 2xyz\vec{k}$. And any line through the origin to point (x, y, z) is in the direction $x\vec{i}+ y\vec{j}+ z\vec{k}$.

In order that the line through the origin be normal to the surface, those two vectors must be parallel which means one is a multiple of the other. Calling that multiplier "$\lambda$". Then we must have
$yz^2\vec{i}+ xz^2\vec{j}+ 2xyz\vec{k}= \lambda(x\vec{i}+ y\vec{j}+ z\vec{k})$
(this is equivalent to the "Lagrange multiplier" method).

So $yz^2= \lambda x$, $xz^2= y$, and $2xyz= \lambda z$ as well as the original equation of the surface, $xyz^2= 2$. That gives four equations to solve for x, y, z, and $\lambda$.

Since a value for $\lambda$ is not part of the solution, I find it typically best to eliminate $\lambda$ first by dividing one equation by another. Dividing the first equation by the second,
$$\frac{yz^2}{xz^2}= \frac{\lambda x}{\lambda y}$$
$$\frac{y}{x}= \frac{x}{y}$$
so $$y^2= x^2$$ so y= x or y= -x.
Similarly, dividing the second equation by the third
$$\frac{xz^2}{2xyz}= \frac{\lambda y}{\lambda z}$$
$$\frac{z}{2y}= \frac{y}{z}$$
$z^2=2y^2$ so $z= \sqrt{2}y$ or $z= -\sqrt{2}y$.

If $x= y$ and $z= \sqrt{2}y= \sqrt{2}x$ then $xyz^2= x(x)(2x^2)= 2x^4= 2$ so x= y= z= 1 or x= y= z= -1.

Do the other possibilities, $y= -x$ and/or $z= -\sqrt{2}y$ in the same way.