
\chapter{Curve Sketching}

\index{curve sketching}
In this section we discuss how to sketch the graph of a function $y=f(x)$
without plotting many points. 
Indeed, most parts of a curve are routine and uninteresting 
and plotting them precisely
serves very little purpose. What is really important is to learn the exact points features of the curve change and if we plot these points precisely
then we will have a reliable as well as useful graph.

Without having to make up a table of values
for the function, we can obtain a good {\it qualitative} picture of the
graph using certain crucial information --- local maxima and local minima,
inflection points, asymptotes, etc.  Our aim is not to draw an exact graph,
but rather to get an accurate overall picture of the graph and to pinpoint
the points where something special happens. \index{qualitative picture of graph} 


We start by describing the
steps to take in curve sketching.  For a particular $f(x)$, not all of the
steps below will necessarily lead to useful information.  The various
possibilities will be illustrated later in the examples.



\section{Maxima/Minima} 

If $(p,f(p))$ is a point where $f(p)$ is the \index{highest value} highest value 
as long as the $x$-values vary in a small interval around $p$,
then $f(p)$ is said to be a {\bf local maximum}value of $f(x)$. Similarly,
$f(p)$ is a {\bf local minimum} value, if $f(p)$ is the lowest value
as $x$ varies in a small interval near $p$. Collectively, a
local maximum or minimum is called a {\bf local extremum.} The plurals
of maximum, minimum and extremum are maxima, minima and extrema respectively.

If the derivative $f'(x)$ exists at $x=p$, or, in other words, if
the tangent line to the curve $y=f(x)$ exists at $x=p$, then
it can be shown that  {\it the tangent line at that point is horizontal}, 
i.e., $f'(p)=0$. 
The idea of the proof of this claim
is easy. If $f'(p)>0$ then the function is increasing near $x=p$ and
there must be values of $f(x)$ bigger than $f(p)$ near (and to the right)
of $x=p$. Similarly, if 
$f'(p)<0$, then the function is decreasing at $x=p$ and there
must be values of $f(x)$ smaller than $f(p)$ near (and to the left)
of $x=p$. So, in either case, the function cannot have a local maximum
at $x=p$. The case of a local minimum is similar.

%%% To update!
Such points can thus be found by setting the derivative equal to
zero, and solving for $x$.  (There may be one $x$ for which $f'(x)=0$,
there may be many, or there may be none.)  Once you find the $x$ for which
$f'(x)=0$ (and the corresponding $y$-coordinate of each possible max/min
point), you have to determine whether it really is a maximum or minimum.
In simple examples it might be obvious.  A systematic way to tell is by the
\index{second derivative test} second derivative test, which will be described below.


%--- figure NA (curve sketching--max/min)--------------------
\begin{center}
\begin{psfigure}{\textwidth}{1.5in}{figNA.ps}
\end{psfigure}\\
\end{center}
%------------------------------


First, we make a few remarks. 
\begin{enumerate}
\item
The reason for using the term {\bf local maximum} point instead of just
``maximum '' is that it may not actually be a maximum value
of the function on the whole domain.  
As in the above drawing, the local maximum might 
only be the maximum $f(x)$ for all nearby $x$ --- the function might later
turn again and go up to a higher value.  The reason for the use of
the term {\bf local  minimum} instead of just ``minimum'' is similar.
Sometimes, local maxima and minima are referred to as  ``upper turning
points'' and ``lower turning points.''

What is usually understood by the ``maximum'' will be called the ``absolute
maximum''. Thus $f(p)$ is said to be the absolute maximum value of $f(x)$
on some interval, if it is bigger than or equal to $f(x)$ as $x$ varies over the interval. The term absolute minimum is similar. Some people use the term
``global'' in place of ``absolute''.

If you want to be very precise, you should never use the terms maximum or minimum without some adjective like  ``local'' or ``absolute'' or ``global''.
If a given word problem does not use these precise terms, then you should 
use some common sense reasoning to determine what the question must mean!



\item 
A maximum or minimum might occur at a point where there is no 
well defined tangent line, i.e., where $f'(x)$ does not exist.  
For example, $f(x)=|x|$ has its
(local as well as absolute) minimum point at $(0,0)$. 

