Demand $z=x+y$ and $x^2/4 + y^2/5 + z^2/25 = 1$. What is the maximum value of $f(x,y,z) = x^2+y^2+z^2$?
I've been attempting this with Lagrange multipliers in a few different ways. However, the resulting system of equations with two lagrangians has so many variables that it becomes very complicated. Can someone show how this is to be done manually?
I also attempted turning it into two unknowns by replacing $z$ with $x+y$. However, this also led nowhere.


Beginning with the equation for the Lagrange Multipliers, it is a matter of (tedious) algebraic manipulation with a goal to systematically eliminate parameters. We have $x+y-z=0$ and $\frac{x^2}{4}+\frac{y^2}{5}+\frac{z^2}{25}=1$, $f(x,y,z)=x^2+y^2+z^2$
$$\begin{pmatrix} 2x \\ 2y \\ 2z \end{pmatrix} = \lambda \begin{pmatrix} 1 \\ 1 \\ -1 \end{pmatrix} + \gamma \begin{pmatrix} x/2 \\ 2y/5 \\ 2z/25 \end{pmatrix} \implies \begin{cases} 2x= \lambda+\frac{1}{2}\gamma x \\ 2y= \lambda+\frac{2}{5}\gamma y \\ 2z= -\lambda+\frac{2}{25}\gamma z \end{cases}$$
$$\begin{cases} \lambda = 2x-\frac{1}{2}\gamma x \\ \lambda = 2y-\frac{2}{5}\gamma y \\ \lambda = -2z + \frac{2}{25}\gamma z \end{cases} \implies \begin{cases} \frac{1}{2}\gamma x-2x = \frac{2}{5}\gamma y-2y \\ \frac{1}{2}\gamma x-2x = -\frac{2}{25}\gamma z +2z\end{cases} \implies \begin{cases} \gamma=\frac{2x-2y}{x/2-2y/5} \\ \gamma = \frac{2x+2z}{x/2+2z/25} \end{cases}$$ It then remains to solve the system of equations: $$\frac{2x-2y}{x/2-2y/5} = \frac{2x+2z}{x/2+2z/25}\ \ \ \ \wedge \ \ \ \ x+y-z=0 \ \ \ \ \wedge \ \ \ \ \frac{x^2}{4}+\frac{y^2}{5}+\frac{z^2}{25}=1$$
The solutions to this system may be any of the following: maxima, minima, or saddle points of f(x,y,z) under the given constraints.
edit: One of the resulting quadratics is factorable.
$$\frac{2x-2y}{x/2-2y/5} = \frac{2x+2z}{x/2+2z/25} \implies (x-y)(25x+4z)=(5x+5z)(5x-4y)$$ After expanding and eliminating the z variable (z=x+y), the quadratic reduces to: $$21x^2+10xy-16y^2=0$$ $$(3x-2y)(7x+8y)=0$$ Thus, we have $y=(3/2)x$ or $y=(-7/8)x$, hence, an explicit solution from the quadratic formula using the ellipsoid constraint. Plugging these back into f, we see a maximum at $f(2\sqrt{\frac{5}{19}},3\sqrt{\frac{5}{19}},5\sqrt{\frac{5}{19}})=10$.