I want to calculate the points of the curve given by $$\frac{x^2}{4}+y^2+\frac{z^2}{4}=1,\qquad x+y+z=1$$ which are minimum and maximum distance to the origin. Using Lagrange multipliers, the maximum and minimum will be in the solutions of the system $$ \begin{cases}(x,y,z)=\lambda(x/2,2y,z/2)+\mu(1,1,1)\\ \frac{x^2}{4}+y^2+\frac{z^2}{4}=1 \\ x+y+z=1\end{cases}$$
I don't understand why the gradient of the function is $(x,y,z)$. I thought the function we were trying to minimize or maximize here is the distance function to the origin, which should be $\sqrt{x^2+y^2+z^2}$?.
$$1=\frac{x^2}{4}+y^2+\frac{z^2}{4}\geq y^2,$$ which gives $$0\leq y^2\leq1.$$
Thus, since $x^2+z^2=4-4y^2,$ we obtain: $$\sqrt{x^2+y^2+z^2}=\sqrt{4-3y^2}\leq2.$$ The equality occurs for $y=0$, $x+z=1$ and $x^2+z^2=4,$ which says that we got a maximal distance.
Also, $$\sqrt{x^2+y^2+z^2}=\sqrt{4-3y^2}\geq1.$$ The equality occurs for $y=1$ and $x=z=0,$ which says that we got a minimal distance.