Let $C$ be the curve of intersection of the plane $x+y-z=0$ with ellipsoid $\frac{x^2}4+\frac{y^2}5+\frac{z^2}{25}=1$. Let $C$ be the curve of intersection of the plane $x+y-z=0$ and the ellipsoid $$\frac{x^2}4+\frac{y^2}5+\frac{z^2}{25}=1$$ Find the points on $C$ which are farthest and nearest from the origin
When dealing with constraints I tried to consider the function $$F(x,y,z)=x^2+y^2+z^2-\lambda(x+y-z)-\mu\left(\frac{x^2}4+\frac{y^2}5+\frac{z^2}{25}-1\right)$$ However, I cannot solve this equation after differentiating respect to $x,y,z$ because it yields three equations with no common solution. 
The system of equations are 
$$2x=\lambda+\frac{\mu x}{2}$$
$$2y=\lambda+\frac{2\mu y}{5}$$
$$2z=-\lambda+\frac{2\mu z}{25}$$
How would I approach this problem, thanks.
 A: Since there's a computer result posted now, I guess I'll describe my approach further.  From the set of "Lagrange equations" you describe, we can solve each one for  $ \ \lambda \ $ to establish
$$ \lambda \ = \left ( \ 2 \ - \frac{\mu}{2} \right ) \ x \ = \left ( \ 2 \ - \frac{2\mu}{5} \right) \ y \ = \left( \   \frac{2\mu}{25} \ - 2 \right ) \ z \ \ . $$
We can solve the implied pairs of equations for $ \ x \ $ and $ \ y \ $ in terms of $ \ z \ $  ; inserting these into the equation for the "constraint plane" $ \ x \ + \ y \ = \ z \ $  yields
$$ \ \frac{4 \ (\mu \ - \ 25)}{25 \ (4 \ - \ \mu )} \ + \ \frac{\mu \ - \ 25}{5 \ (5 \ - \ \mu )} \ = \ 1 \ \ , $$
leading to the quadratic equation $ \  34 \mu^2 \ - \ 490 \mu \ + 1500 \ = \ 0 \ $ , for which the solutions are $ \ \mu \ = \ 10 \ $ and $ \ \mu \ = \ \frac{75}{17} \ $  .
The first solution, $ \ \mu \ = \ 10 \ $ , used in the proportionality relation among the coordinates gives us  $ \ x \ = \ \frac{2}{5}  z \ $ and  $ \ y \ = \ \frac{3}{5}  z \ $ .  We can now use these in the equation for the ellipsoidal contraint surface to find  
$$ z^2 \ = \ \frac{125}{19} \ \ \Rightarrow \ \ x \ = \ \pm 2 \sqrt{\frac{5}{19}} \ \ , \ \ y \ = \ \pm 3 \sqrt{\frac{5}{19}} \ \ , \ \ z \ = \ \pm 5 \sqrt{\frac{5}{19}} \ \ . $$
Similarly, the second solution, $ \ \mu \ = \ \frac{75}{17} \ $ , produces the proportions  $ \ x \ = \ 8  z \ $ and  $ \ y \ = \ -7  z \ $ for the points on the intersection curve found from
$$ z^2 \ = \ \frac{100}{2584} \ = \ \frac{25}{646} \ \ \Rightarrow \ \ x \ = \  \pm \frac{40}{\sqrt{646}} \ \ , \ \ y \ = \ \mp \frac{35}{\sqrt{646}} \ \ , \ \ z \ = \ \pm \frac{5}{\sqrt{646}} \ \ . $$
The first pair represents the maximal-distance points with 
$$ s^2 \ = \ (2^2 \ + \ 3^2 \ + \ 5^2 ) \ \cdot \ \frac{5}{19} \ = \ 10 \ \ $$
and the second pair are the minimal-distance points with
$$ s^2 \ = \ (8^2 \ + \ [-7]^2 \ + \ 1^2 ) \ \cdot \ \frac{25}{646} \ = \ \frac{75}{17} \ \ \approx \ \ 4.4118 \ \ . $$  [These are confirmed by  111's Sage output.]
We see that these coordinate sets do satisfy the constraint $ \ x \ + \ y \ = \ z \ $ , which also explains why there are just two points for each solution in $ \ \mu \ $ . [The number $ \ 646 \ $ factors as $ \ 17  \cdot  19 \ $ , which clarifies the results shown in the computer results.]
We would expect the points of minimal and maximal distance from the origin to be arranged with some sort of symmetry, since the ellipsoid is centered on the origin with its axes parallel to the coordinate axes and the plane passes through the origin and is symmetrical about the plane $ \ x \ = \ y \ $ .  (We should not expect the coordinate values to be too "pretty", since the proportionality of the ellipsoid's axes are 2 : √5 : 5 .)  
Here is a graph of the geometrical arrangement, showing one minimal-distance and one maximal-distance point; the partners of each pair are not visible.

A: Since I am lazy to do it by hands, I give you the sage code.
$###lagrange method
sage:x, y, z, lam , mu= var('x, y, z, lam, mu')  
sage:f=x^2+y^2+z^2  
sage:g1 = x^2/4+y^2/5+z^2/25-1 
sage:g2 = x +y -z  
sage:h = f - g1 * lam -g2 * mu  
sage:gradh = h.gradient([x, y, z, lam, mu])  
sage:critical = solve([gradh[0] == 0, gradh[1] == 0, gradh[2] == 0, gradh[3] == 0, gradh[4] == 0],x, y, z, lam, mu, solution_dict=True)   
sage:for i in range(0,len(critical)):      
   print show(critical[i]),float(f(critical[i][x], critical[i][y], critical[i][z]));

you shall get
$\left\{z : \frac{5}{646} \, \sqrt{2} \sqrt{17} \sqrt{19}, x :
\frac{20}{323} \, \sqrt{2} \sqrt{323}, y : -\frac{35}{646} \, \sqrt{2}
\sqrt{17} \sqrt{19}, \mbox{lam} : \frac{75}{17}, \mu : -\frac{70}{5491}
\, \sqrt{2} \sqrt{17} \sqrt{19}\right\} 4.41176470588$
$
\left\{z : -\frac{5}{646} \, \sqrt{2} \sqrt{17} \sqrt{19}, x :
-\frac{20}{323} \, \sqrt{2} \sqrt{323}, y : \frac{35}{646} \, \sqrt{2}
\sqrt{17} \sqrt{19}, \mbox{lam} : \frac{75}{17}, \mu : \frac{70}{5491}
\, \sqrt{2} \sqrt{17} \sqrt{19}\right\} 4.41176470588$
$\left\{z : \frac{5}{19} \, \sqrt{5} \sqrt{19}, x : \frac{2}{19} \,
\sqrt{5} \sqrt{19}, y : \frac{3}{19} \, \sqrt{5} \sqrt{19}, \mbox{lam} :
10, \mu : -\frac{6}{19} \, \sqrt{5} \sqrt{19}\right\} 10.0$
$\left\{z : -\frac{5}{19} \, \sqrt{5} \sqrt{19}, x : -\frac{2}{19} \,
\sqrt{5} \sqrt{19}, y : -\frac{3}{19} \, \sqrt{5} \sqrt{19}, \mbox{lam}
: 10, \mu : \frac{6}{19} \, \sqrt{5} \sqrt{19}\right\} 10.0
$
So you have two points where f has minimum 4.411 and two points where you have the maximum 10.
A: You can simplify the problem by using $z=x+y$.
Then you minimize
$$x^2+y^2+(x+y)^2+\lambda\left(\frac{x^2}4+\frac{y^2}5+\frac{(x+y)^2}{25}-1\right).$$
by
$$\begin{cases}x+x+y+\lambda\left(\dfrac{x}4+\dfrac{x+y}{25}\right)=0,
\\y+x+y+\lambda\left(\dfrac{y}5+\dfrac{x+y}{25}\right)=0.\end{cases}$$
Eliminating $\lambda$, you end-up with
$$-\frac{xy}{10}+\frac{4y^2}{25}-\frac{21x^2}{100}=\frac{(7x+8y)(2y-3x)}{100}=0.$$
Now you intersect these two lines with the ellipse$$\frac{x^2}4+\frac{y^2}5+\frac{(x+y)^2}{25}-1=0$$ by eliminating $y$ and solving for $x$.
$$x=\pm\sqrt{\frac{800}{323}},y=-\frac78x,z=\frac18x,$$
or
$$x=\pm\sqrt{\frac{20}{19}},y=\frac32x,z=\frac52x.$$
The corresponding squared distances are
$$\frac{800}{323}\left(1+\frac{49}{64}+\frac1{64}\right)=\frac{75}{17}$$ and 
$$\frac{20}{19}\left(1+\frac{9}{4}+\frac{25}{4}\right)=10.$$
