Maxima & Minima

This notebook shows how to solve for critical points and extreme values of a function of several variables.

Needs["Calculus`Advanced`"]

Example:

Classify the critical points of

f[x_,y_] =  x^3 - 4 x y + y^2 + x^2;

Solution:

cp = CriticalPoints[f[x,y]]

d = Discriminant[f[x,y]]

Evaluate d at the critical points:

d /. cp

So {0,0} is a saddle point. We check fxx at {2,4} to see if f has a local max or min there:

D[f[x,y],x,x] /. cp[[1]]

Positive means curved up so f has a local minimum at {2,4}.

f[x,y] /. cp[[1]]

Example:

Find the extreme values of f[x,y] subject to the constraint x^2 + y^2 == 1.

Solution:

lp = Lagrange[f[x,y], x^2 + y^2 == 1] //N //Chop

Evaluate f[x,y] at these critical points

f[x,y]/.lp

We ignore complex number answers, so:

The maximum is 3.43207 at the point {0.8025, -0.5965}.
The minimum is -1.43207 at the point {-0.8025, -0.5965}.

Example:

Find the extreme values of

f[x_,y_] = x^3 + 2 y^3;

subject to the constraint

x^2 + y^2 == 1;

Solution

circle =
ParametricPlot3D[
{Cos[t],Sin[t],0}, {t,0,2Pi}]

graph =
ParametricPlot3D[{x, y, f} /.
	{x -> r Cos[t], y -> r Sin[t]},
	{t,0,2Pi}, {r,0,1},
	PlotPoints->30,PlotRange->{-2,2}]

Show[{circle,graph},PlotRange->{-2,2}]

boundary =
ParametricPlot3D[{x, y, f} /.
	{x->Cos[t], y->Sin[t]},
	{t,0,2Pi}]

Show[{circle,boundary}]

Critical points on the boundary:

Lagrange[f[x,y], x^2 + y^2 == 1]

Evaluate f[x,y] at these points.

f[x,y] /. %

N[%]

Maximum on the boundary is 2 at {0,1}.
Minimum on the boundary is -2 at {0,-1}.

Example:

Find the extreme values of

f[x_,y_] = 4 - x^2 - 4 y^2;

in the bounded region described by

x^4 + 2 y^4 <= 1;

Solution

curve = ParametricPlot3D[
{Sign[Cos[t]]Sqrt[Abs[Cos[t]]],
 Sign[Sin[t]]Sqrt[Abs[Sin[t]]]/2^(1/4),
 0},
{t,0,2Pi}]

graph = ParametricPlot3D[
{x, y, f} /.
{x->r Sign[Cos[t]]Sqrt[Abs[Cos[t]]],
 y->r Sign[Sin[t]]Sqrt[Abs[Sin[t]]]/2^(1/4)},
{t,0,2Pi}, {r,0,1},
PlotPoints->30]

Show[{curve,graph}]

Find critical points inside the region:

CriticalPoints[f[x,y]]

f[x,y] /. %

Critical points on the boundary:

cp = Lagrange[f[x,y], x^4 + 2y^4 == 1]

Evaluate f[x,y] at real-valued solutions.

f[x,y] /. cp[[{1,3,5,6,9,10,13,15}]]

N[%]

Maximum on the boundary is: 1.17157 at: {0, ±2^(-1/4)}
Minimum on the boundary is: 1 at: {±1/Sqrt[3], ±Sqrt[2/3]}

Overall maximum is 4 at {0,0}
Overall minimum is 1 at {±1/Sqrt[3], ±Sqrt[2/3]}