Calculus I
Lesson 15: Analysing the Graphs of Functions 1 -
Direction and Concavity
We graph each of the following functions and find:
- all critical points
- where the function is increasing and where it is decreasing
- where the function is concave down and where it is concave up
- all points of inflection
Example 1
> restart: with(plots):
Warning, the name changecoords has been redefined
> g1:= x -> x^3 - 2*x^2 + x + 3;
> D(g1);
> factor(3*x^2 - 4*x + 1);
Thus we have critical points when
or x -1 = 0, i.e.,
critical points are:
and x = 1.
> a1:= plot(D(g1)(x), x = -1..2, color= black):
> b1:= plot([1/3,t,t = -1..2], color = red):
> c1:= plot([1,t,t = -1..2], color = red):
> d1:= textplot([.5,7,`g1'(x)`], color = blue):
> e1:= textplot([.27,4,`x = 1/3`], color = magenta, align = RIGHT):
> f1:= textplot([1.2,3,`x = 1`], color = magenta):
> display({a1,b1,c1,d1,e1,f1});
From the graph we see that :
g1' (x) > 0 for
or
g1' (x) < 0 for
< 1.
Thus g1 is increasing for
and for x > 1 and g1 is decreasing for
< 1.
Conclude (from first derivative test) that g1 has a local max when
and a local max when x = 1.
> D(D(g1));
Thus, g1'' (x) =
and therefore
g1'' (x) > 0 for x > 2/3
g1'' (x) < 0 for x < 2/3.
Hence, g1 is concave up for x >
and concave down for
. There is a point of inflection
when
.
> plot(g1(x), x = -5..5, color = blue);
Here is a Maple program called shape_plot that summarizes a function's attributes graphically. It plots the function so that the differing colors and thickness of the graph indicate what properties each portion of the graph has.
Increasing Decreasing
Curve color and thickness Thick blue curve Thin red curve
Concave up Concave down
Color area shading Green shading upward Beige shading downward
>
shape_plot := proc(f,a,b)
local box,i,n,x1,x2,xmid,delta,y1,y2,A,B, m,M,slope, concav:
n:= 100; delta := (b-a)/n; x2 := a;
M := maximize( f(x), x = a..b); m := minimize(f(x), x = a..b);
for i from 1 to n do
x1 := evalf(x2); y1 := evalf( f(x1));
x2 := evalf(a + i*delta); y2 := evalf( f(x2)); xmid := x1 + delta/2;
slope := evalf( subs( x = xmid, diff( f(x), x )));
concav := evalf( subs( x = xmid, diff( f(x),x $ 2)));
if( slope > 0 )
then A[i]:=plot( f(x), x = x1..x2, color = blue, thickness = 4 );
else A[i]:=plot( f(x), x = x1..x2, color = red, thickness = 2 );
fi;
if( concav > 0 ) then
B[i]:=polygonplot([[x1,M],[x1,y1],[x2,y2],[x2,M]],
color=green,style=patchnogrid);
else
B[i]:=polygonplot( [[x1,m],[x1,y1],[x2,y2],[x2,m]],
color=sienna,style=patchnogrid);
fi;
od;
display({ seq( A[i],i=1..n ),seq( B[i],i=1..n ) } );
end:
> shape_plot(g1,-5,5);
Note that local maxima occur where the curve changes from blue to red, and local minima occur where the graph changes from red to blue. Inflection points occur where the shading changes from green to beige or vice-versa.
Example 2
g ( x ) = x sin (x), x in [0, 2
].
> g2:= x -> x * sin(x);
> plot(x * sin(x), x =-1..7);
From the plot it appears that we have one local max and two local min.
> D(g2);
>
We need to find where g2' (x) = 0; it is defined for all x.
When x = 0, we have g2'(x) = 0 and hence 0 is one critical value.
Setting g2' (x) = 0, and dividing by cos(x) we obtain: tan(x) = -x.
We plot y = tan(x) and y = -x and look for intersections. We do three plots to avoid where
tan(x) is not defined.
> a2:= plot(tan(x), x = 0..Pi/2 - .1, color = black):
> b2:= plot(-x, x = 0..4, color = blue):
> bb2:= textplot([3,5,`PLOT 1`], color = magenta):
> display({a2,b2,bb2});
>
> c2:= plot(tan(x), x = Pi/2 + .1..(1.5)*Pi - .1, color = black):
> d2:= plot(-x, x = 0..5, color = blue):
> dd2:= textplot([2,5,`PLOT 2`], color = magenta):
> display({c2,d2,dd2});
>
> e2:= plot(tan(x), x = (1.5)*Pi + .1.. 2* Pi, color = black):
> f2:= plot(-x, x = 0..7, color = blue):
> ff2:= textplot([2,-6,`PLOT 3`], color = magenta):
> display({e2,f2,ff2});
>
From Plot 1 we see that x = 0 is a critical pont. From Plots 2 and 3 we see that there
is precisely one critical point in (
/2, 3
/2), call it c1, and precisely one critical
point in (3
/2, 2
), call it c2. Lets get numerical estimates for c1 and c2.
> fsolve(tan(x) = -x, x = Pi/2.. 3*Pi/2);
> fsolve(tan(x) = -x, x = 3*Pi/2.. 2*Pi);
Hence there are three critical points: x = 0, x = c1 ~
, and x = c2 ~
.
We have that g2' (x) > 0 iff sin(x) > -x cos(x) iff (recall where cos(x) > 0)
tan(x) > -x for x in [0,
/2) OR x in (3
/2, 2
] (recall where cos(x) > 0.)
OR
tan(x) < -x for x in (
/2, 3
/2).
(Recall where cos(x) > 0.)
From plots 1,2,3 we see that g2' (x) > 0 iff x is in (0,
/2), (c2, 2
), (
/2,c1).
Hence, g2 is increasing iff x is in (0,
/2), (c2, 2
), (
/2,c1).
Thus, g2 has a local min when x = 0, c2 and a local max when x = c1.
We now turn to concavity.
> D(D(g2));
Thus g2'' (x) > 0 iff 2 cos(x) > x sin(x) iff (recall where sin(x) > 0)
2 cot(x) > x and x in (0,
) OR
2 cot(x) < x and x in (
,2
).
Again, we plot y = cot(x) and y = x.
,
> h2:= plot(cot(x), x = 0.1..Pi-.1, color = black):
> i2:= plot(x/2, x = 0..4, color = blue):
> j2:= textplot([1,6,`PLOT 1`], color = magenta):
> display({h2,i2,j2});
> k2:= plot(cot(x), x = Pi + .1 .. 2*Pi - .1, color = black):
> l2:= plot(x/2, x = 3..7, color = blue):
> m2:= textplot([4,8,`PLOT 2`], color = magenta):
> display({k2,l2,m2});
Let e1 denote the unique point in ( 0,
) where 2 cot(x) = x and let
e2 denote the unique point in (
, 2
) where 2 cot(x) = x.
Thus, g2''(x) > 0 iff x is in (0, e1) OR (e2, 2
).
Hence g2 is concave up iff x is in (0, e1) OR (e2, 2
).
Both x = e1, e2 lead to points of inflection.
Lets get numerical estimates for e1,e2.
> fsolve(D(D(g2))(x) = 0, x, 0.1.. Pi - .1);
> fsolve(D(D(g2))(x) = 0, x, Pi + .1.. 2 * Pi - .1);
Thus, e1 ~
and e2 ~
.
> shape_plot(g2,-1,7);
Example 3
First note that we cannot use x = 0.
The limit of g(x) as x goes to positive (or negative) infinity is 1 and hence
we have a horizontal asymptote: y = 1.
> g3:= x -> (3 + x^2) / ( x^2);
Lets plot to see what the graph looks like.
> plot(g3(x), x = 1..4, color = black);
> plot(g3(x), x = -4..-1, color = black);
From the plot we conjecture there are no extrema, the function is increasing
for x <0 and decreasing for x > 0, concave up on ( -
, 0) and (0,
).
No points of inflection. .
> D(g3);
> simplify( 2 /x - 2*(3 + x^2)/(x^3));
Thus, g3' (x) =
and hence 0 is the only critical point.
Also, g3''(x) =
, which is positive for x NOT 0.
Hence our conjecture is correct.
> shape_plot(g3,-4,-1);
Example 4
> g4:= x -> surd(x-4,3) * 2 * x;
> plot(g4(x), x = -5..7);
From the plot is appears there is one minimum and no maximum.
> D(g4);
> simplify( (2/3) * (surd(x-4,3)*x)/(x-4) + 2 * surd(x-4,3));
From the above we see there are two critical points; namely when x = 4 and x = 3.
Further simplification gives that
g4' (x) =
As the denominator is always positive (where defined), we have that
g4'(x) > 0 iff x > 3. Thus g4 is increasing iff x > 3.
Hence, g4 has a local minimum when x = 3.
We need to determine concavity.
> D(D(g4));
> simplify( -4/9*surd(x-4,3)*x/((x-4)^2)+4/3*surd(x-4,3)/(x-4));
Thus, g4''(x) =
. We conclude that
g4''(x) > 0 iff x < 4 or x > 6.
Thus, g4 is concave up on (-
, 4) and (6,
) and is concave down on
(4,6). Thus we obtain points of inflection when x = 4,6.
Can we better see the change in concavity when x = 6?
> plot(g4(x), x = 4..7, color = black);
> shape_plot(g4,4,7);