<s>[INST] How to find the maximum value of $x^2+y^2+z^2$ after applying the technique of Lagrange multipliers (complicated set of equations)? I need to show that the maximum or the minimum of $f(x,y,z)=x^2+y^2+z^2=r^2$ given that $$(x^2+y^2+z^2)^2=\frac{x^2}{a^2}+\frac{y^2}{b^2}+\frac{z^2}{c^2}\tag{1}$$ and $$\lambda x+ \mu y+ \gamma z=0\tag{2}$$ is given by the equation $$\frac{a^2\lambda^2}{1-a^2r^2}+\frac{b^2\mu^2}{1-b^2r^2}+\frac{c^2\gamma^2}{1-c^2r^2}=0$$
My Approach:
Say $$g(x,y,z)=(x^2+y^2+z^2)^2-(\frac{x^2}{a^2}+\frac{y^2}{b^2}+\frac{z^2}{c^2})$$
and 
$$h(x,y,z)=\lambda x+ \mu y+ \gamma z$$
Using the method of Lagrange multipliers I get 
$f_x=Ag_x+Bh_x$
$f_y=Ag_y+Bh_y$
$f_z=Ag_z+Bh_z$
Where $A$ and $B$ are constants.
Hence we get:
$$
\begin{cases}
2x=A(2(x^2+y^2+z^2)(2x)-2x/a^2)+B\lambda,\\
2y=A(2(x^2+y^2+z^2)(2y)-2y/b^2)+B\mu,\\
2z=A(2(x^2+y^2+z^2)(2z)-2z/c^2)+B\gamma.
\end{cases}\tag{*}
$$
Somehow I need to eliminate $A$ and $B$, but the direct method is too lengthy.
I'm not sure how to elegantly reach $$\frac{a^2\lambda^2}{1-a^2r^2}+\frac{b^2\mu^2}{1-b^2r^2}+\frac{c^2\gamma^2}{1-c^2r^2}=0$$
from here. Any suggestions? 
 [/INST] Hint: multiply the first equation in (*) by $x$, the second one by $y$ and the third one by $z$, then sum them up. You will get rid of $B$ and can find $A$ in terms of $r$. After simplification you will be able to express $x,y,z$ easily and substitute into (2). The parameter $B$ cancels out at the end.
</s>