Lagrange multipliers from hell - extreme edition When I was a young and innocent boy, a few years ago, I posted this question on Lagrange Multipliers - Lagrange multipliers from hell
4 years later, not much has changed.
Let $\Gamma$ be the intersection of the ellipsoid $\frac{x^2}{a_1^2}+\frac{y^2}{a_2^2}+\frac{z^2}{a_3^2} = 1$ and the plane $b_1x+b_2y+b_3z=0$.
We wish to find the points on $\Gamma$ that are closest to the origin, and that are farthest from the origin.
What I tried:
We wish to find conditional extremum of $f(x,y,z)= \frac{1}{2}(x^2+y^2+z^2)$ given constraints $g_1(x,y,z) = \frac{x^2}{a_1^2}+\frac{y^2}{a_2^2}+\frac{z^2}{a_3^2} -1 = 0$ and $g_2(x,y,z) = b_1x+b_2y+b_3z = 0$
Hence our system is:
$\begin{cases}(x,y,z) = \lambda_1(\frac{2}{a_1^2}x, \frac{2}{a_2^2}y, \frac{2}{a_3^2}z) + \lambda_2(b_1,b_2,b_3) \\ \frac{x^2}{a_1^2}+\frac{y^2}{a_2^2}+\frac{z^2}{a_3^2} -1 = 0 \\ b_1x+b_2y+b_3z = 0\end{cases}$
there are several approaches we can take now. None are very good.
The most tempting one is to say $x = \frac{-b_2y-b_3z}{b_1}$ to get rid of at least one variable, but alas, we don't know if $b_1 \neq 0$. We know that at least one of $b_1,b_2,b_3 \neq 0$ but we don't know which.
Another approach would be to say $x^2 = a_1^2 - \frac{a_1^2}{a_2^2}y^2 - \frac{a_1^2}{a_3^2}z^2$
Combine that with the fact that $b_1^2x^2 = (-b_2y-b_3z)^2$ and you get $a_1^2b_1^2 - \frac{a_1^2b_1^2}{a_2^2}y^2 - \frac{a_1^2b_1^2}{a_3^2}z^2 =(-b_2y-b_3z)^2 $
But now we have an equation that has both $y,z$ and $y^2,z^2$, that doesn't look too promising.
A third approach would be to completely abandon $x,y,z$ and move over to the world of lambdas: $x_1 = \frac{a_1^2b_1\lambda_2}{a_1^2-2\lambda_1}$ etc.
Again we run into the problem of having to split into cases where $a_1^2 = 2\lambda_1$, OR $a_2^2 = 2\lambda_1$, OR $a_3^2 = 2\lambda_1$.
This is a straggering amount of combinations to check and cases to split.
I'm doing something really wrong. 
A final approach I thought of was maybe trying to parametrize the $\Gamma$ as we know it's an elipse. But we can't do that really if we don't know which $b$ isnt zero.
4 years have passed, all I've done is increase the pain.
 A: To parametrize the ellipse we can choose a basis for the plane that is


*

*$v_1=(b_2,-b_1,0)$

*$v_2=(0,b_3,-b_2)$


then the generic point in the plane is


*

*$P(s,t)=sv_1+tv_2=(sb_2,-sb_1+tb_3,-tb_2)$


Then the problem to solve becomes in two variables
$$\begin{cases}f(s,t)=(sb_2)^2+(-sb_1+tb_3)^2+(-tb_2)^2\\\frac{(sb_2)^2}{a_1^2}+\frac{(-sb_1+tb_3)^2}{a_2^2}+\frac{(-tb_2)^2}{a_3^2} =1\end{cases}$$
Another possible strategy could be to perform a rotation of the system in such way that the given plane coincide with the x-y plane with equation z=0. In this way we obtain an equivalent problem in two variables.
For the rotation we can assume as basis the normal vector to the plane $v_3=(b_1,b_2,b_3)$ the vector $v_1$ orthogonal to $v_3$ and lying in the x-y plane and $v_2=v_3\times v_1$.
The rotation can obtained by


*

*$v_1 \to x$

*$v_2 \to y$

*$v_3 \to z$


that is by the inverse of the matrix $M=[v_1\quad v_2 \quad v_3]$.
But I think that the first method leads to something simpler.
