philnow said:
I don't understand why the constraints are f(x,y,z)=0 and g(x,y,z)=0, I also don't understand what the M = condition is for... this is one of my first problems with implicitly defined functions. Anyone care to attempt to clarify? Thanks...
We want to minimize the distance to the origin, right? Well, that is given by the function D(x,y,z)=\sqrt{x^2+y^2+z^2}. But we can just choose any (x,y,z) -- we want to find the minimum value of the set {D(x,y,z) | f(x,y,z)=0 and g(x,y,z)=0}. A real number d is in this set if and only if for some point (x,y,z) the distance D(x,y,z)=d
and f(x,y,z)=0
and g(x,y,z)=0. We want to find the smallest such d. In other words, we want to find all points (x0,y0,z0) on your implicitly defined curve whose distance D(x0,y0,z0) from the origin is less than or equal to the distance from the origin of all the other points on that curve.
But how do we do this? Let's ignore g(x,y,z) for a moment and try to how to minimize D(x,y,z) subject only to f(x,y,z)=0:
Recall that the gradient of a function is a vector pointing in the direction of fastest descent. Keeping this in mind, suppose that \nabla D is parallel to \nabla f at some point (x,y,z). What does this mean? Well, the definition of parallel vectors says that at that point,
\nabla D+\lambda \nabla f=0
for some number \lambda. Here's the cool part: if that point satisfies our requirement that f(x,y,z)=0, then \nabla f vanishes, and the above equation gives
\nabla D=0;
in other words, that point is an extremum of D(x,y,z)! Thus, all we need to do is solve the system of equations
\begin{align*}<br />
\nabla D+\lambda \nabla f &= 0\\<br />
f(x,y,z) &= 0<br />
\end{align*}
for x,y,z,\lambda, and \mu.
Ok, so how do we work in the condition g(x,y,z)=0? Well, since we already have the gradients of D and f parallel, we don't want to disturb that. So, let's try making both of those also parallel to \nabla g. In other words, we want points such that
\nabla D +\lambda\nabla f + \mu\nabla g=0
for some \lambda and \mu. Now here's where the cool part comes in again: if g(x,y,z)=0
and f(x,y,z)=0, then both of their gradients vanish, and \nabla D=0! Thus, all we need to do is solve the system of equations
<br />
\begin{align*}<br />
\nabla D+\lambda \nabla f +\mu\nabla g&= 0\\<br />
f(x,y,z) &= 0\\<br />
g(x,y,z) &= 0<br />
\end{align*}<br />
for x,y,z,\lambda, and \mu.
Incidentally, this is where the M= condition you asked about came from. If we define M=D+\lambda f +\mu g, then setting the gradient of M equal to zero gives the first equation in the system, and setting the derivatives with respect to \lambda and \mu equal to zero gives the second and third.