# Find points on surface nearest to origin

by ImAnEngineer
Tags: nearest, origin, points, surface
 P: 211 1. The problem statement, all variables and given/known data Find the points on the surface: z²-xy=1 nearest to the origin 2. Relevant equations grad(f)= lambda grad(g) (?) f(x,y,z)=z²-xy (?) g=(0,0,0) (?) 3. The attempt at a solution grad(f)=(-y, -x, 2z)= lambda (0,0,0) = (0,0,0) -y=0 => y=0 -x=0 => x=0 2z=0 => z=0 But (x,y,z)=(0,0,0) doesn't satisfy f(0,0,0)=1.
 Sci Advisor HW Helper Thanks P: 25,163 No. You want to minimize distance to the origin. Minimize f=x^2+y^2+z^2. Your constraint g is z^2-xy-1.
 Math Emeritus Sci Advisor Thanks PF Gold P: 38,879 The "f" you are using is the left side of $z^2- xy= 1$, the equation of the surface. But where have you used the function you want to minimize, the distance from the point (x,y,z) to the origin? "g= (0,0,0)" makes no sense because that is a point, not a function! The function you want to minimize is the distance from (0,0,0). That is $\sqrt{x^2+ y^2+ z^2}$. But because you know distance is always positive, that is the same as minimizing the square of distance, $x^2+ y^2+ z^2$. Your "f" is that: $f(x,y,z)= x^2+ y^2+ z^2$. The "constraint" you are given is that $g(x,y,z)= z^2- xy= 1$. Geometrically, the shortest line from (0,0,0) to that surface will be perpendicular to that surface. And, if we think of g(x,y,z)= 1 as a "level surface" of the function g(x,y,z), its gradient will be perpendicular to the surface. That is, the shortest distance will be when grad f and grad g are parallel vectors which means one is a multiple of the other: $grad f= \lambda grad g$. As I said, use $f(x,y,z)= x^2+ y^2+ z^2$ and $g(x,y,z)= x^2- xy$.
P: 211

## Find points on surface nearest to origin

Thanks a lot, I get it now :) !

I get the following system of equations:
2x-ly = 0
2y-lx = 0
z(2+2l) = 0
z²-xy = 1

And when I solve this I get (x,y,z)=(0,0,+/-1).
 P: 5 While searching for finding a solution to my problem, I came across with this thread. It would be nice if someone could explain to me geometrically what kind of vector is the $grad f=(2x,2y,2z)$. I mean, I can understand that $grad g$ is perpendicular to the surface, but I can't get why $grad f$ and $grad g$ are parallel vectors, since the distance $x^2 + y^2 + z^2$ is already a vector that passes through that point of the surface and the origin.
 P: 5 My mistake... $x^2 +y^2 + z^2$ is actually a number and not a vector. But I still can get this problem solved. I have a surface $x^2 + y^2 -z =2$ and I need to find the shortest distance from the origin. The gradient of the distance is $grad(d)=(2x,2y,2z)$ and the gradient of the the surface is $gradf(x,y,z)=(2x,2y,-1)$. Shouldn't I use lagrange multipliers? But then I have $2x= \lambda 2x$ and $2y= \lambda 2y$ and if $\lambda =1$ then I have only two equations with 3 variables which means infinite solutions. Could anyone help me out with the solution?
HW Helper
Thanks
P: 25,163
 Quote by Cevris My mistake... $x^2 +y^2 + z^2$ is actually a number and not a vector. But I still can get this problem solved. I have a surface $x^2 + y^2 -z =2$ and I need to find the shortest distance from the origin. The gradient of the distance is $grad(d)=(2x,2y,2z)$ and the gradient of the the surface is $gradf(x,y,z)=(2x,2y,-1)$. Shouldn't I use lagrange multipliers? But then I have $2x= \lambda 2x$ and $2y= \lambda 2y$ and if $\lambda =1$ then I have only two equations with 3 variables which means infinite solutions. Could anyone help me out with the solution?
There are an infinite number of solutions. The lagrange equations only determine z. What is it? Then you can use the contraint to find x^2+y^2. There are an infinite number of points lying on a circle that are the same distance from the origin. How far?
P: 5
 Quote by Dick There are an infinite number of solutions. The lagrange equations only determine z. What is it? Then you can use the contraint to find x^2+y^2. There are an infinite number of points lying on a circle that are the same distance from the origin. How far?
Oh, yes, so I have $x^2 + y^2=5/2$. So the distance is root(5/2)?

The other case is to have $x=0$ and $y=0$ and I get z=-2 from the equation of the surface. Since the length of the vector (0,0,-2) is 2 then this is the shortest distance from the surface. Is that right?
HW Helper
Thanks
P: 25,163
 Quote by Cevris Oh, yes, so I have $x^2 + y^2=5/2$. So the distance is sqrt(5/2)?
Distance to the origin from (x,y,z) is sqrt(x^2+y^2+z^2), right? And tell me what z is first.
 P: 5 z=-1/2 if I am right since λ=1.
HW Helper
Thanks
P: 25,163
 Quote by Cevris z=-1/2 if I am right since λ=1.
Ok, I'm ok with that. But then if x^2+y^2-z=2, what's x^2+y^2?
P: 5
My fault... It's 3/2 then :)
Have I dealt with the other case correctly?
 Quote by Cevris The other case is to have $x=0$ and $y=0$ and I get z=-2 from the equation of the surface. Since the length of the vector (0,0,-2) is 2 then the shortest distance from the surface is sqrt(3/2). Is that right?
Math
Emeritus
 Quote by Cevris While searching for finding a solution to my problem, I came across with this thread. It would be nice if someone could explain to me geometrically what kind of vector is the $grad f=(2x,2y,2z)$. I mean, I can understand that $grad g$ is perpendicular to the surface, but I can't get why $grad f$ and $grad g$ are parallel vectors, since the distance $x^2 + y^2 + z^2$ is already a vector that passes through that point of the surface and the origin.
Think of it this way: the gradient, $\nabla f$ always points in the direction of fastest increase so if you objective is to maximize f, you should move in the direction of f. If your objective is to minimize f, move opposite to f. In either case, move parallel to f.
You keep doing that until there is no "direction" to $\nabla f$- until is is 0 which happens when you are at (0, 0, 0). But if you are restricted to a given surface, you cannot alway move parallel to $\nabla f$. The best you can do look at the projection of $\nabla f$ onto the surface and follow that- if $\nabla f$ is a little to the right of perpendicular, go that way. You can do that until $\nabla f$ does NOT have a "projection" onto the surface- until it is perpendicular to the surface. But if the surface is given by G(x, y, z)= constant, then $\nabla G$ is perpendicular to the surface. That is, you can go no further on that surface toward your maximum of minimum of f(x,y,z) when $\nabla f$ is perpendicular to the surface which means it is in the same direction as $\nabal G$- $\nabla f$ and $\nabla G$ are parallel there which means one is a multiple of the other: [iitex]\nabla f= \lambda\nabla G[/itex].