Example 2: Constrained Optimization (Example 5)

This problem involves finding the maximum and minimum values of the function

> f := 2+x^2+y^2;

f := 2+x^2+y^2

>

on the set of points bounded by the ellipse

> S := x^2 + y^2/4 = 1;

S := x^2+1/4*y^2 = 1

>

Graphically, the surface is

> Pf := plot3d( f, x=-3..3, y=-3..3, orientation=[30,60] ):

> Pf;

[Maple Plot]

>

Because the origin is contained inside the ellipse, the global minimum occurs at (0,0). The global maximum is not yet apparent. For this, graph the boundary of the ellipse in the x-y plane

> Sparam := [ cos(theta), 2*sin(theta), 0 ];

Sparam := [cos(theta), 2*sin(theta), 0]

> PS := spacecurve( Sparam, theta=0..2*Pi, color=black ):

> PS;

[Maple Plot]

>

and on the surface itself

> fSparam := [cos(theta),2*sin(theta),eval(f,{x=cos(theta),y=2*sin(theta)})];

fSparam := [cos(theta), 2*sin(theta), 2+cos(theta)^...

> PfS := spacecurve( fSparam, theta=0..2*Pi, color=red ):

> PfS;

>

[Maple Plot]

>

From this picture it is clear that there are two maxima and two minima of f along the ellipse. The maxima should be global maxima while these minima will not be lower than the value at the critical point, i.e., the origin. The following pictures are also helpful:

> display( [PfS,PS] );

[Maple Plot]

> display( [Pf,PfS,PS] );

[Maple Plot]

>

To conclude, let's locate the extrema via calculus. First, find the critical points:

>

> fx := diff( f, x );

fx := 2*x

> fy := diff( f, y );

fy := 2*y

>

> crit_pt := solve( {fx=0,fy=0}, {x,y} );

crit_pt := {x = 0, y = 0}

Note: This was simple enough to do by inspection.

>

To classify this critical point:

> fxx := diff( f, x,x );

> fyy := diff( f, y,y );

> fxy := diff( f, x,y );

fxx := 2

fyy := 2

fxy := 0

> discr := fxx*fyy - fxy^2;

discr := 4

>

Because D>0 and fxx>0, the critical point is a local miminum.

>

To locate the exxtrema around the ellipse, use the parameterization of the ellipse to obtain an expression for the value of the function at any point on the ellipse:

> fS := eval( f, {x=cos(theta),y=2*sin(theta)} );

fS := 2+cos(theta)^2+4*sin(theta)^2

>

> plot( fS, theta=0..2*Pi );

[Maple Plot]

>

This plot shows the two maxima and two minima seen previously in the 3D plots. An analytic determination of these points is not difficult.

> DfS := diff( fS, theta );

DfS := 6*cos(theta)*sin(theta)

> solve( DfS=0, theta );

0, -1/2*Pi, 1/2*Pi

>

Maple gives its answers outside our parameter range, but we know we can add 2*Pi to these answers and obtain equivalent points.

> fS1 := eval( fS, theta=0 );

fS1 := 3

> fS2 := eval( fS, theta=Pi/2 );

fS2 := 6

> fS3 := eval( fS, theta=Pi );

fS3 := 3

> fS4 := eval( fS, theta=3*Pi/2 );

fS4 := 6

>

The value of the function at the critical point is:

> fCP := eval( f, crit_pt );

fCP := 2

>

Based on these values, it is seen that the global minimum is 2 and occurs at (0,0) and the global maxiumum is 6 which occur at (0,2) and (0,-2) (i.e., when theta = Pi /2 and 3 Pi /2).

>