GlobalAnalysis.mws

Global Analysis

>    restart;
with( plots ):

Warning, the name changecoords has been redefined

>   

Auxiliary Procedures

>    InInterval := proc(x,S::list(numeric))
  if has(x,I) then return false end if;
  return evalb( evalf(x)>=op(1,S) and evalf(x)<=op(2,S) )
end proc:

>   

Lesson Overview

Curve analysis is discussed in a collection of four lessons. In this lesson the focus is on the identification of global extrema -- the highest and lowest points on the graph of a function on a given domain. For example, the highest and lowest places on Earth not covered by water are Mt. Everest (elevation: 8849.8m) and the shore of the Dead Sea (elevation: -411m). Moving from the macro-scale to the micro-scale, identification of every individual peak and valley will be discussed in the Local Analysis lesson. These two topics provide the tools to setup and solve a wide variety of applied Optimization problems. They also provide a straightforward approach to Graphing a function by identifying all important points on the curve.

An immediate application of global extrema is to identify an appropriate viewing window for a graph. For this reason all analysis in this lesson will be completed without the use of a plot of the function. Once the analysis is complete, a graph will be constructed to confirm the analytical results.

>   

Definition: Global Extrema

Let f be a function defined on a set S .

Notes

  • It is not necessary for the global extrema to be function values.
  • If we allow for M = infinity  and m = -infinity  then every function has both a global maximum and a global minimum.

>   

Point 1: When Are Global Extrema Attained as Function Values?

A careful examination of the definitions of global extrema reveals that the extreme values are not required to be values of the function. In fact, if we define the maximum value to be M = infinity  for a function that is not bounded above and the minimum value to be m = -infinity  for a function that is not bounded below, then every function has global extrema. The more important question is:

When are the global extrema attained as values of the function from the given domain?

>   

Theorem: Global Max/Min Existence Theorem

Given a continuous function f on a closed and bounded interval, [a, b] , there is a global maximum and a global minimum of f on [a, b] .

>   

One good way of understanding this theorem is to look at all the ways the hypotheses can fail to hold.

Example 1: Discontinuous Function on Closed and Bounded Interval

Consider the function

>    f1 := piecewise( x< 1, x, x<2, (x-1)/2 );

f1 := PIECEWISE([x, x < 1],[1/2*x-1/2, x < 2])

on the closed and bounded interval [0, 2] .

>    plot( f1, x=0..2, discont=true,
      title="Discontinuous Function that does Not Attain Its Global Maximum on [0,2]" );

[Maple Plot]

This function is discontinuous at x = 1 . The smallest number with the property that f(x)  <= M  for all x in [0, 2]  is M = 1 . Because there is no x  in [0, 2]  with f(x) = 1 , this function does not  attain its global maximum on   [0, 2] . Conversely, the largest number with the property that f(x)  >= m  for all x  in [0, 2]  is m = 0 . Because f(1) = 0 , this function does attain its global minimum on   [0, 2] . (In fact, the global minimum is attained at both x = 0  and x = 1 .)

Note that it is important to clearly state the interval when talking about global extrema.

>   

Example 2: Continuous Function on Non-Closed Intervals

Consider the continuous function

>    f2 := cos(x):
f(x) = f2;

f(x) = cos(x)

on the open, bounded interval ( 0, 2*Pi  ).

>    plot( f2, x=0..2*Pi,
      title="Continuous Function on an Open Interval that does Not Attain Its Global Maximum on (0,2*Pi)" );

[Maple Plot]

We know the cosine function is continuous on every interval of the real numbers. The interval ( 0, 2*Pi  ) is bounded, but open. Because neither x = 0  nor x = 2*Pi  is in the interval, this function does not attain its global maximum on  ( 0, 2*Pi  ). The fact that f(Pi) = cos(Pi)  = -1 shows the function does attain its global minimum in the inteval ( 0, 2*Pi  ).

Note that if either endpoint is included in the interval, then the function in this example attains both global extrema.

>   

Example 3: Continuous Function on Unbounded Interval

For this example, consider

>    f3 := (1-x^2)/(1+x^2):
f(x) = f3;

f(x) = (1-x^2)/(1+x^2)

on the unbounded interval ( -infinity , infinity  ). (Technically, this interval is both open and closed.)

