If $x+y+z=3, $ and $x^2+y^2+z^2=9$ , find $\max\{y-x\}$.
I tried to do this geometrically, $x+y+z=3$ is a plane in $\Bbb{R}^3$ and $x^2+y^2+z^2=9$ is a ball with radius 3 and center of origin . So the candidate points for $y-x$ are on the intersection of the plane and the ball. But now I am confused how to choose to make $y-x$ maximized.
Our conditions give $$x^2+y^2+z^2=(x+y+z)^2$$ or $$xy+xz+yz=0.$$ Now, let $y-x=t$.
Thus, $y=x+t$, $z=3-x-y=3-2x-t$ and we obtain that the equation $$x(x+t)+(3-2x-t)(x+x+t)=0$$ has real roots $x$, which says that $\Delta\geq0.$
We obtain: $$3x^2+3(t-2)x+t^2-3t=0,$$ which gives $$9(t-2)^2-12(t^2-3t)\geq0$$ or $$-2\sqrt3\leq t\leq2\sqrt3.$$