Maximize $x^2+2y^2$ subject to $y-x^2+1=0$
I tried using Lagrange multiplier method. We have:
$$L(x,y)=x^2+2y^2+\lambda(y-x^2+1)$$
So we have:
$$L_x=2x(1-\lambda)=0$$ $$L_y=4y+\lambda=0$$
One possible solution with $y-x^2+1=0$ is
$x=0$, $y=-1$, $\lambda=4$
But when we calculate Hessian determinant at $(0,-1)$ for this we have:
$$L_{xx}=2-2\lambda=-6 \lt 0$$
$$L_{yy}=4$$ $$L_{xy}=0$$
So $$L_{xx}L_{yy}-L^2_{xy} \lt 0$$
Does it not mean saddle point at $(0,-1)$
But it actually maximizes $x^2+2y^2$
What am I missing here?
As in the answer by amd, you need to construct what is called the Bordered Hessian, which is nothing more that the Hessian when $\lambda$ is deliberately included as a new variable. Maybe give it a new name, $$ h(\lambda, x,y) = x^2 + 2 y^2 + \lambda (y-x^2 +1) $$ The gradient is the triple $$ h_\lambda = y-x^2 + 1, \; \; h_x = 2x - 2 \lambda x, \; \; h_y = 4y + \lambda $$ while the "bordered Hessian" is
$$ W = \left( \begin{array}{rrr} 0 & -2x & 1 \\ -2x & 2-2\lambda & 0 \\ 1 & 0 & 4 \\ \end{array} \right) $$
First, at one of the side critical points where $x \neq 0,$ we have $x = \frac{\sqrt 3}{2}, \; \; y = \frac{-1}{4}, \; \; \lambda = 1.$ Here $$ W = \left( \begin{array}{rrr} 0 & -\sqrt 3 & 1 \\ - \sqrt 3 & 0 & 0 \\ 1 & 0 & 4 \\ \end{array} \right) $$ This determinant comes out $-12$ and we have a local min of $x^2 + 2 y^2$
You were worried about the critical point where $x = 0, \; \; y = -1, \; \; \lambda = 4.$ Here $$ W = \left( \begin{array}{rrr} 0 & 0 & 1 \\ 0 & -6 & 0 \\ 1 & 0 & 4 \\ \end{array} \right) $$ This determinant comes out $6$ and we have a local maximum of $x^2 + 2 y^2$
NOTE: as long as there is just one constraint function, this description of the "second derivative test" is good enough, even if we have more than two original variables. That is, we could ask for critical points of $x^2 + 2 y^2 + 3 z^2$ constrained to $z - xy - 7 = 0$ and do the same steps, in the end calculating just one determinant for each critical point. It does get messier if we have more than one constraint.