>    plot( f3, x=-10..10,
      title="Continuous Function that does Not Attain its Global Minimum on (-infinity,infinity)" );

[Maple Plot]

The global maximum for this function on the entire real line is M = 1 ; the global minimum is m = -1 . The global maximum is attained at x = 0  but there is no real number for which (1-x^2)/(1+x^2) = -1 .

>   

Example 4: A Final Example

Define the function

>    f4 := 1/x^2:
f(x) = f4;

f(x) = 1/(x^2)

for all x <> 0 . This function is continuous on any interval that does not include the origin. On an interval [a, b]  with b  > a  > 0, the global extrema of f on [a, b]  are M = f(a)  = 1/(a^2)  and m = f(b)  = 1/(b^2) .

>    plot( f4, x=0.1..1, y=0..100,
      title="Continuous Function on Closed and Bounded Interval" );

[Maple Plot]

If a  < b  < 0, then M = f(b)  = 1/(b^2)  and m = f(a)  = 1/(a^2) .

>    plot( f4, x=-3..-1, y=0..2, view=[-3..0,0..2],
      title="Continuous Function on Closed and Bounded Interval" );

[Maple Plot]

In either case, if one or both endpoint is omitted from the interval, the interval is no longer closed and the corresponding global extrema is no longer attained from the interval.

The function is discontinuous on any interval that contains the origin. If an endpoint of the interval is 0 then the global maximum on this interval is M = infinity . An infinite extrema can never be attained!

Each of these results is consistent with the stated theorem.

>   

Definition: Stationary, Singular, and Critical Points

Let f be a function defined on an interval I  and let c  be a point in I .

>   

Point 2: Where Do Global Extrema Occur?

Knowing when the global extrema are attained is important. In the examples the identification of the global extrema was based on looking at a graph of the function on the specified domain. While a graph can be useful in identifying global extrema, this is putting the carriage in front of the horse. Knowledge about the global extrema is generally used to select the viewing window for the graph. So, the real question is:

How can we determine the global extrema of a continuous function
 on a closed and bounded interval
without looking at a graph ?

>   

Theorem: Global Max/Min Location Theorem

Let f be a function defined on an interval I . If an extreme value of f on I  is attained at a point c  in the interval, then c  must be a critical point of f on I .

>   

Example 5:   f(x) = x^3-3*x^2-x  on [ -2, 2 ]

Find the global extrema and their location(s) for

>    f5 := x^3 - 3*x^2 - x:
f(x) = f5;

f(x) = x^3-3*x^2-x

on the interval

>    I5 := [-2,2]:
`I` = I5;

I = [-2, 2]

This function is continuous on a closed and bounded interval so both global extrema are attained. We have just learned that the only possible locations for extrema to occur are

  • the endpoints of the interval
  • any stationary points of the function that are in the interval
  • or any singular points located in the interval (but polynomials have no singular points)

For this example, there are no singular points (no polynomial has a singular points),

>    sing5 := NULL:

the stationary points are the solutions endpoints are the solutions to

>    df5 := diff( f5, x ):
q1 := df5 = 0:
q1;

3*x^2-6*x-1 = 0

The two solutions to this quadratic equation are

>    stat5 := solve( df5=0, x ):
stat5;

1+2/3*3^(1/2), 1-2/3*3^(1/2)

and the endpoints of the interval are

>    end5 := op(I5):
end5;

-2, 2

The complete set of possible locations for the global extrema is formed from these lists with all points outside the interval removed

>    crit5 := select( InInterval, [ end5, stat5, sing5 ], I5 );

crit5 := [-2, 2, 1-2/3*3^(1/2)]

(Note that one of the critical points is outside this interval; it is no longer being considered.)

>   

All that remains is to evaluate the function at each of these points:

>    f5a := unapply( f5, x ):
q2 := seq( [ X, simplify(f5a(X)) ], X=crit5 );

q2 := [-2, -18], [2, -6], [1-2/3*3^(1/2), -3+16/9*3^(1/2)]

or, in floating point form,

>    evalf[4]( q2 );

[-2., -18.], [2., -6.], [-.155, .79e-1]