Sometimes a curve has a \index{vertical tangent} vertical tangent. At such a point, the value 
of $f'(x)$ will come out undefined as the limiting process for
the derivative will lead to $\pm \infty$ as limiting values. For
our purposes, we can treat this also as a case of $f'(x)$ undefined, even 
though it is possible to make a reasonable definition and declare it well defined. A simple example of this is the curve $y=\sqrt[1/3]{x}$ which has a 
vertical tangent at $x=0$. \footnote{ Generally, we forbid taking 
fractional powers of negative numbers. However, the function that we are talking about here
is the ``real'' cube-root which is well defined even for negative values of $x$. It can be thought to be the usual cube-root function extended to the
negative values by making it an odd function.} 
  
\item
Suppose you want to find the \index{absolute maximum} absolute maximum of a function $f(x)$ 
on the interval from $a$ to $b$.  To do this, you have to try 
\begin{enumerate}
\item all points $x$ where $f'(x)=0$, 
\item all points $x$ where $f'(x)$ does not exist (as explained above), and 
\item the endpoints $a$ and $b$ (for example, in the above drawing the 
maximum point is at the endpoint $b$).
\end{enumerate}

The largest of the function values among these shall come out to be the absolute maximum.

\item 
Later, we will see examples of points where, even though the slope of the
tangent line is $0$, we have {\it neither} a maximum nor a minimum there.
\end{enumerate}

\section{The Second Derivative Test} 

Suppose that $x=p$ is a solution of $f'(x)=0$.  The \index{second derivative test} second derivative test is
a method that {\bf in most cases}
will tell us whether the point $(p,f(p))$ is a
local maximum or minimum.  The test works as follows.  

