<s>[INST] Maxima and minima of function with limiting condition (lagrange multiplier)  problem 
I have function:
$$ f(x,y,z)=x+2y+\frac{z^2}{2} $$ and i would want to find it's minima and maxima with condition $x^2+y^2+z^2=5$
 Attempt to solve 
I can form Lagrange function with the limiting condition and the function itself.
Lagrange function is defined as 
$$ L(x,y,z,\lambda)=f(x)+\lambda(g(x)) $$
$g(x)$ would be limiting condition.
$$ L(x,y,z,\lambda)= x+2y+\frac{z^2}{2} + \lambda(x^2+y^2+z^2-5)$$
in order to find when this function has critical points i need to compute gradient.
$$ \nabla L(x,y,\lambda)=\begin{bmatrix} 1+2x\lambda \\ 2+2y\lambda \\ z+2z\lambda \\ x^2+y^2+z^2-5 \end{bmatrix} $$
$$ \begin{cases} 1+2x\lambda = 0 \\ 2+2y\lambda = 0 \\ z+2z\lambda =0 \\ x^2+y^2+z^2-5=0\end{cases} $$
$$ x=-\frac{1}{2\lambda} $$
$$ y=-\frac{2}{2\lambda} $$
$$ z=0 $$
$$ (-\frac{1}{2\lambda})^2+(-\frac{2}{2\lambda})^2+(0)^2-5=0 $$
$$ \frac{1}{4\lambda^2} + \frac{4}{4\lambda^2}-5=0 $$
$$ \frac{5}{4\lambda^2}-5=0 $$
$$ \frac{5}{4\lambda^2}=5 $$
$$ 20\lambda^2=5 $$
$$ \lambda = \sqrt{\frac{5}{20}}=\sqrt{\frac{1}{4}}=\frac{\sqrt{1}}{\sqrt{4}}=\frac{1}{2}$$
since for all $n\ge 0$  $\sqrt{\frac{m}{n}}=\frac{\sqrt{m}}{\sqrt{n}}$
Now i can compute values for $x$ & $y$
$$ 1+2(\cdot\frac{1}{2})x=0$$
$$ x=-1$$
$$ 2+2y\cdot (\frac{1}{2})=0 $$
$$ y=-2 $$
now for $z$
$$ z+2\cdot(\frac{1}{2})z=0$$
$$ z=0 $$
I found one such critical point $(-1,-2,0)$
now to compute what values this point has:
$$ f(-1,-2,0)=-1-2\cdot 2+ \frac{0^2}{2}=-5 $$
I don't know what tools i have for checking if this critical point is either maxima or minima but it certainly would look like a minima. I think there is version of hessian matrix called "bordered hessian" but this wasn't covered on our lecture so i am suppose to know only about the regular hessian which isn't sufficient way to tell on this if the point is minima or maxima. Also how do i find the another critical point (maxima) or how do i know if such point doesn't exist ?
 [/INST] why don't you consider the function $$g(x,y)=x+2y+\frac{5-x^2-y^2}{2}$$ this simplifies the problem
and this is $$-\frac{1}{2}(x-1)^2-\frac{1}{2}(y-2)^2+5$$
and the minimum is given by $-5$
</s>