The largest function value is f(1-2/sqrt(3)) = -3+16*sqrt(3)/9  and the smallest function value is f(-2) = -18 . That is, the global maximum occurs at the critical point x = 1-2/sqrt(3)  and the global minimum occurs at the left endpoint x = -2 . These results are confirmed with a plot.

>    plot( f5, x=-2..2 );

[Maple Plot]

>   

Example 6:   f(x) = x^3-3*x^2-x  on [ -1, 3 ]

Consider the same cubic function as in Example 5

>    f6 := f5:
f(x) = f6;

f(x) = x^3-3*x^2-x

but on the interval

>    I6 := [-1,3]:
`I` = I6;

I = [-1, 3]

This function is continuous on a closed and bounded interval so both global extrema are attained. The possible locations for extrema to occur are

  • the endpoints of the interval

>    end6 := op(I6):
end6;

-1, 3

  • any stationary points (solutions to `f'`(x) = 0  outside the interval will be excluded later)

>    stat6 := stat5:
stat6;

1+2/3*3^(1/2), 1-2/3*3^(1/2)

  • or any singular points (but polynomials have no singular points).

>    sing6 := NULL:

The complete set of possible locations for the global extrema is formed from these lists with all points outside the interval removed

>    crit6 := select( InInterval, [ end6, stat6, sing6 ], I6 );

crit6 := [-1, 3, 1+2/3*3^(1/2), 1-2/3*3^(1/2)]

>   

All that remains is to evaluate the function at each of these points:

>    f6a := f5a:
q3 := seq( [ X, simplify(f6a(X)) ], X=crit6 );

q3 := [-1, -3], [3, -3], [1+2/3*3^(1/2), -3-16/9*3^(1/2)], [1-2/3*3^(1/2), -3+16/9*3^(1/2)]

or, in floating point form,

>    evalf[4]( q3 );

[-1., -3.], [3., -3.], [2.155, -6.079], [-.155, .79e-1]

The largest function value is still f(1-2/sqrt(3)) = -3+16*sqrt(3)/9  but the smallest function value is now f(1+2/sqrt(3)) = -3-16*sqrt(3)/9 . That is, the global maximum occurs at the critical point x = 1-2/sqrt(3)  and the global minimum occurs at the other critical point x = 1+2/sqrt(3) . These results are confirmed with a plot.

>    plot( f6, x=-1..3 );

[Maple Plot]

>   

Example 7:   f(x) = x^3-3*x^2-x  on [ 1, 3 ]

Consider the same cubic function as in Examples 5 and 6

>    f7 := f5:
f(x) = f7;

f(x) = x^3-3*x^2-x

but on the interval

>    I7 := [1,3]:
`I` = I7;

I = [1, 3]

This function is continuous on a closed and bounded interval so both global extrema are attained. The possible locations for extrema to occur are

  • the endpoints of the interval

>    end7 := op(I7):
end7;

1, 3

  • any stationary points (solutions to `f'`(x) = 0  outside the interval will be excluded later)

>    stat7 := stat5:
stat7;

1+2/3*3^(1/2), 1-2/3*3^(1/2)

  • or any singular points located in the interval (but polynomials have no singular points).

>    sing7 := NULL:

The complete set of possible locations for the global extrema is formed from these lists with all points outside the interval removed

>    crit7 := select( InInterval, [ end7, stat7, sing7 ], I7 );

crit7 := [1, 3, 1+2/3*3^(1/2)]

>   

All that remains is to evaluate the function at each of these points:

>    f7a := f5a:
q4 := seq( [ X, simplify(f7a(X)) ], X=crit7 );

q4 := [1, -3], [3, -3], [1+2/3*3^(1/2), -3-16/9*3^(1/2)]

or, in floating point form,

>    evalf[4]( q4 );

[1., -3.], [3., -3.], [2.155, -6.079]

The largest function value is now -3, attained at both x = 1  and x = 3  and the smallest function value is f(1+2/sqrt(3)) = -3-16*sqrt(3)/9 . That is, the global maximum occurs at both endpoints x = 1  and x = 3  and the global minimum occurs at the critical point in this interval, x = 1+2/sqrt(3) . These results are confirmed with a plot.

>    plot( f7, x=1..3, view=[0..4,-7..0] );

[Maple Plot]

>   

Example 8:   f(x) = sin(x)+cos(2*x)  on [-Pi, 2*Pi]  

