If $x$, $y$, and $z$ are real numbers such that $x+y+z=8$ and $x^2+y^2+z^2=32$, what is the largest possible value of $z$? I tried swapping $z$ from the first equation to the second, and got $$x^2 + x y - 8 x + y^2 - 8 y + 16=0$$ Not sure where to go from there, and if I'm on the right track at all.
 A: \begin{align*}
x^2+(8-x-z)^2+z^2&=32\\
x^2-(8-z)x+z^2-8z+16&=0
\end{align*}
As $x$ is real,
\begin{align*}
[-(8-z)]^2-4(1)(z^2-8z+16)&\ge0\\
3z^2-16z&\le 0\\
0\le z&\le\frac{16}{3}
\end{align*}
The largest value of $z$ is $\displaystyle \frac{16}{3}$.
A: Use  the method of Lagrange multipliers for finding the local maxima  of the function $F(x,y,z)=z$  subject to the  equality constraints.
We have 
$$
F(x,y,z,\lambda, \mu)=z+\lambda\, \left( x+y+z-8 \right) +\mu\, \left( {x}^{2}+{y}^{2}+{z}^{
2}-32 \right).
$$
Then we get the system 
\begin{cases}
x+y+z-8=0,\\2\,\mu\,x+\lambda=0,\\2\,\mu\,y+\lambda=0,\\2\,\mu\,z+\lambda+1=0,\\{x}^{2}+{y}^{2}+{z}^{2}-32=0.
\end{cases}
The solutions are 
$$
 \left\{ \mu=1/8,x=4,y=4,z=0,\lambda=-1 \right\} , \left\{ \mu=-1/8,x
=4/3,y=4/3,z=16/3,\lambda=1/3 \right\}, 
$$
so the maximal value of $z$ is $\dfrac{16}{3}.$
A: The equations are those of a sphere of radius $\sqrt{32}$ centered at the origin and a plane with normal $(1,1,1)$ at a distance of $8/\sqrt3$ from the origin. Their intersection is a circle in that plane centered on the nearest point of the plane to the origin. By the Pythagorean theorem, the point on this circle with the greatest $z$-coordinate (which is one of the points of intersection of the circle with the plane spanned by our plane normal and the $z$-axis) is 
$$\frac83(1,1,1)+\sqrt{32 - \left(\frac8{\sqrt3}\right)^2}\cdot\frac1{\sqrt{6}}(-1,-1,2) = \frac43(1,1,4),$$ 
therefore, the maximum $z$-coordinate is $\frac{16}3$. The vector $(-1,-1,2)$ is computed as $[(1,1,1)\times(0,0,1)]\times(1,1,1)$, which gives us a vector that’s orthogonal to $(1,1,1)$ and lies in the plane spanned by $(1,1,1)$ and the $z$-axis.
A: Writing the root-mean square inequality in the form $\;\displaystyle\frac{a^2+b^2}{2} \ge \left(\frac{a+b}{2}\right)^2\;$ which holds for all $\,a,b \in \mathbb{R}\,$ regardless of signs, and using that the largest of $\,x,y,z\,$ must be $\,z \gt 0\,$:
$$
\begin{alignat*}{3}
\frac{x^2+y^2}{2} \ge \left(\frac{x+y}{2}\right)^2 \;\;&\iff\;\; \frac{32-z^2}{2} \ge \left(\frac{8-z}{2}\right)^2 \;\;&&\iff\;\; 2(32-z^2) \ge (8-z)^2 \\
 &\iff\;\; z(16-3z) \ge 0 \;\;&&\iff\;\; z \le \frac{16}{3}
\end{alignat*}
$$
The equality case $\,z = \dfrac{16}{3}\,$ is attained for $\,x = y\,$.
A: Hint:
Replace the value of $x$ with $-y-z$ to form a quadratic equation in $y$
As $y$  is real, the discriminant must be $\ge0$
A: I am trying to show that the optimal solution must have $x=y$. 
The convexity or norm says for any 
$\lambda \in (0,1)$, 
$$ \lVert \lambda (x_1, y_1) + (1-\lambda) (x_2, y_2) \rVert < \lambda \lVert (x_1, y_1) \rVert + (1-\lambda) \lVert (x_2, y_2) \rVert
$$ 
Where $\lVert (x,y) \rVert = \sqrt{x^2 + y^2}$
Since whenever $(x, y, z)$ is a solution $(y, x, z)$ is also a solution, at any point on the line segment between $(x, y)$ and $(y, x)$, the linear equality continues to be satisfied, while the quadratic term only gets smaller. 
I am not sure, but with this we might be able to conclude that the maximum value of z should be attained at $x=y$.
A: $$\max z$$
subject to $$x+y+z=8$$
$$x^2+y^2+z^2=32$$
The Lagrangian is $$z-\lambda(8-x-y-z)-\mu(32-x^2-y^2-z^2)$$
Differentiating wrt x:
$$8\lambda+2\mu x=0\tag{1}$$
Differentiating wrt $y$:
$$8\lambda+2\mu y=0\tag{2}$$
Differentiating wrt $z$:
$$1+8\lambda+2\mu z=0\tag{3}$$
If $\mu=0$, equation $(1)$ and $(2)$ gives us $\lambda=0$ and we get a contradiction in equation $(3)$.
Hence $\mu \ne 0$. From equation $(1)$ and $(2)$, we get $x=y$.
$$2x+z=8$$
$$2x^2+z^2=32$$
$$2\left( \frac{8-z}2\right)^2+z^2=32$$
$$\left( 8-z\right)^2+2z^2=64$$
$$3z^2-16z=0$$
$$z(3z-16)=0$$
Hence maximum $z$ occurs at $\frac{16}3$
