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