Consider the trigonometric function

>    f8 := sin(x)+cos(2*x):
f(x) = f8;

f(x) = sin(x)+cos(2*x)

on the interval

>    I8 := [-Pi,2*Pi]:
`I` = I8;

I = [-Pi, 2*Pi]

Notice that this function is periodic with period 2*Pi  and that the given interval is one and a half periods; remember to check for this when the plot is created.

This function is continuous on a closed and bounded interval so both global extrema are attained. The possible locations for extrema to occur are

  • the endpoints of the interval

>    end8 := op(I8):
end8;

-Pi, 2*Pi

  • any stationary points (any solutions to `f '`(x) = 0  outside the interval will be excluded later)

>    df8 := collect(diff( f8, x ),[sin,cos]):
`f'`(x) = df8;

`f'`(x) = cos(x)-2*sin(2*x)

>    q1 := df8 = 0:
q2 := solve( q1, x ):
q2;

-1/2*Pi, 1/2*Pi, arctan(1/15*15^(1/2)), -arctan(1/15*15^(1/2))+Pi

Notice that these are the solutions in the interval [-Pi, Pi] . By periodicity, the corresponding stationary points in [Pi, 3*Pi]  are obtained by adding 2*Pi  to each stationary point in [-Pi, Pi] .

>    q3 := op(map( x->x+2*Pi, [q2] ));

q3 := 3/2*Pi, 5/2*Pi, arctan(1/15*15^(1/2))+2*Pi, -arctan(1/15*15^(1/2))+3*Pi

The complete set of stationary points in [-Pi, 3*Pi]  is

>    stat8 := op( { q2, q3 } ):
stat8;

-1/2*Pi, arctan(1/15*15^(1/2)), -arctan(1/15*15^(1/2))+3*Pi, 3/2*Pi, 5/2*Pi, arctan(1/15*15^(1/2))+2*Pi, 1/2*Pi, -arctan(1/15*15^(1/2))+Pi

>   

  • or any singular points located in the interval (both sine and cosine are defined for all real numbers)

>    sing8 := NULL:

The complete set of possible locations for the global extrema is formed from these lists with all points outside the interval removed

>    crit8 := select( InInterval, [ end8, stat8, sing8 ], evalf(I8) );

crit8 := [-Pi, 2*Pi, -1/2*Pi, arctan(1/15*15^(1/2)), 3/2*Pi, 1/2*Pi, -arctan(1/15*15^(1/2))+Pi]

>   

All that remains is to evaluate the function at each critical point:

>    f8a := unapply( f8, x ):
q4 := seq( [ X, simplify(f8a(X)) ], X=crit8 );

q4 := [-Pi, 1], [2*Pi, 1], [-1/2*Pi, -2], [arctan(1/15*15^(1/2)), 9/8], [3/2*Pi, -2], [1/2*Pi, 0], [-arctan(1/15*15^(1/2))+Pi, 9/8]

or, in floating point form,

>    evalf[4]( q4 );

[-3.142, 1.], [6.284, 1.], [-1.571, -2.], [.2527, 1.125], [4.713, -2.], [1.571, 0.], [2.889, 1.125]

The largest function value is now 9/8 , attained at both x = arctan(sqrt(15)/15)  and x = Pi-arctan(sqrt(15)/15)  and the smallest function value is -2 which is attained at x = -Pi/2  and x = 3*Pi/2 . That is, the global maximum occurs at the stationary points x = arctan(sqrt(15)/15)  = 0.2527 and x = Pi-arctan(sqrt(15)/15)  = 2.8889 and the global minimum occurs at the stationary points, x = -Pi/2  = -1.5708 and x = 3*Pi/2  = 4.7124. These results are confirmed with a plot.

>    plot( f8, x=-Pi..2*Pi );

[Maple Plot]

This plot does appear to be periodic with period 2*Pi . This point is further emphasized with a plot over a larger interval.

>    plot( f8, x=-3*Pi..3*Pi );

[Maple Plot]

>   

Example 9:   f(x) = (x^3-3*x^2-x)/((x-1)^2)  on [ -3, 1 )

Consider a new function created from the polynomial first encountered in Example 5.

>    f9 := f5/(x-1)^2:
f(x) = f9;

