f(x,y)=x3+x2y−2y3+6y{\displaystyle f(x,y)=x^{3}+x^{2}y-2y^{3}+6y}

∂f∂x=3x2+2xy=0{\displaystyle {\frac {\partial f}{\partial x}}=3x^{2}+2xy=0} ∂f∂y=x2−6y2+6=0{\displaystyle {\frac {\partial f}{\partial y}}=x^{2}-6y^{2}+6=0}

Let’s start with the first component to find values of x. {\displaystyle x. } We can immediately factor out an x,{\displaystyle x,} which gets us x=0. {\displaystyle x=0. } The quantity in parentheses can also be 0, but that only gets x{\displaystyle x} in terms of y. {\displaystyle y. } 3x2+2xy=0x(3x+2y)=0x=0{\displaystyle {\begin{aligned}3x^{2}+2xy&=0\x(3x+2y)&=0\x&=0\end{aligned}}} 3x+2y=0x=−23y{\displaystyle {\begin{aligned}3&x+2y=0\&x=-{\frac {2}{3}}y\end{aligned}}} Next, we move to the second component to find corresponding values of y{\displaystyle y} for the two values of x. {\displaystyle x. } x=0:{\displaystyle x=0:} 6=6y2y=±1{\displaystyle {\begin{aligned}6&=6y^{2}\y&=\pm 1\end{aligned}}} x=−23y:{\displaystyle x=-{\frac {2}{3}}y:} 49y2−6y2+6=0(6−49)y2=6y2=2725y=±335{\displaystyle {\begin{aligned}{\frac {4}{9}}y^{2}-6y^{2}+6&=0\\left(6-{\frac {4}{9}}\right)y^{2}&=6\y^{2}&={\frac {27}{25}}\y&=\pm {\frac {3{\sqrt {3}}}{5}}\end{aligned}}} We’ve found all possible values for y. {\displaystyle y. } Substituting y{\displaystyle y} only for the values that we got using the relation x=−23y,{\displaystyle x=-{\frac {2}{3}}y,} we obtain x=∓235{\displaystyle x=\mp {\frac {2{\sqrt {3}}}{5}}} (note the signs). Therefore, the four critical points are (0,±1), (∓235,±335). {\displaystyle (0,\pm 1),\ \left(\mp {\frac {2{\sqrt {3}}}{5}},\pm {\frac {3{\sqrt {3}}}{5}}\right). } These are only candidates for extrema, however.

H=(∂2f∂x2∂2f∂x∂y∂2f∂y∂x∂2f∂y2){\displaystyle H={\begin{pmatrix}{\dfrac {\partial ^{2}f}{\partial x^{2}}}&{\dfrac {\partial ^{2}f}{\partial x\partial y}}\{\dfrac {\partial ^{2}f}{\partial y\partial x}}&{\dfrac {\partial ^{2}f}{\partial y^{2}}}\end{pmatrix}}}

∂2f∂x2=6x+2y{\displaystyle {\frac {\partial ^{2}f}{\partial x^{2}}}=6x+2y} ∂2f∂x∂y=∂2f∂y∂x=2x{\displaystyle {\frac {\partial ^{2}f}{\partial x\partial y}}={\frac {\partial ^{2}f}{\partial y\partial x}}=2x} ∂2f∂y2=−12y{\displaystyle {\frac {\partial ^{2}f}{\partial y^{2}}}=-12y} H=(6x+2y2x2x−12y){\displaystyle H={\begin{pmatrix}6x+2y&2x\2x&-12y\end{pmatrix}}}

