Lagrange multipliers from hell I was asked to solve this question, decided to try and solve it with lagrange multipliers as I see no other way:
"Find the closest and furthest points on the circle made from the intersection of the ball $(x-1)^2+(y-2)^2+(z-3)^2=9$ and the plane $x-2z=0$ from the point $(0,0)$".
What I did:
the distance for any point $(x,y,z)$ from the origin is $d(x,y,z)=\sqrt{x^2+y^2+z^2}$. so using lagrange multipliers we have:
$d(x,y,z)=\sqrt{x^2+y^2+z^2}$
$C_1(x,y,z)=(x-1)^2+(y-2)^2+(z-3)^2-9$
$C_2(x,y,z)=x-2z$
$L(x,y,z) = d-\lambda_1C_1-\lambda_2C_2 $ meaning:
$L(x,y,z)=\sqrt{x^2+y^2+z^2}-\lambda_1[(x-1)^2+(y-2)^2+(z-3)^2-9]-\lambda_2(x-2z)$
Let's derive and solve when derivatives are zero:
$\frac{\partial L}{\partial x}= \frac{x}{\sqrt{x^2+y^2+z^2}}-2\lambda_1(x-1)-\lambda_2=0$
$\frac{\partial L}{\partial y} = \frac{y}{\sqrt{x^2+y^2+z^2}}-2\lambda_1(y-2)=0$
$\frac{\partial L}{\partial z} = \frac{z}{\sqrt{x^2+y^2+z^2}}-2\lambda_1(z-3)+2\lambda_2=0$
$\frac{\partial L}{\partial \lambda_1} = -(x-1)^2-(y-2)^2-(z-3)^2+9=0$
$\frac{\partial L}{\partial \lambda_2} = 2z-x=0$
Solving this monstrous system seems very unlikely, and very difficult, and not how the question is meant to be solved. am I missing something?
 A: The circle can be parametrized as
$$  x = 2 + \frac{4}{\sqrt 5} \sin \theta, \; y = 2 + 2 \cos \theta, \; z =  1 + \frac{2}{\sqrt 5} \sin \theta.  $$
The squared distance of such a point from the origin is 
$$ f(\theta) = 13 + 4 \sqrt 5 \sin \theta + 8 \cos \theta.  $$
Derivative is
$$ f'(\theta ) = 4 \sqrt 5 \cos \theta - 8 \sin \theta. $$
So, the two extrema occur where $\tan \theta = \frac{\sqrt 5}{2};$ from $1 + \tan^2 \theta = \sec^2 \theta$ we get $$\sec^2 \theta = \frac{9}{4}, \cos^2 \theta = \frac{4}{9},$$ and
$$ \cos \theta = \pm \frac{2}{3}, \; \sin \theta = \pm \frac{\sqrt 5}{3}, $$ with matching $\pm.$
The farthest point from the origin is
$$ \left( \frac{10}{3}, \; \frac{10}{3}, \; \frac{5}{3}     \right),  $$
the nearest
$$ \left( \frac{2}{3}, \; \frac{2}{3}, \; \frac{1}{3}     \right).  $$
The center of the circle is at $(2,2,1),$ and the plane goes through the origin, so all we really did was find the two points on the given sphere along that line, $$ x = 2t,y=2t,z=t. $$
A: $\newcommand{\e}{\mathbf{e}}$Here's an algebraic approach:
Let $P$ denote the plane with equation $x - 2z = 0$ and $S$ the sphere
$$
(x - 1)^{2} + (y - 2)^{2} + (z - 3)^{3} = 9.
$$
The vectors $\e_{1} = (2, 0, 1)/\sqrt{5}$ and $\e_{2} = (0, 1, 0)$ are an orthonormal basis of $P$. The orthogonal projection to $P$ of $c = (1, 2, 3)$, the center of $S$, is
$$
\langle c, \e_{1}\rangle \e_{1} + \langle c, \e_{2}\rangle \e_{2}
  = \sqrt{5}\e_{1} + 2\e_{2}
  = (2, 2, 1)
  = c_{0}.
$$
Since the distance from $c$ to $c_{0}$ is $\sqrt{5}$, the intersection of $S$ and $P$ is a circle of radius $\sqrt{3^{2} - 5} = 2$ centered at $c_{0}$.
In the Cartesian coordinates defined by $\{\e_{1}, \e_{2}\}$, the center $c_{0}$ has coordinates $(\sqrt{5}, 2)$, and a bit of algebra shows the nearest point to the origin is $(\sqrt{5}, 2)/3$, while the furthest point is $5(\sqrt{5}, 2)/3$. 
Converting back to spatial coordinates, the nearest point to the origin is $(2/3, 2/3, 1/3)$ and the furthest point is $(10/3, 10/3, 5/3)$.
A: If you eliminate, say, $x$ using the second constraint, you are left with a two-variate function and a single constraint: Minimize/Maximize $d^2 = 5z^2 + y^2$ subject to $(y-2)^2 + 5(z-1)^2 = 4$. Now, a Lagrange solution is not bad. From here, you can play also with basic algebra and trig to avoid calculus altogether.
A: Directly solving the system of equations that you get from differentiating the Lagrangian really doesn’t seem all that bad. First, use the standard trick of taking the square of the distance as the objective function, per Daniel Fischer’s suggestion.  This gives you the system $$x+2\lambda-2\lambda x-\mu = 0 \\ y+4\lambda-2\lambda y = 0 \\ z+6\lambda-2\lambda z+2\mu = 0$$ along with the two constraints. From the second constraint, substitute $2z$ for $x$ in the first equation, then add $2$ times the result to the third to eliminate $\mu$: $$5(z+2\lambda-2\lambda z) = 0.$$ Solve the two remaining equations (which, by the way, are exactly the equations you’d end up with using the suggestion in this answer) for $\lambda$ and equate them to get $${y\over2(y-2)}={z\over2(z-1)}.$$ Solve for $y$ and back-substitute into the equation of the sphere to get a quadratic in $z$, the solutions to which will give you the two points you seek.