f(x) = (x^3-3*x^2-x)/(x-1)^2

on the interval [-3,1).

>    I9 := [-3,1]:
`I` = I9;

I = [-3, 1]

Note that this interval is not closed. It is not possible to simply add the right endpoint to the interval; x = 1  is not in the domain of the function. Because the interval is not closed, the theorem does not apply. But, a slight modification to our approach can still be used. First, because

>    q1 := Limit( f9, x=1, left ):
q1 = value( q1 );

Limit((x^3-3*x^2-x)/(x-1)^2,x = 1,left) = -infinity

it is clear that there will be no (finite) global minimum ( m = -infinity ). The global maximum should exist (i.e., be finite) and will occur at a critical point:

  • the endpoints of the interval (note that -1 is not included here)

>    end9 := -3:
end9;

-3

  • any stationary points of the function

>    df9 := simplify(diff( f9, x )):
`f'`(x) = df9;

`f'`(x) = (x^3-3*x^2+7*x+1)/(x-1)^3

>    q1 := df9 = 0:
stat9 := solve( q1, x ):
stat9;

-1/3*(81+3*921^(1/2))^(1/3)+4/(81+3*921^(1/2))^(1/3)+1, 1/6*(81+3*921^(1/2))^(1/3)-2/(81+3*921^(1/2))^(1/3)+1+1/2*I*3^(1/2)*(-1/3*(81+3*921^(1/2))^(1/3)-4/(81+3*921^(1/2))^(1/3)), 1/6*(81+3*921^(1/2))^...
-1/3*(81+3*921^(1/2))^(1/3)+4/(81+3*921^(1/2))^(1/3)+1, 1/6*(81+3*921^(1/2))^(1/3)-2/(81+3*921^(1/2))^(1/3)+1+1/2*I*3^(1/2)*(-1/3*(81+3*921^(1/2))^(1/3)-4/(81+3*921^(1/2))^(1/3)), 1/6*(81+3*921^(1/2))^...
-1/3*(81+3*921^(1/2))^(1/3)+4/(81+3*921^(1/2))^(1/3)+1, 1/6*(81+3*921^(1/2))^(1/3)-2/(81+3*921^(1/2))^(1/3)+1+1/2*I*3^(1/2)*(-1/3*(81+3*921^(1/2))^(1/3)-4/(81+3*921^(1/2))^(1/3)), 1/6*(81+3*921^(1/2))^...

  • or any singular points located in the interval (as mentioned previously, x = 1  is not in the half-open interval, so is not considered here)

>    sing9 := NULL:
sing9;

The complete set of possible locations for the global extrema is formed from these lists with all points outside the interval removed

>    crit9 := select( InInterval, [ end9, stat9, sing9 ], I9 ):
crit9;

[-3, -1/3*(81+3*921^(1/2))^(1/3)+4/(81+3*921^(1/2))^(1/3)+1]

>   

All that remains is to evaluate the function at each of these points:

>    f9a := unapply( f9, x ):
q2 := seq( [ X, simplify(f9a(X)) ], X=crit9 );

