Determining points on a 3-dimensional intersection closest to the origin I was presented with this question in a lab:

Use the method of Lagrange Multipliers to solve the following. Be sure to let
  Mathematica do all the heavy lifting for you. Determine the points that lie on the intersection of the ellipsoid
  $$ x^2+y^2+9z^2=25 $$
  and the plane
  $$ x+3y-2z=0 $$
  that are closest and furthest from the origin.

Completely lost, can anyone help?
 A: You want to minimise the distance squared from the origin, $x^2+y^2+z^2$, subject to the two conditions $ x^2+y^2+9z^2-25=0 $ and $x+3y-2z=0$. Using Lagrange multipliers means finding the stationary points of
$$ L = x^2+y^2+z^2 -\lambda(x^2+y^2+9z^2-25) -\mu(x+3y-2z), $$
considered as a function of $(x,y,z,\lambda,\mu)$, and then determining which of the extrema are actually minima and maxima.
Therefore, differentiate $L$ with respect to all five variables and solve all of these being zero for $x,y,z,\lambda,\mu$, and then plug $x,y,z$ into $x^2+y^2+z^2$ to find the minima and maxima.
A: By subtracting the first constraint from the expression for the squared distance from the origin results in $-8z^2+25$ as equivalent to the function to be minimized, given the constraints. Thus the maximum occurs for $z=0$, and the maximum distance from the origin is five. This is almost obvious, because the first constraint defines an oblate spheroid centered on the origin, and the second constraint defines a plane through the origin. You can then use Lagrange multipliers to find the minimum, if you must. Otherwise, let me suggest the substitutions $X=x+3y$ and $Y=3x-y$. The constraint plane now passes through the Y axis, and the spheroid constraint remains rotationally symmetric about the z axis.