Compute the {\it
second derivative of the function at the same value $x=p$}, i.e., $f''(p)$.  If
$f''(p)$ is positive, that means that $f'(x)$ is an increasing function at
$p$, i.e., $f'(x)$ is negative a little to the left of $p$ and is positive
a little to the right of $p$.  This is what happens near a {\it local
minimum}.  On the other hand, if $f''(p)$ is negative, then $f'(x)$
is positive a little to the left of $p$ and is negative a little to the
right of $p$, which is what happens near a {\it local maximum}.  If it so
happens that $f''(p)=0$ (i.e., if {\it both} $f'(p)$ and $f''(p)$ are zero
at the same $x$), then the second derivative test doesn't give you any
information.  To summarize,
\[
  f''(x)
    \begin{cases}
     >0&\text{$\Longrightarrow$min pt;}\\
     <0&\text{$\Longrightarrow$max pt;}\\
     =0&\text{$\Longrightarrow$can't tell.}
   \end{cases}
\]

To see how and why this test succeeds or fails, you should always consider 
graphs of the functions $x,x^2,x^3,x^4$. We have provided a picture below. 
You should analyze the point $x=0$ in each case.


%%%% To update! Add  graphs of the functions mentioned together with the
%%%% derivatives at $x=0$.

\section{The First Derivative Test} 
The Second Derivative Test works like a charm if we can find $f''(x)$ and 
it is nonzero. If it is difficult to evaluate or zero, then the first 
derivative case comes in handy. In fact, it can also be used in place 
of the Second Derivative Test.

Suppose you are testing a point $x=p$ and $f'(p)=0$. You wish to check if 
this is a local maximum or local minimum. Evaluate the derivative $f'(x)$ 
at a point $x_1$ to the left of $p$ {\bf and near} $p$. Also evaluate the
derivative $f'(x)$ at a point $x_2$ to the right of $p$ {\bf and near} $p$.

The test says:
\begin{enumerate}
\item If $f'(x_1)>0$ and $f'(x_2)<0$, the $x=p$ is a local maximum.
\item If $f'(x_1)<0$ and $f'(x_2)>0$, the $x=p$ is a local minimum.
\item If $f'(x_1)$ and $f'(x_2)$ have the same sign, then it is neither a local maximum nor a local minimum. It is an ``inflection point'' discussed below.
\end{enumerate}

As you can see, this test is definitive. The only problem is to decide how near 
should the points $x_1,x_2$ should be. The requirement is that {\bf there should be no critical points of the function} inside $[x_1,p)$ and $(p,x_2]$.
If you have only finitely many critical points, then this will be easy to do. 
If you have infinitely many critical points which cluster around $x=p$, then 
this test cannot be applied at all!

See if you can think of such functions, they don't appear naturally.

\section{Concavity and Inflection}  

\index{concavity}
We know that the sign of the derivative tells whether a function is
increasing or decreasing.  For example, any time that $f'(x)>0$, that means
that $f(x)$ is increasing.  We now explain the geometrical meaning of the
sign of the {\bf second} derivative.  Suppose that $f''(x)>0$ for a certain
interval of $x$.  This means that as we go from left to right across the
interval, the slope of the tangent line increases.  We say that the
function is ``concave upward'' over this interval.  The pictures below
all show concave upward functions.

 
~~~
%--- figure NB (curve sketching--concave up)--------------------
\begin{center}
\begin{psfigure}{\textwidth}{1.5in}{figNB.ps}
\end{psfigure}\\
\end{center}
%------------------------------

Conversely, if $f''(x)<0$ over a certain interval, then the slope of the
tangent line decreases, and we say that the function is ``concave downward.''
The pictures at the top of the next page all show concave downward functions.

%----figure NC -------------------------
\begin{center}
\begin{psfigure}{\textwidth}{1.5in}{figNC.ps}
\end{psfigure}\\
\end{center}
%------------------------------


There are several ways to describe the difference between \index{upward concavity} upward concavity
and \index{downward concavity} downward concavity: (1) An upward concave function looks like part of a
right-side-up bowl (holds water), while a concave downward function looks
like part of an upside-down bowl.  (2) If you draw the tangent line to a
concave upward function at a point, then the curve sits on the tangent
line, whereas in the case of a concave downward function the tangent line
rests on the curve.  (3) As you go from left to right, the tangent line to
a concave upward curve rotates counterclockwise, while the tangent line to
a concave downward curve rotates clockwise.

\smallskip

A point that separates a region of upward concavity and a region of
downward concavity is called a {\bf point of inflection}.  The geometrical
meaning of a point of inflection is that, as you roll the tangent line
along the curve from left to right, at a \index{point of inflection} point of inflection it reverses
its direction of rotation (from clockwise to counterclockwise, or
vice-versa).  That is, {\it the sign of second derivative changes as you
roll past a point of inflection}. Thus, inflection points can be found by
setting $f''(x)=0$ and solving for $x$.  Each of the drawings for Examples
13.1 and 13.2 below shows a point of inflection at the origin separating a
concave downward part of the curve (on the left) from a concave upward part
(on the right).

{\bf Warning.} Notice that $(x,f(x))$ may not be a point of inflection even
though $f''(x)=0$.  After finding the points where $f''(x)=0$, you then
must check that $f''(x)$ changes sign. (See Example~13.5 below.)

\section{Asymptotes and Other Things to Look For}  

An \index{asymptote of a curve} asymptote of a curve is a line which will be a tangent to the curve if
the curve can be analyzed near infinity. There are precise ways of 
discussing points at infinity of a curve and making this discussion 
rigorous. We will, however, take a naive definition and learn 
how to recognize asymptotes.

Thus, an asymptote for us will be a line such that the graph of the curve 
approaches the line along some branch of the curve going out to the infinite 
region of the plane.
 
The easiest to analyze is a \index{vertical asymptote} vertical asymptote. 
A vertical line $x=p$ is an asymptote to $y=f(x)$, if $f(x)$ becomes
infinite as $x$ nears $p$. It is possible that the function 
gets closer to plus or minus $\infty$ depending our approach to
the point $x=p$. Usually, the formula for the function has a denominator that becomes zero at $x=p$.
For example, the reciprocal function has a vertical asymptote at $x=0$, and
the function $\tan x$ has a vertical asymptote at $x=\pi/2$ (and also at
$x=-\pi/2$, $x=3\pi/2$, etc.). 

Note that usually $f(p)$ would not be defined - or at least 
not naturally defined by the formula. It may be artificially
defined in the construction of the function.

Vertical asymptotes are found by asking when the denominator of the
formula of a function goes to zero.

\smallskip

A \index{horizontal asymptote} horizontal asymptote is a horizontal line to which $f(x)$ gets closer and
closer as $x$ approaches $\infty$ (or as $x$ approaches $-\infty$).  For
example, the reciprocal function has the $x$-axis for a horizontal
asymptote.  Sometimes one also encounters slanted lines for asymptotes.
For example, the function $f(x)=2x+\frac{1}{ x}$ has the line $y=2x$ as a
slanted asymptote, because when $x$ is large $2x+\frac{1}{ x}$ and $2x$ are
very close together.

In general a line $y=mx+c$ shall be an asymptote to $y=f(x)$ if the expression
$g(x)=f(x)-(mx+c)$ approaches $0$ as $x$ approaches $\infty$ (or as 
$x$ approaches $- \infty$.

\smallskip

If the domain of our function does not extend out to infinity, we should
also ask what happens as $x$ approaches the boundary of the domain.  For
example, the function $y=f(x)=1/\sqrt{r^2-x^2}$ has domain $-r<x<r$, and
$y$ becomes infinite as $x$ approaches either $r$ or $-r$. Thus
we get vertical asymptotes. This reconfirms the fact that {\bf in general}, 
if $x=p$ is a vertical asymptote then $x=p$ is {\bf not in the domain.}

\smallskip

If there are any points where the derivative fails to exist (a cusp or
corner), then we should take special note of what the function does at such
a point.

\smallskip

Finally, it is worthwhile to notice any \index{symmetry} symmetry.  A function $f(x)$ that
has the same value for $-x$ as for $x$, i.e., $f(-x)=f(x)$, is called an
``even function.''  {\bf It is crucial that this property holds
throughout the domain of the function. It is not enough to check
the equation for a few sample points!}
Its graph is symmetric with respect to the $y$-axis.
The most important examples of \index{even functions} even functions are: $x^n$ when $n$ is an even number, indeed, this is the reason for the use of the word {\bf even}.
Other  examples of even functions are: $\cos x$, and $\sin^2x$. Expressions
formed from even functions are also even, for example $x^2+1/x^2 - \cos(2x)$.

On the other hand, a function that satisfies the
property $f(-x)=-f(x)$ is called an ``odd function.''  Its graph is
symmetric with respect to the origin. {\bf The warning about checking the whole 
domain should be applied here also.} 
As before,
the main examples of \index{odd functions} odd functions are: $x^n$ when $n$ is an odd number, and
as before this is the reason for the terminology.

Some more examples of odd functions are: $\sin x$, and $\tan x$. Unlike 
even functions, expressions in odd functions may fail to stay odd. For example
the square of an odd function is always even! However, an odd function 
stays off if multiplied by a constant and sums of odd functions are 
odd.  

Of course, most functions are neither even nor odd, and do not have any particular symmetry. {\bf A striking fact is that every function 
$f(x)$ can be written as an odd function $g_1(x)$ and an even function $g_(x)$.
You should try to prove this.} 

%%%% To update! Add tabular methods and/or other graphs.
%%%% Perhaps add computer/calculator related sections.
% Example 1
\begin{example}

Sketch $y=x^3-x$.

\smallskip
\begin{rightindent}{3.5in}
First, we set $0=y'=3x^2-1$, which has solutions $x=\pm\sqrt{3}/3=\pm
0.577$.  The corresponding $y$-coordinates are $-0.385$ and $+0.385$, i.e.,
the two ``critical points'' are $(0.577,-0.385)$ and $(-0.577,0.385)$.  The
second derivative test gives $y''=6x$, which is positive for the first
point and negative for the second.  Thus, the first of the two points (in
the fourth quadrant) is a local minimum, and the second is a local maximum.
Since $y''>0$ when $x>0$ and $y''<0$ when $x<0$, it follows that the curve
is concave upward in the right half of the graph and concave down-
\end{rightindent}
\hfill
%--- figure ND (curve sketching--Example 1)--------------------
\begin{psfigure}{1.95in}{2.0in}{figND.ps}
\end{psfigure}
%------------------------------
ward in the left half. The two halves are
separated by the inflection point at the origin.  This curve has no
asymptotes.  It does have symmetry, however, because it is an odd function.
Its graph is shown above.

\end{example}

\begin{rightindent}{3in}
% Example 2
\begin{example}

Sketch $y=x^3+x$.

\smallskip

The only difference with Example 13.1 is the $+$ in front of the $x$.  But
this means that the derivative $y'=3x^2+1$ is {\it never} zero, and hence
there are no local maxima or minima.  In fact, the function is always increasing,
because $y'$ is always positive.  The second derivative $y''=6x$ is the
same as in the last problem, and hence the concavity situation is the same.
In particular, this curve also has an inflection point at the origin.

\end{example}
\end{rightindent}
\hfill
%--- figure NE (curve sketching--Example 2)--------------------
\begin{psfigure}{2in}{2in}{figNE.ps}
\end{psfigure} 
%------------------------------

% Example 3
\begin{example}

Sketch $y=x^2-\cos(2x)$ for $-\pi/2\le x\le\pi/2$.

\smallskip

When we set $0=y'=2x+2\sin(2x)$, we obtain the equality $\sin(2x)=-x$.
However, from a quick sketch of the two curves $\sin(2x)$ and $-x$, we
immediately see that the only $x$ for which they are equal is $x=0$.  When
$x=0$ the $y$-coordinate is $0^2-\cos(2\cdot 0)=-1$, so our critical point
is $(0,-1)$.  Since $y''=2+4\cos(2x)$, which is positive when $x=0$, the
second derivative test tells us that $(0,1)$ is a local minimum.  To find
inflection points we set $0=y''=2+4\cos(2x)$.  This gives $\cos(2x)=-0.5$.
Looking at our table in the section on trig functions, we see that in the
range from $x=0$ to $x=\pi/2$ the equality $\cos(2x)=-0.5$ holds when
$2x=\frac{2}{ 3}\pi$, 
\begin{rightindent}{3in}
\noindent
i.e., $x=\pi/3$.  Since $\cos(-2x)=\cos(2x)$, the
equality also holds when $x=-\pi/3$.  Thus, the points $(\pi/3,1.5966)$ and
$(-\pi/3,1.5966)$ are inflection points.  Between these two inflection
points the second derivative is positive (concave up), whereas for
$x>\pi/3$ and for $x<-\pi/3$ the second derivative is negative (concave
downward).  Finally, note that $x^2-\cos(2x)$ is an even function, and so
the graph is symmetrical with respect to the $y$-axis.
\end{rightindent}
%--- figure NF (curve sketching--Example 3)--------------------
\begin{psfigure}{2.0in}{1.8in}{figNF.ps}
\end{psfigure}
%------------------------------
\end{example}

% Example 4
\begin{example}

Sketch $y=x^2+\frac{1}{ x}$.

\smallskip

Setting $0=y'=2x-\frac{1}{ x^2}$, we solve this by bringing $1/x^2$ to the
left and clearing denominators: $1=2x\cdot x^2=2x^3$.  So $x={\root
3\of{0.5}}= 0.7937$.  The corresponding $y$-coordinate is 1.8899.  Using
the second derivative $y''=2+2\cdot x^{-3}$, we see that this 
\begin{rightindent}{3in}
\noindent
is a local minimum.  To find inflections, we set $2+2/x^3=0$.  Clearing
denominators and solving for $x$ gives $x^3=-1$, and so $x=-1$.  Thus, the
point $(-1,0)$ is an inflection.  In this example we have an asymptote when
$x=0$.  To the right of the asymptote (i.e., for positive $x$), the second
derivative is always positive; whereas for negative $x$ the second
derivative is positive when $x<-1$ and negative when $x$ is between $-1$
and $0$.  Thus, the interval $-1<x<0$ is a region of downward concavity;
the graph is concave upward outside of this interval.  Putting all this
together leads to the graph at the right.
\end{rightindent}
\hfill
%--- figure NG (curve sketching--Example 4)--------------------
%
\begin{psfigure}{2.0in}{2.0in}{figNG.ps}
\end{psfigure}
%------------------------------

\smallskip

There is another way to think of this example.  Our function is the sum of
two functions $x^2$ and $1/x$.  The former function is by far the larger of
the two when $x$ is large positive or large negative, whereas the
reciprocal function is by far the more important when $x$ is near 0.  Thus,
the graph resembles $1/x$ when $x$ is near 0 and resembles $x^2$ when $x$
is far from 0.  Roughly speaking, the inflection point $(-1,0)$ and the
local minimum $(0.7937,1.8899)$ mark the transition from behaving like the
graph of $x^2$ to behaving like the graph of $1/x$.

\end{example}

% Example 5
\begin{example}

Sketch (a) $y=x^3$ and (b) $y=x^4$.

\smallskip


(a) Setting $0=y'=3x^2$, we see that the origin is a possible maximum or
minimum.  However, the second derivative test tells us nothing, since
$y''=6x$ also is zero when $x=0$.  In fact, even though $y'=0$ when $x=0$,
the origin is neither a maximum nor a minimum.  Rather, it is a point of
inflection, separating the concave downward region in the third quadrant
from the concave upward region in the first quadrant.

\smallskip


(b) Again we see that both the first derivative and the second derivative
vanish at the origin (and neither derivative is zero anywhere else).  This
time, however, the origin is a local minimum.  Even though the second derivative
test doesn't tell us this, we can see directly that, since $x^4$ is
positive for nonzero $x$, its smallest possible value is when $x=0$.  Note
that the origin is {\it not} a point of inflection, even though $y''=0$
there.  This is because $y''=12x^2>0$ both for $x>0$ and for $x<0$, so
everywhere we have upward concavity.  (It is rare for a point where $y''=0$
not to be an inflection point; this can occur only when the {\it third}
derivative $y^{\prime\prime\prime}$ is also zero at the same point.)

\begin{centering}
%--------------------------------------------------------------
%--- figure NH (curve sketching--Example 5)--------------------
\begin{psfigure}{4.5in}{1.5in}{figNH.ps}
\end{psfigure}\\
%------------------------------
\end{centering}

\end{example}


% Example 6
\begin{example}

Sketch $y=x^5-5x^4+5x^3$.

\smallskip

First, we set $0=y'=5x^4-20x^3+15x^2$.  To solve this, we factor out what
we can, namely $5x^2$.  This leaves a quadratic that can be factored either
by inspection or by the quadratic formula.  The result is
$0=y'=5x^2(x-1)(x-3)$.  Thus, the critical points are $(0,0)$, $(1,1)$, and
$(3,-27)$.  Using $y''=20x^3-60x^2+30x=10x(2x^2-6x+3)$, we see from the
second derivative test that $(1,1)$ is a local maximum and $(3,-27)$ is a
local minimum, but we get no information about $(0,0)$.  Setting $0=y''$
and using the quadratic formula to find the roots of $2x^2-6x+3$, we find
the following three points of inflection: $(0,0)$, $(0.634,0.569)$,
$(2.366,-16.32)$.

\begin{rightindent}{3.0in}
\noindent
  In a complicated case like
this, it is also worthwhile to see what the function is doing when $x$ is
large positive or large negative.  If $x$ is large, the $x^5$ term in our
function dominates (is greater in absolute value than all the other terms).
Thus, the function heads upward steeply into the first quadrant as
$x\longrightarrow+\infty$, and it heads steeply down into the third
quadrant as $x\longrightarrow-\infty$.  Putting this information together,
we obtain the graph shown above.  The curve is concave downward in the
third quadrant, and also between the two points of inflection
$(0.634,0.569)$ and $(2.366,-16.32)$.  For $0<x<0.634$ and for $x>2.366$
the curve is concave upward.
\end{rightindent}
\hfill
%--- figure NI (curve sketching--Example 6)--------------------
%
\begin{psfigure}{2.45in}{2.5in}{figNI.ps}
\end{psfigure}
%------------------------------

\end{example}


