<s>[INST] 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?
 [/INST] 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.
</s>