q2 := [-3, -51/16], [-1/3*(81+3*921^(1/2))^(1/3)+4/(81+3*921^(1/2))^(1/3)+1, 9*(-729-27*921^(1/2)+216*(81+3*921^(1/2))^(1/3)+8*(81+3*921^(1/2))^(1/3)*921^(1/2)-32*(81+3*921^(1/2))^(2/3))/(81+3*921^(1/2...
q2 := [-3, -51/16], [-1/3*(81+3*921^(1/2))^(1/3)+4/(81+3*921^(1/2))^(1/3)+1, 9*(-729-27*921^(1/2)+216*(81+3*921^(1/2))^(1/3)+8*(81+3*921^(1/2))^(1/3)*921^(1/2)-32*(81+3*921^(1/2))^(2/3))/(81+3*921^(1/2...
q2 := [-3, -51/16], [-1/3*(81+3*921^(1/2))^(1/3)+4/(81+3*921^(1/2))^(1/3)+1, 9*(-729-27*921^(1/2)+216*(81+3*921^(1/2))^(1/3)+8*(81+3*921^(1/2))^(1/3)*921^(1/2)-32*(81+3*921^(1/2))^(2/3))/(81+3*921^(1/2...

or, in floating point form,

>    evalf[4]( q2 );

[-3., -3.188], [-.134, .5961e-1]

The global maximum occurs for x  = -0.134 with a maximum value just slightly larger than 0. These results are confirmed with a plot.

>    plot( f9, x=-3..1, y=-50..10 );

[Maple Plot]

Note that while the graph makes it appear that the function might be negative (or non-positive) for all x  < 1 with a maximum at the origin, this is close but not completely accurate.

>   

Example 10: f(x) = sqrt(abs(x^2-4*x+3))  on [ -2, 4 ]

For our final example, find the global extrema (and where they occur) of

>    f10 := sqrt( abs(x^2-4*x+3) ):
f(x) = f10;

f(x) = abs(x^2-4*x+3)^(1/2)

on the interval

>    I10 := [-2,4]:
`I` = I10;

I = [-2, 4]

Because the absolute value function returns non-negative values, this function is defined on the entire real line. In particular, the fact that the function is continuous on the closed and bounded interval [-2, 4] means that it will attain its global extrema somewhere in this interval. As usual, the search begins by locating all critical points in the interval:

  • the endpoints of the interval

>    end10 := op(I10):
end10;

-2, 4

  • any stationary points of the function

>    df10 := simplify(diff( f10, x )):
`f'`(x) = convert(df10,piecewise,x);

`f'`(x) = PIECEWISE([(-2+x)/(x^2-4*x+3)^(1/2), x < 1],[undefined, x = 1],[-(-2+x)/(-3-x^2+4*x)^(1/2), x < 3],[undefined, x = 3],[(-2+x)/(x^2-4*x+3)^(1/2), 3 < x])

>    q1 := df10 = 0:
stat10 := solve( q1, x ):
stat10;

2

  • or any singular points (from the above display, it is clear that the derivative does not exist for x = 1  and x = 3  --- these are the roots of x^2-4*x+3 )

>    sing10 := 1,3:
sing10;

1, 3

The complete set of possible locations for the global extrema is formed from these lists with all points outside the interval removed

>    crit10 := select( InInterval, [ end10, stat10, sing10 ], I10 ):
crit10;

[-2, 4, 2, 1, 3]

>   

All that remains is to evaluate the function at each of these points:

>    f10a := unapply( f10, x ):
q2 := seq( [ X, simplify(f10a(X)) ], X=crit10 );

q2 := [-2, 15^(1/2)], [4, 3^(1/2)], [2, 1], [1, 0], [3, 0]

or, in floating point form,

>    evalf[4]( q2 );

[-2., 3.873], [4., 1.732], [2., 1.], [1., 0.], [3., 0.]

The global maximum M = sqrt(15)  occurs for x = -2  and the global minimum m = 0  occurs at each singular point x = 1  and x = 3 . These results are confirmed with a plot.

>    plot( f10, x=-2..4 );

[Maple Plot]

>   

Lesson Summary

The two main results developed in this lesson are

Theorem: Global Max/Min Existence Theorem

Given a continuous function f on a closed and bounded interval, [a, b] , there is a global maximum and a global minimum of f on [a, b] .

>   

Theorem: Global Max/Min Location Theorem

Let f be a function defined on an interval I . If an extreme value of f on I  is attained at a point c  in the interval, then c  must be a critical point of f on I .

>   

The ten examples in this lesson illustrate the application of these theorems and what can happen when the hypotheses are not satisfied.

>   

What's Next?

The online homework assignment and textbook homework assignment should be completed almost entirely by hand. Remember that it is not permissible to use a graph to identify the global extrema because we will be using our knowledge of the global extrema to determine the viewing window for the graph. Be sure to work enough practice problems before attempting the online and textbook homework assignments.

The next step in the development of a complete collection of tools for analyzing functions is the Local Analysis lesson. In this lesson the focus is on the local behavior of a function. The Optimization Problems and Graphing lessons complete the discussion of the use of calculus for locating and classifying the most interesting points on the graph of a function. The Mean Value Theorem lesson is an obvious but important theoretical result that, like the Intermediate Value Theorem, is also used in a variety of applications. The Related Rate lesson develops methods for finding relationships between rates of change from geometric or physical relationships between quantities.

>   

>   

>