Find $\max\{y-x\}$ 
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. 

Note that $y^2=(3-x-z)^2=9-x^2-z^2\implies z^2+(x-3)z+(x^2-3x)=0$ so $$2z=3-x\pm\sqrt3\sqrt{3+x-x^2}\implies y=3-x-z=\frac{3-x}2\mp\frac{\sqrt3}2\sqrt{3+2x-x^2}$$ giving $$\max\{y-x\}=\max\left\{\frac32-\frac32x+\frac{\sqrt3}2\sqrt{3+2x-x^2}\right\}$$ and differentiating gives $$-\frac32+\frac{\sqrt3}4\cdot\frac{2-2x}{\sqrt{3+2x-x^2}}=0\implies (1-x)^2=3(3+2x-x^2)$$ so $x^2-2x-2=0\implies x=1\pm\sqrt3$, and $\max\{y-x\}=2\sqrt3$ when $x=1-\sqrt3$.