Let’s substitute in the (0,±1){\displaystyle (0,\pm 1)} critical points. Since we are only interested in the sign of the determinant, and not the values of the elements themselves, we can clearly see that both points results in a negative determinant. This means that (0,±1){\displaystyle (0,\pm 1)} are both saddle points. We do not need to go further for these two points. |±200∓12|<0{\displaystyle {\begin{vmatrix}\pm 2&0\0&\mp 12\end{vmatrix}}<0} Now let’s check the (∓235,±335){\displaystyle \left(\mp {\frac {2{\sqrt {3}}}{5}},\pm {\frac {3{\sqrt {3}}}{5}}\right)} points. |−635−435−435−3635|=3252(216−16)>0{\displaystyle {\begin{aligned}{\begin{vmatrix}-{\frac {6{\sqrt {3}}}{5}}&-{\frac {4{\sqrt {3}}}{5}}\-{\frac {4{\sqrt {3}}}{5}}&-{\frac {36{\sqrt {3}}}{5}}\end{vmatrix}}&={\frac {{\sqrt {3}}^{2}}{5^{2}}}(216-16)\&>0\end{aligned}}} |6354354353635|=3252(216−16)>0{\displaystyle {\begin{aligned}{\begin{vmatrix}{\frac {6{\sqrt {3}}}{5}}&{\frac {4{\sqrt {3}}}{5}}\{\frac {4{\sqrt {3}}}{5}}&{\frac {36{\sqrt {3}}}{5}}\end{vmatrix}}&={\frac {{\sqrt {3}}^{2}}{5^{2}}}(216-16)\&>0\end{aligned}}} Both of these points have positive Hessians.

From above, we can clearly see that tr⁡H(−235,335)<0,{\displaystyle \operatorname {tr} H\left(-{\frac {2{\sqrt {3}}}{5}},{\frac {3{\sqrt {3}}}{5}}\right)<0,} and therefore, (−235,335){\displaystyle \left(-{\frac {2{\sqrt {3}}}{5}},{\frac {3{\sqrt {3}}}{5}}\right)} is a local maximum. Similarly, tr⁡H(235,−335)>0,{\displaystyle \operatorname {tr} H\left({\frac {2{\sqrt {3}}}{5}},-{\frac {3{\sqrt {3}}}{5}}\right)>0,} so (235,−335){\displaystyle \left({\frac {2{\sqrt {3}}}{5}},-{\frac {3{\sqrt {3}}}{5}}\right)} is a local minimum.

Let’s check the right side of the rectangle first, corresponding to (1,y). {\displaystyle (1,y). } f(1,y)=−2y3+7y+1dfdy=−6y2+7=0{\displaystyle {\begin{aligned}f(1,y)&=-2y^{3}+7y+1\{\frac {\mathrm {d} f}{\mathrm {d} y}}&=-6y^{2}+7=0\end{aligned}}} y=±76{\displaystyle y=\pm {\sqrt {\frac {7}{6}}}} The critical points are therefore (1,±76). {\displaystyle \left(1,\pm {\sqrt {\frac {7}{6}}}\right). } Doing single-variable second derivative tests on both of these points, we find that (1,76){\displaystyle \left(1,{\sqrt {\frac {7}{6}}}\right)} is a local maximum and (1,−76){\displaystyle \left(1,-{\sqrt {\frac {7}{6}}}\right)} is a local minimum. The other three sides are done in the same fashion. In doing so, we net the critical points below. Beware that you must discard all points found outside the domain. (0,2),{\displaystyle (0,2),} local minimum (−1,76),{\displaystyle \left(-1,{\sqrt {\frac {7}{6}}}\right),} local maximum (−1,−76),{\displaystyle \left(-1,-{\sqrt {\frac {7}{6}}}\right),} local minimum (0,−2),{\displaystyle (0,-2),} local maximum

Global maximum: (1,76){\displaystyle \left(1,{\sqrt {\frac {7}{6}}}\right)} Global minimum: (−1,−76){\displaystyle \left(-1,-{\sqrt {\frac {7}{6}}}\right)} Above is a visualization of the function that we were working with. We can clearly see the locations of the saddle points and the global extrema labeled in red, as well as the critical points inside the domain and on the boundaries.