%\setcounter{page}{500}
\chapter{The Derivative\label{DerivativeChapter}}

The earlier chapters are preludes to the calculus.
With this chapter we begin to study calculus proper.
We begin with  {\it differential calculus},
which is taken to mean the calculus of derivatives.
In later chapters, and once we have some handle
on derivatives, we then
look towards {\it integral calculus} where, roughly
speaking, we see how to reverse what we do here.\footnotemark
\footnotetext{This is a nontrivial  task, as we will see
in later chapters.}  In short  differential
calculus addresses rates at which quantities change, while integral
calculus addresses how quantities (or the changes in quantities) accumulate.
Once we lay the foundations of differential and integral
calculus, we will  further develop and apply
both in very diverse circumstances for the remainder of the text.

\section[Derivative, Rate of Change, and Slope]%
{The Derivative, Rates of Change and Slope
\label{DerivativeSection1}}

Suppose that we are passengers in a car driving West to East
along a highway.  Further suppose that we cannot see the
speedometer (measuring speed)  but the highway is marked
at regular distance intervals so we can measure our
position accurately.\footnotemark\hphantom{. }\footnotetext{
Alternatively, we have a very accurate odometer or global positioning device
in plain view.}
  Using a stopwatch,
we see that we traveled a total of 130 miles in 2 hours
for the whole trip.
Then we would say our average velocity (with positive
measured in the Eastward direction) was
$$\frac{130\ \text{mi}}{2\ \text{hr}}=65\ {\text{mi}}/{\text{hr}}.$$
%
Now suppose that during the trip we would like to know our
actual  velocity
at a particular time $t_1$.  The average
for the whole trip does not usually reflect the velocity at
any particular time $t_1$ with acceptable
accuracy, since we could have been stopped
for a break at that particular time, or speeding up to
pass a truck,  or even driving in reverse
(for  a negative velocity).  One way to attempt to
approximate the velocity at time $t_1$ is to begin
our stopwatch at $t_1$, see how far we traveled
in the next minute, and calculate the average
 velocity for the
time interval  $t\in[t_1,t_1+1\ \text{minute}]$.

At this point some notation will be useful.  We will
take the position function to be $s(t)$.
We will denote a change in $t$ by $\Delta t$, read
``delta $t$.''\footnotemark\hphantom{. }\footnotetext{Note that we
take $\Delta t$ as one quantity.  It is {\it not}
``$\Delta$ times $t$.''  One can read $\Delta t$ to
be synonymous with the {\it change} in $t$.  Occasionally
we will write $\Delta t=(\Delta t)$ to remove ambiguity
and reinforce that it is one quantity. (Here $\Delta$
is the capital Greek letter delta.)}
With $t_1$ as the initial time in our experiment to approximate
velocity, and  $t_2=t_1+\Delta t$ as the final
time, we see the change is indeed $t_2-t_1=\Delta t$.
The average velocity over any $[t_1,t_2]$
is thus
$$\frac{s(t_2)-s(t_1)}{t_2-t_1}
=\frac{s(t_1+\Delta t)-s(t_1)}{\Delta t}.$$
%
If we take $\Delta s=s(t_1+\Delta t)-s(t_1)$ to be
the change in $s$ which results from the change in
$t$ from $t_1$ to $t_1+\Delta t=t_2$, then we have
the average velocity also equal to
$(\Delta s)/(\Delta t)$, i.e.,
$$\frac{s(t_2)-s(t_1)}{t_2-t_1}
=\frac{s(t_1+\Delta t)-s(t_1)}{\Delta t}=
\frac{\Delta s}{\Delta t}.$$
This is akin to  the old-fashioned ``rate equals distance
divided by time'' that is taught in grade school.\footnotemark
%
\footnotetext{
The grade school formula is lacking in that it
always assumes velocity is constant, and does not
distinguish between ``distance'' and ``displacement,''
or ``distance'' and ``position.'' (Distance only
carries a nonnegative sign.) It is only mentioned
here because of its familiarity.}
%
With this we can get back to the problem of attempting
to find the velocity at time $t_1$.
If we let $\Delta t$ equal one minute, then we look
to see how far we traveled in that one minute,
and find the average velocity for that minute.  {\it If
the velocity did not change very much in that time
interval, then the average velocity will closely
approximate the actual velocity}, which we will
denote $v(t_1)$ (what we would have read on the
speedometer---except for a possible sign difference---were it available):
$$\frac{\Delta s}{\Delta t}=\frac{s(t_1+1\ \text{minute})-s(t_1)}
{1\ \text{minute}}\approx v(t_1).$$
On the other hand, many things can happen in a minute
which can cause the velocity to change significantly.
Perhaps we have a true velocity of 65  miles/hour at $t_1$,
but then slow to a stop at a
toll booth during that minute, and thus unacceptably underestimate
$v(t_1)$ as approximated by the average velocity for $[t_1,t_2]$.
If possible, it would likely be
much better to measure how far we traveled in the first
{\it second} after $t_1$, since most cars cannot change velocity
significantly in such a time interval except in catastrophic
circumstances (e.g., collisions).  Thus\footnotemark
\footnotetext{Of course we need to convert units to be
consistent, eg., 1 second = (1/3600) hour), and so on.}
$$v(t_1)\approx \frac{s(t_1+1\ \text{second})-s(t_1)}{1\ \text{second}}.$$
Following the same line of thinking,
it  seems reasonable that we can better approximate
the actual value of $v(t_1)$ by taking the average velocity
over an interval $[t_1,t_1+\Delta t]$ with smaller and smaller
values of $\Delta t$ (such as one minute, one second, 0.001 seconds,
etc.).  For this reason we actually {\it define} the velocity
at time $t_1$ by
$$v(t_1)=\lim_{\Delta t\to0}\frac{s(t_1+\Delta t)-s(t_1)}{\Delta t}
=\lim_{\Delta t\to 0}\frac{\Delta s}{\Delta t}.$$
Recall that we have to consider $\Delta t\to0^-$ as well as
$\Delta t\to0^+$ in this calculation.  This is not unreasonable,
as we could also approximate $v(t_1)$ by considering how far we
went in the minute, second, 0.001 second, etc., ending with $t_1$.
Now we will state the velocity in a formal definition.
%
\begin{definition}Given a position function $s(t)$, define
the {\bf velocity} at a time $t$ to be the function given by
the limit
\begin{equation}
v(t)=\lim_{\Delta t\to0}\frac{\Delta s}{\Delta t}=
\lim_{\Delta t\to0}\frac{s(t+\Delta t)-s(t)}{\Delta t},
\label{VelocityDefinition}\end{equation}
for each $t$ for which the limit {\rm(\ref{VelocityDefinition})}
exists, and where we also define
\begin{equation}\Delta s=s(t+\Delta t)-s(t).\end{equation}
\end{definition}
%
For now it is the second part of (\ref{VelocityDefinition})
that will be most useful.  If we are lucky enough to
know an algebraic formula for $s(t)$ as a function,
then we can use the limit to calculate $v(t)$.
%
\bex Suppose that position is given by
$s(t)=t^2+1$.  We can use (\ref{VelocityDefinition})
to calculate the velocity function for any {\it fixed\,\footnotemark}
 $t$:
\footnotetext{So we treat $t$ as a constant in the calculation
of $v(t)$.  It is $\Delta t$ which is approaching zero, while
$t$ remains fixed.}
\begin{align*}
v(t)&=\lim_{\Delta t\to0}\frac{s(t+\Delta t)-s(t)}{\Delta t}\\
&= \lim_{\Delta t\to0}\frac{\left((t+\Delta t)^2+1\right)
    -\left(t^2+1\right)}{\Delta t}\\
&=\lim_{\Delta t\to0}\frac{(t^2+2t\Delta t+(\Delta t)^2+1)
-(t^2+1)}{\Delta t}\\
&=\lim_{\Delta t\to0}\frac{t^2+2t\Delta t+(\Delta t)^2
+1-t^2-1}{\Delta t}\\
&=\lim_{\Delta t\to0}\frac{2t\Delta t+(\Delta t)^2}{\Delta t}\\
&=\lim_{\Delta t\to0}\left(2t+\Delta t\right)\\
&=2t.\end{align*}
We showed that $v(t)=2t$.
Thus, at time $t=5$ we have the position $s(5)=5^2+1=26$, and
velocity $v(5)=2(5)=10$.  Note that if $s$ is measured in
meters, and $t$ in seconds, then the units in the limit
(\ref{VelocityDefinition})
are meters/second, as we would hope.  (For $t=5$ seconds we would
have $s=26\ \text{meters}$, and $v=10\ \text{meters/second}$.)
\label{VelocityExample1}\eex

The ability to find a nonconstant velocity function is a tremendous
leap from the grade school notion of ``rate~=~distance/time.''
Having limits at our disposal made it possible.

Example~\ref{VelocityExample1}
is an example of what physicists call  {\it one-dimensional}
motion. It is worth illustrating the motion graphically.
In Figure~\ref{OneDMotionOnAxis}, page~\pageref{OneDMotionOnAxis}
we  show the position at various
times on a (one-dimensional)
 number line.  Note that the velocity is changing
throughout the motion, so for instance the velocity at
time $t=1$ is $+2$, but the particle moves 3 units right
in the next second.  That is because its velocity was
increasing even within that second.

\begin{figure}
\begin{center}
\begin{pspicture}(0,-1)(11.5,3)
\psline{<->}(0.5,1)(11.5,1)
\rput(11.4,1.3){$s(t)$}
\psline(1,.8)(1,1.2)
\rput(1,.5){1}
\psline(2,.8)(2,1.2)
  \rput(2,.5){2}
\psline(3,.8)(3,1.2)
  \rput(3,.5){3}
\psline(4,.8)(4,1.2)
  \rput(4,.5){4}
\psline(5,.8)(5,1.2)
  \rput(5,.5){5}
\psline(6,.8)(6,1.2)
  \rput(6,.5){6}
\psline(7,.8)(7,1.2)
  \rput(7,.5){7}
\psline(8,.8)(8,1.2)
  \rput(8,.5){8}
\psline(9,.8)(9,1.2)
  \rput(9,.5){9}
\psline(10,.8)(10,1.2)
  \rput(10,.5){10}
\psline(11,.8)(11,1.2)
  \rput(11,.5){11}

\pscircle[fillstyle=solid,fillcolor=black](1,1){.1}
\rput(0.15,2.5){$t=0$}
\rput(0.15,2){$v=0$}
\psline{->}(0.2,1.8)(.9,1.1)

\pscircle[fillstyle=solid,fillcolor=black](2,1){.1}
\rput(2,2){$t=-1$}
\rput(2,1.5){$v=-2$}
\rput(2,0){$t=1$}
\rput(2,-.5){$v=2$}

\pscircle[fillstyle=solid,fillcolor=black](5,1){.1}
\rput(5,2){$t=-2$}
\rput(5,1.5){$v=-4$}
\rput(5,0){$t=2$}
\rput(5,-.5){$t=4$}

\pscircle[fillstyle=solid,fillcolor=black](10,1){.1}
\rput(10,2){$t=-3$}
\rput(10,1.5){$v=-6$}
\rput(10,0){$t=3$}
\rput(10,-.5){$v=6$}

\end{pspicture}
\end{center}

\caption{Here we trace the one-dimensional motion $s(t)=t^2+1$
as a position on a  number line for times
$t=-3,-2,-1,0,1,2,3$.  The velocities $v=2t$ are
also given.
The graph reflects how the particle comes
in from the right for negative $t$, stops at $t=0$ ($s=1$, $v=0$), and moves
back out towards the right for positive $t$. }
\label{OneDMotionOnAxis}\end{figure}

Such limits are useful in more than just position/velocity problems;
we will have use for them throughout the text.
Because they are ubiquitous we generalize the notation
and call the functions which arise from these limits
{\it derivatives}.
%
\begin{definition}Given any quantity $Q$ which is a
function of the variable $x$, i.e., $Q=Q(x)$,
define the {\bf derivative} of $Q$ {\bf with respect
to} $x$ by the function $Q'(x)$, read
{\bf ``$Q$-prime of $x$''}, defined by
\begin{equation}
Q'(x)=\lim_{\Delta x\to0}\frac{Q(x+\Delta x)-Q(x)}{\Delta x}
\label{DifferenceQuotientDerivativeDefinition}\end{equation}
wherever that limit exists and is finite.

If this limit does not exist or is infinite at a given $x_0$,
we say $Q'(x_0)$ {\bf does not exist}.  If the limit does
exist as a finite number at $x=x_0$, we say $Q(x)$ is
{\bf differentiable} at $x_0$.
\end{definition}

So we require not only that the limit exists, but
that it is finite (i.e., exists as a real number).
We will make more use of the term {\it differentiable}
in later sections where its justification is clearer.

We also define the average rate of change over an interval
as before.  If the initial value of $x$ is $x_0$
(pronounced ``$x$-naught'' or ``$x$ sub zero''),
and the final value is $x_f$, then the {\it average rate of change
of $Q(x)$ with respect to $x$} for
$x\in[x_0,x_f]$ or $x\in[x_f,x_0]$ (depending upon
whether $x_0<x_f$ or $x_0>x_f$) is given by
\begin{equation}
\frac{Q(x_f)-Q(x_0)}{x_f-x_0}
=\frac{Q(x_0+\Delta x)-Q(x_0)}{\Delta x}
=\frac{\Delta Q}{\Delta x}
\label{DifferenceQuotient}\end{equation}
where
\begin{align}
\Delta x&=x_f-x_0,\\
\Delta Q&=Q(x_f)-Q(x_0)=Q(x_0+\Delta x)-Q(x_0).\end{align}
So we see that the derivative
(\ref{DifferenceQuotientDerivativeDefinition}) is just the limit
of the average rate of change in $Q$ (\ref{DifferenceQuotient})
on an interval with
endpoints $x$ and $x+\Delta x$, assuming that limit is finite.
Ratios of the form (\ref{DifferenceQuotient}) are commonly
called {\it difference quotients}.

With this notation, we can rewrite the velocity
function for a given $s(t)$ as:
\begin{equation}
v(t)=s'(t).\end{equation}
Because there are so many contexts, there are
many different notations.  They each have their
places and are worth knowing.\footnotemark\hphantom{. }
\footnotetext{In a later section
we will introduce the very powerful Leibniz notation for the
derivative $Q'(x)$, which we will then write
$\ds{dQ}/{dx}$ (notice the resemblance
to $\Delta Q/\Delta x$).}

\bex
Suppose that instead of a stopwatch and odometer we have
a very accurate fuel gage and odometer.
Let $V(s)$ be the volume of fuel in the tank at a
particular position $s$.  Then
$$V'(s)=
\lim_{\Delta s\to0}\frac{\Delta V}{\Delta s}=
\lim_{\Delta s\to0}\frac{V(s+\Delta s)-V(s)}{\Delta s}$$
represents the instantaneous rate of fuel consumption per unit
distance.  If $s$ is in miles and $V$ in gallons, this
would be the rate of gallons per mile consumed at that
particular position.  (If we prefer miles/gallon, we
can take the reciprocal.)  So the derivative can also
represent flow of a fluid.  Notice that the fuel should
be leaving the tank whenever the engine is running,
so $V$ should be decreasing as we drive.
This gives  $\Delta V<0$ when $\Delta s>0$,
giving $\Delta V/\Delta s<0$,  and thus $V'(s)<0$.
However the fuel running through the engine is
exactly the fuel leaving the tank, and so the
actual flow rate we would report would be $-V'(s)$
(to give a positive quantity) for any particular
position $s$.
\eex

There are countless other applications of the derivative.
All we need is a quantity $Q$ as a function of another quantity
 $x$, to
measure the rate that $Q$ changes as $x$ changes.
The average rate of change of $Q$ with respect to $x$
is again $(\Delta Q)/(\Delta x)$, and the instantaneous
rate is the number we get when we let $\Delta x\to0$,
giving the rate ``at that instant.''
\begin{definition}
For a quantity $Q$ which is a function of another quantity $x$,
\begin{enumerate}
\item The {\bf average} rate of change of $Q$ with respect
to $x$ on the interval with endpoints $x$ and $x+\Delta x$
(where $\Delta x\ne0$)
is given by
\begin{equation}\frac{\Delta Q}{\Delta x}=\frac{Q(x+\Delta x)-Q(x)}{\Delta x}.
\end{equation}
Alternatively, for any interval with endpoints $x_1$, $x_2$, $x_1\ne x_2$,
the average rate of change of $Q$ with respect to $x$ on that interval
is
\begin{equation}\frac{Q(x_2)-Q(x_1)}{x_2-x_1}
=\frac{Q(x_1)-Q(x_2)}{x_1-x_2}.\end{equation}
\item The {\bf instantaneous} rate of change of $Q$ with
respect to $x$ at the value $x$ is
\begin{equation}
\lim_{\Delta x\to0}\frac{\Delta Q}{\Delta x}
=\lim_{\Delta x\to0}\frac{Q(x+\Delta x)-Q(x)}{\Delta x}=Q'(x),
\end{equation} wherever that limit exists and is finite.\end{enumerate}

\end{definition}
All of these applications have their own interpretations.
Interestingly enough, the {\it analytic geometric} interpretation
of the derivative of a function unifies them all
in one graphical setting.  For the remainder of this
section, we will concentrate on the significance
of the derivative $f'(x)$ to the graph of $y=f(x)$.

First we will consider a very simple case.  Suppose
$$f(x)=mx+b,$$
where $m,b\in\Re$ are fixed constants.  Then
\begin{align*}f'(x)&=\lim_{\Delta x\to0}
\frac{f(x+\Delta x)-f(x)}{\Delta x}\\
&=\lim_{\Delta x\to0}\frac{[m(x+\Delta x)+b]-[mx+b]}{\Delta x}\\
&=\lim_{\Delta x\to0}\frac{mx+m\Delta x+b-mx-b}{\Delta x}\\
&=\lim_{\Delta x\to0}\frac{m\Delta x}{\Delta x}
=\lim_{\Delta x\to0}m=m.
\end{align*}
Thus, when $y=f(x)$ is the line $y=mx+b$ we get $f'(x)=m$;
if the function is a line then its derivative is the slope.

Recall that the slope of a line measures how rapidly
that line rises or falls as we move along the line and to the right.
In other words, slope measures the rate of change
in $y$ with respect to $x$.  That rate is constant on
a line, but changes on most curves.  Still, if we
look closely at a point $(a,f(a))$ on the graph
of $y=f(x)$,
we can often associate a slope with the curve there.\footnotemark
\footnotetext{Just as a naive observation of the Earth's surface
can lead us to believe the Earth is flat, if we were
standing on a curve at $(a,f(a))$, and very focused
on the curve at and around that point,
we might believe we are looking at a constant
slope. The actual slope is what we approach when
we focus more and more on that point, by letting $\Delta x\to0$.
}\hphantom{. }To measure this slope, again we would
if effect measure the way $y=f(x)$ changes (instantaneously)
with respect to $x$ at $x=a$.
With this motivation, we make the following definition:

\begin{definition}Given a function $f(x)$, the {\bf slope}
of the graph of $y=f(x)$ any point $(a,f(a))$ on the graph
is given by $f'(a)$, assuming this derivative exists there.\footnotemark
\footnotetext{Recall $f'(a)$ exists means exactly
that $\ds{\lim_{\Delta x\to0}\frac{f(a+\Delta x)-f(a)}{\Delta x}}$
exists as a limit and is finite.}
\end{definition}

A function and its derivative give two types of information
about the graph of $y=f(x)$:
\begin{itemize}
\item $f(x)$ gives the {\it height} of the graph for a particular $x$-value.
\item $f'(x)$ gives the {\it slope} of the graph at that $x$-value.
\end{itemize}
For instance, we saw in Example~\ref{VelocityExample1},
page~\pageref{VelocityExample1}
(using different variables) that
 $f(x)=x^2+1\implies f'(x)=2x$.
When we graph $y=x^2+1$, i.e., when we graph the function
$f(x)=x^2+1$, the function gives the height at each $x$,
and the derivative $f'(x)=2x$ gives the slope.
This is illustrated in Figure~\ref{FunctionWithTangents1}.

Of geometric interest is the {\it tangent line} to the graph
of $y=f(x)$ at a point $(a,f(a))$.  This is just the
line through $(a,f(a))$ with slope $f'(a)$:
\begin{definition} The line through $(a,f(a))$ with slope
$f'(a)$, i.e., the same slope as the function at $x=a$,
is the {\bf tangent line} to the graph of $y=f(x)$ through $(a,f(a))$.
\end{definition}
Several tangent lines are drawn in Figure~\ref{FunctionWithTangents1}.
A formula for the tangent line through $(a,f(a))$ presents itself
immediately, since we have a point $(a,f(a))$, and a slope $f'(a)$,
the modified point-slope form gives us:
\begin{equation}
y=f(a)+f'(a)(x-a).\label{TangentLineEq2}\end{equation}
This form (\ref{TangentLineEq2}) will appear throughout
the text, and in this chapter it will be particularly
apparent in Section~\ref{Differentials/LinearApproxs}.
For the function in Figure~\ref{FunctionWithTangents1},
for instance, the tangent line at $x=1$
is through $(1,f(1))=(1,2)$, with $f'(1)=2$, is
$y=2+2(x-1)$.

\begin{figure}
\begin{center}
\begin{pspicture}(-2.4,-.6)(2.4,6)
%%%\begin{pspicture}(-4,-1)(4,10)
%\psline{<->}(0,1)(8,1)
\psset{xunit=.6cm,yunit=.6cm}
\psaxes{<->}(0,0)(-4,-1)(4,10)
%\psplot[plotpoints=200,linewidth=1.5pt]{-3}{3}{x dup mul 1 add}
\parabola[linewidth=1.5pt]{<->}(-3,10)(0,1)
\pscircle[fillstyle=solid,fillcolor=black](-2,5){.1}
%\psplot{-3}{-.8}{-4 x -2 sub mul 5 add}
\psline{<->}(-.8,.2)(-3,9)

\rput(-4,5){$\ds{\begin{aligned}
                            f(-2)&=5\\
                           f'(-2)&=-4
                           \end{aligned}}$}
\pscircle[fillstyle=solid,fillcolor=black](0,1){.1}
%\psplot{-3}{3}{1}
\psline{<->}(-3.5,1)(3.5,1)
\rput(-2.9,1){$\ds{\begin{aligned}f(0)&=1\\f'(0)&=0\end{aligned}}$}
\pscircle[fillstyle=solid,fillcolor=black](1,2){.1}
%\psplot{-0.5}{3}{2 x 1 sub mul 2 add}
\psline{<->}(-.5,-1)(3,6)
\rput(2.4,2){$\ds{\begin{aligned} f(1)&=2\\ f'(1)&=2\end{aligned}}$}
\end{pspicture}
\end{center}
\caption{The graph of $f(x)=x^2+1$, along with the
tangent lines to the graph at $x=-2,0,1$.
The height at each $x$ is given by $f(x)$, while
the slope is given by $f'(x)=2x$.}
\label{FunctionWithTangents1}\end{figure}

\newpage\bex \label{SquareRootDerivativeExample}
Consider the function $f(x)=\sqrt{2x+1}$.
Then, a conjugate multiplication (third line below) gives us:
\begin{align*}
f'(x)&=\lim_{\Delta x\to0}\frac{f(x+\Delta x)-f(x)}{\Delta x}\\
&=\lim_{\Delta x\to0}\frac{\sqrt{2(x+\Delta x)+1}-\sqrt{2x+1}}{\Delta x}\\
&=\lim_{\Delta x\to0}\frac{\sqrt{2(x+\Delta x)+1}-\sqrt{2x+1}}{\Delta x}
  \cdot\frac{\sqrt{2(x+\Delta x)+1}+\sqrt{2x+1}}
         {\sqrt{2(x+\Delta x)+1}+\sqrt{2x+1}}\\
&=\lim_{\Delta x\to0}\frac{(2(x+\Delta x)+1)-(2x+1)}
        {\Delta x\left(\sqrt{2(x+\Delta x)+1}+\sqrt{2x+1}\right)}\\
&=\lim_{\Delta x\to0}\frac{2x+2\Delta x+1-2x-1}
         {\Delta x\left(\sqrt{2(x+\Delta x)+1}+\sqrt{2x+1}\right)}\\
&=\lim_{\Delta x\to0}\frac{2\Delta x}
 {\Delta x\left(\sqrt{2(x+\Delta x)+1}+\sqrt{2x+1}\right)}\\
&=\lim_{\Delta x\to0}\frac{2}
{\left(\sqrt{2(x+\Delta x)+1}+\sqrt{2x+1}\right)}%\\
%&
=\frac{2}{2\sqrt{2x+1}}
 = \frac1{\sqrt{2x+1}}.\end{align*}
To summarize,
$$f(x)=\sqrt{2x+1}\implies f'(x)=\frac1{\sqrt{2x+1}}.$$

We can make several observations about the form of this derivative.
First, note that $f(-1/2)=0$ exists, but $f'(-1/2)$ does not.
Of course for $x=-1/2$ we cannot take $\Delta x\to0^-$ or
we would be taking square roots of negative numbers.
Still, it is interesting to
notice that $f'(x)\to\infty$ as $x\to-1/2^+$.
Furthermore, as $x\to\infty$, we have $f'(x)\to0$, so the
function becomes less sloped as we take $x$ farther to
the right.  This is all reflected in the graph, as
illustrated in Figure~\ref{FunctionWithTangents2}.
\eex

\begin{figure}
\begin{center}
\begin{pspicture}(-2,-1)(8,4)
\psaxes{<->}(0,0)(-2,-1)(8,4)
\psplot[plotpoints=200]{-0.5}{8}{x 2 mul 1 add sqrt}

\pscircle[fillstyle=solid,fillcolor=black](-.5,0){.1}
\rput(-2.5,1){$f'\left(-\frac12\right)$ does not exist.}
\psline{->}(-1,.8)(-.6,.1)

\pscircle[fillstyle=solid,fillcolor=black](0,1){.1}
\rput(1,1){$f'(0)=1$}

\pscircle[fillstyle=solid,fillcolor=black](4,3){.1}
\rput(4,2.5){$f'(4)=\frac13$}

\pscircle[fillstyle=solid,fillcolor=black](6,3.605551275){.1}
\rput(6.5,3.){$f'(6)=\frac1{\sqrt{13}}\approx.27735$}
\end{pspicture}
\end{center}
\caption{The graph of $f(x)=\sqrt{2x+1}$, along
with a few slopes. Notice the behavior of the slope,
$f'(x)=1/\sqrt{2x+1}$ as $x\to-1/2^+$ and $x\to\infty$.
}
\label{FunctionWithTangents2}\end{figure}

\newpage\bex Consider the function $f(x)=\frac1x$.  We will find
its slope everywhere that it is defined.
\begin{align*}
f'(x)&=\lim_{\Delta x\to0}\frac{f(x+\Delta x)-f(x)}{\Delta x}\\
&=\lim_{\Delta x\to0}\frac{\frac1{x+\Delta x}-\frac1x}{\Delta x}\\
&=\lim_{\Delta x\to0}\frac{\frac1{x+\Delta x}-\frac1x}{\Delta x}
   \cdot\frac{x(x+\Delta x)}{x(x+\Delta x)}\\
&=\lim_{\Delta x\to0}\frac{x-(x+\Delta x)}{(\Delta x)(x)(x+\Delta x)}\\
&=\lim_{\Delta x\to0}\frac{-\Delta x}{(\Delta x)(x)(x+\Delta x)}
=\lim_{\Delta x\to0}\frac{-1}{x(x+\Delta x)}=\frac{-1}{x^2}.
\end{align*}
Summarizing,
$$f(x)=\frac1x\implies f'(x)=-\,\frac1{x^2}.$$

We see some interesting features of this derivative as well.
For instance, it is always negative, so the graph is always
sloping downwards.  Furthermore, it is the same at
$x=a$ as $x=-a$.  Finally, we note that
$f'(x)\to0$ as $x\to\pm\infty$, and $f'(x)\to-\infty$
as $x\to0$.  This is indeed reflected in the graph
in Figure~\ref{FunctionWithTangents3}.
\label{FunctionWithTangentsExample3}\eex

\begin{figure}
\begin{center}
\begin{pspicture}(-5,-3.75)(5,3.75)
\psset{xunit=1.5cm,yunit=1.5cm}

\psaxes{<->}(0,0)(-3.2,-2.5)(3.2,2.5)
\psplot[plotpoints=100]{-3.2}{-0.4}{1 x div}
\psplot[plotpoints=100]{.4}{3.2}{1 x div}
\pscircle[fillstyle=solid,fillcolor=black](-1,-1){.1}
\rput(-2,-1){$f'(-1)=-1$}
\pscircle[fillstyle=solid,fillcolor=black](1,1){.1}
\rput(1.8,1){$f'(1)=-1$}
\pscircle[fillstyle=solid,fillcolor=black](.5,2){.1}
\rput(1.4,2){$f'(1/2)=-4$}
\pscircle[fillstyle=solid,fillcolor=black](2,.5){.1}
\rput(3,.6){$f'(2)=-1/4$}
\pscircle[fillstyle=solid,fillcolor=black](-.5,-2){.1}
\rput(-1.5,-2){$f'(-1/2)=-4$}
\end{pspicture}
\end{center}

\caption{Here $f(x)=1/x$ and $f'(x)=-1/x^2$.  Notice
that $f'<0$ for all $x\ne0$.  Also notice the behavior
of $f'(x)$ as $x\to\infty$, $x\to-\infty$, and $x\to0$.}
\label{FunctionWithTangents3}
\end{figure}

\newpage

\begin{center}\underline{\Large{\bf Exercises}}\end{center}
\bigskip
\begin{multicols}{2}
\begin{enumerate}
\item  Use the definition of the derivative,
$$f'(x)=\lim_{\Delta x\to0}\frac{f(x+\Delta x)-f(x)}{\Delta x},$$
to find $f'(x)$ for each of the following functions.
\begin{enumerate}[a.]
\item $\ds{f(x)=5-2x}$.
\item $\ds{f(x)=10}$.
\item $\ds{f(x)=2x^2+3}$.
\item $\ds{f(x)=3x^2-5x+9}$.
\item $\ds{f(x)=\sqrt{x}}$.
\item $\ds{f(x)=\frac3{x+2}}$.
\item $\ds{f(x)=\sqrt{9-5x}}$.
\item $\ds{f(x)=\frac1{x^2}}$.
\item $\ds{f(x)=\frac2{\sqrt{x}}}$.
\item $\ds{f(x)=x^{3/2}}$.  (Hint: Rewrite as $\sqrt{x^3}$.)
\item $\ds{f(x)=2x^3}$.
\item $\ds{f(x)=\sqrt[3]{x+1}}$.  (Hint: We made use of the difference
of two squares (see  Section~\ref{ArithmeticWithRealNumbers})
in Example~\ref{SquareRootDerivativeExample}.  Here you will
need to use the difference of two cubes in a similar manner.)
\item $\ds{f(x)=x^4}$.
\item $\ds{f(x)=\frac{x}{x+1}}$. (Hint: easier if $f(x)$ is rewritten
 using long division.)
\item $\ds{f(x)=\frac{x+1}{x-1}}$.
\item $\ds{f(x)=x^{2/3}}$.
\end{enumerate}
\item Suppose $s(t)=-16t^2+15t+20$ describes the height of
a projectile in free fall.
\begin{enumerate}[a.]
\item Find the velocity function $v(t)$.
\item  What is the projectile's velocity when $t=0$? $t=10$?
\item Find $t$  so that the projectile is stationary (i.e., $v=0$).
\item How high is the projectile when it is stationary?
\end{enumerate}

\item Consider the general quadratic function $f(x)=ax^2+bx+c$.
\begin{enumerate}[a.]
  \item Find a formula for the derivative of a
quadratic function $f(x)=ax^2+bx+c$.
  \item  Assuming $a\ne0$, this represents a parabola.
Assuming also that the slope is zero at the vertex,
find a general formula for the $x$-coordinate of the
vertex.
\end{enumerate}
\item Find the tangent line to the graph at the given point
$x=a$ for the given function.
\begin{enumerate}[a.]
\item $f(x)=x^2-9$, \ $a=4$.
\item $f(x)=x^3$, \ $a=-1$.
\item $f(x)=\sqrt{x}$, \ $a=9$.
\item $f(x)=\frac1x$, \ $a=\frac1{10}$.
\end{enumerate}
\end{enumerate}\end{multicols}

\newpage\section{First Differentiation Rules
\label{FirstDiffRules}}
In this section we derive rules which let us quickly
compute the derivative function $f'(x)$ for
any polynomial function $f(x)$, and for $\sin x$ and $\cos x$.
Along the way we
will derive a few general (though not comprehensive)
rules for derivatives.  We will also introduce the
very powerful {\it Leibniz notation} for derivatives,
and show how knowing the derivative helps us to further
analyze a function.  One consequence is that we can
more accurately graph
a function's behavior by hand.
\subsection{Positive Integer Power Rule}

We will often be interested in finding derivatives of
functions $f(x)=x^n$. Fortunately there is a simple
rule which covers all such functions.  It is usually
called the {\it power rule}, as stated below. (Recall
$\mathbb{N}=\{1,2,3,4,5,6,\cdots\}$.)

\begin{theorem}
$\ds{
(f(x)=x^n)\wedge(n\in\mathbb{N})\qquad\implies\qquad f'(x)=n\cdot x^{n-1}
}$.
\end{theorem}
Note that implicit in this theorem is that the derivative
of $x^n$ exists for every $x\in\Re$---i.e., ``exists
everywhere''---since it is equal to $nx^{n-1}$, defined
everywhere.

\begin{proof} The proof we give here depends upon the
binomial expansion (\ref{Binomial1}), page~\pageref{Binomial1}.
It is important to remember
that $x$ is a fixed number in the limit, and $\Delta x$ is
the variable approaching zero as far as the limit is concerned.
With that in mind,
\begin{align*}
f'(x)&=\lim_{\Delta x\to0}\frac{f(x+\Delta x)-f(x)}{\Delta x}\\
&= \lim_{\Delta x\to0}\frac{(x+\Delta x)^n-x^n}{\Delta x}\\
&=\lim_{\Delta x\to0}\frac{\left(\not{\!x^n}+nx^{n-1}\Delta x
+\frac{n(n-1)x^{n-2}(\Delta x)^2}{1\cdot 2}
+\cdots+(\Delta x)^n\right)-\not{\!x^n}}{\Delta x}\\
&=\lim_{\Delta x\to0}\frac{nx^{n-1}\Delta x+\frac{(n)(n-1)}{1\cdot 2}
x^{n-2}(\Delta x)^2
+\cdots+(\Delta x)^n}{\Delta x}\\
&=\lim_{\Delta x\to0}
\left(
\vphantom{\frac12}
nx^{n-1}+\frac{(n)(n-1)}{1\cdot 2}x^{n-2}(\Delta x)^1+\cdots+(\Delta x)^{n-1}\right)\\
&=nx^{n-1}+0+\cdots+0\\
&=nx^{n-1}, \qquad\text{q.e.d.}\end{align*}
\end{proof}
The only term which survives in the limit
in the fifth line is the $nx^{n-1}$ term
because the others have positive integer powers of $\Delta x$,
which is approaching zero.
We will see later that this power rule is actually much more
general.  In fact, it can be used for $n\in\Re$ but we need
some more advanced methods to prove such generality.
For now we will apply it only to $n\in\mathbb{N}$.

\bex Here we list the derivatives of some of the positive
integer powers of $x$.  The first case listed below ($n=1$) does
follow from the proof, though we would be reading
the statement of the theorem for that case
$f(x)=x^1\implies f'(x)=1x^0=1$.  Again we do not
really wish to say $x^0=1$ regardless of $x$,
for several technical reasons (though it is fine
as long as $x>0$), but we see how the formula
naively gives us what we want for $n=1$.  The
rest of the table is more straightforward:
$$\begin{array}{ccc}
f(x)&\qquad&f'(x)\vphantom{\ds{\frac11}}\\
\hline\\
x&&1\\ \vphantom{\ds{\frac12}}
x^2&&2x\\ \vphantom{\ds{\frac12}}
x^3&&3x^2\\ \vphantom{\ds{\frac12}}
x^4&&4x^3\\ \vphantom{\ds{\frac12}}
\vdots&&\vdots\\ \vphantom{\ds{\frac12}}
x^{100}&&100x^{99}\\ \vphantom{\ds{\frac12}}
\vdots&&\vdots
\end{array}$$
\eex

\subsection{Leibniz Notation}
We will find that other derivative rules will be
unwieldy to write with our present notation.
Thus we will introduce the very powerful Leibniz notation
and use it except in a few settings where
our present (prime) notation is simpler.
\begin{definition}
$\ds{\frac{d}{dx}f(x)=f'(x).}$
\end{definition}
This is also written $\frac{df(x)}{dx}$.  The
$\frac{d}{dx}$ is a {\it differential operator} which
takes a function of $x$ and returns the derivative
{\it with respect to $x$}.  When we are interested
in position and velocity, we can write
\begin{equation}
v=\frac{ds}{dt}.\end{equation}
Notice that the notation resembles difference quotients,
because, with our definition of derivatives, we have
\begin{align*}
\frac{df(x)}{dx}&=\lim_{\Delta x\to 0}\frac{\Delta f(x)}{\Delta x},\\
\frac{ds}{dt}&=\lim_{\Delta t\to0}\frac{\Delta s}{\Delta t}.
\end{align*}
Similarly for any such related quantities.
With Leibniz notation  our power rule becomes:
\begin{equation}
\frac{d}{dx}\left(x^n\right)=nx^{n-1}.\label{PowerRule}\end{equation}
If we would like to compute $f'(a)$, i.e., the derivative at
a particular point, in the Leibniz notation we would write
$$f'(a)=\left.\frac{d}{dx}f(x)\right|_{x=a}.$$
So, for example, $\ds{\frac{d\,x^5}{dx}=5x^4}$, and the
slope at $x=1$ of the function $f(x)=x^5$ is given by\footnotemark
$$f'(1)=5\cdot1^4=5,\qquad\text{or}\qquad
\left.\frac{d x^5}{dx}\right|_{x=1}=\left.\vphantom{X_X^X}
               5x^4\right|_{x=1}=5\cdot1^4=5.$$
The vertical line with the subscript $x=a$
is often read, ``evaluated at $x=a$.''

Note how the Leibniz notation is often assumed to act like a
fraction:  ${\frac{d}{dx}\left(x^5\right)=\frac{d x^5}{dx}}$.
However the $d$ in the numerator, and (separately) the $dx$ in the
denominator are treated as inviolable; we do not ever
break those terms up further.
\footnotetext{%%%
%%% FOOTNOTE
Often the ``$x=$'' is omitted when the variable is obvious, as
in $\ds{\left.\frac{d x^5}{dx}\right|_1=\left.\vphantom{X_X^X}
    5x^4\right|_1=5\cdot1^4=5}$.
%%% END FOOTNOTE
}

Note the flexibility of the Leibniz notation in the following:
$$
\frac{d x^3}{dx}=3x^2,\qquad
\frac{d u^3}{du}=3u^2,\qquad
\frac{d t^3}{dt}=3t^2.$$
These are actually the same rule (with different  variables):
that the cube of a quantity changes with respect to that quantity
at the (instantaneous) rate of 3 times the square of the quantity,
be it $x$, $u$ or $t$.  Put another way, if the horizontal axis
is given by $t$, and we graph the height $t^3$ on the vertical
axis, then the slope is always $3t^2$.

The Leibniz notation also keeps
us from making the mistake of trying to use the derivative rules
(such as the power rule) to compute, for example, $\frac{du^3}{dx}$.
Since the variables ($u$ and $x$) do not match,  the power rule cannot
be used.\footnote{%%%
%%% FOOTNOTE
Later in the text we will have the chain rule, which helps us get
around the problem of computing $\frac{du^3}{dx}$, for instance.
There we will see some of the true power of the Leibniz notation,
as we compute for instance
$$\frac{du^3}{dx}=\frac{du^3}{du}\cdot\frac{du}{dx}=3u^2\cdot\frac{du}{dx}.$$
Notice how we apparently multiplied and divided by $du$ to achieve
the second expression.
%%% END FOOTNOTE
\label{FootnoteFirstSeeChainRule}}

With the power rule (\ref{PowerRule}) and a few other
results we can quickly calculate the derivatives of polynomials.
Much of this chapter will be devoted to calculating
derivatives using known rules, which save an enormous amount
of time when compared to calculating derivatives using limits of difference
quotients as in  the previous section.

\subsection{Sum and Constant Derivative Rules}
\begin{theorem}{\rm\bf(Sum Rule)}
Suppose $\ds{\frac{d}{dx}f(x)}$ and $\ds{\frac{d}{dx}g(x)}$
exist.  Then
\begin{equation}\frac{d}{dx}\left(f(x)+g(x)\right)=
        \frac{d}{dx}f(x)+\frac{d}{dx}g(x).\end{equation}
\end{theorem}
In other words the derivative of a sum is the sum of
the respective derivatives.  Some texts write this using
the prime notation:
$$(f+g)'=f'+g'.$$

\begin{proof} Assume that $\frac{d}{dx}f(x)$ and
$\frac{d}{dx}g(x)$ exist at a particular $x$.
Then
\begin{align*}
\frac{d}{dx}\left(f(x)+g(x)\right)
&=\lim_{\Delta x\to0}\frac{(f(x+\Delta x)+g(x+\Delta x))-(f(x)+g(x))}
      {\Delta x}\\
&=\lim_{\Delta x\to0}\frac{f(x+\Delta x)-f(x)+g(x+\Delta x)-g(x)}
      {\Delta x}\\
&=\lim_{\Delta x\to0}\left(\frac{f(x+\Delta x)-f(x)}{\Delta x}
      +\frac{g(x+\Delta x)-g(x)}{\Delta x}\right)\\
&=\lim_{\Delta x\to0}\frac{f(x+\Delta x)-f(x)}{\Delta x}
      +\lim_{\Delta x\to0}\frac{g(x+\Delta x)-g(x)}{\Delta x}\\
&=\frac{d\,f(x)}{dx}+\frac{d\,g(x)}{dx},\qquad\text{q.e.d.}    \end{align*}
The reason that we could break this into two limits
legitimately is because the two limits both existed
and were finite by assumption. (See Theorem~\ref{UsualLimitTheorems},
page~\pageref{UsualLimitTheorems}.)
\end{proof}
\bex $\ds{\frac{d}{dx}\left(x^3+x^2+x\right)=
\frac{dx^3}{dx}+\frac{dx^2}{dx}+\frac{dx}{dx}=3x^2+2x+1}$.
\eex
With practice, one learns to skip the first step in the example above.
Note how $\frac{dx}{dx}=1$, as one might hope.  This reflects the
fact that $x$ and $x$ change at the same rate (i.e., the ratio of
their rates of change is always 1).  Put another way, the slope
of the line $y=x$ is always 1.

The next theorem is usually given separately for emphasis.

\begin{theorem}
The derivative of a constant is zero; if a function
is defined by $f(x)=C$ for all $x\in\Re$, where $C$
is some fixed constant, then $f'(x)=0$ for all $x\in\Re$.
Written two different ways, we thus have:
\begin{align}
f(x)=C&\implies f'(x)=0;\\
\frac{d}{dx}C&=0.\label{DerivativeOfAConstant}\end{align}\end{theorem}
There are a couple ways to see this. From the difference quotient
limit definition (\ref{DifferenceQuotientDerivativeDefinition})
(page \pageref{DifferenceQuotientDerivativeDefinition}), regardless
of $\Delta x\ne0$ the
difference quotient $[f(x+\Delta x)-f(x)]/\Delta x=[C-C]/\Delta x
=0/\Delta x=0$,
so it remains zero in the limit.
From another perspective regarding
what we know about lines
we have that $f(x)=C$ is a line of slope $m=0$.
From a qualitative standpoint this theorem is reasonable
since constants have rate of change
zero (hence the term {\it constant})
with respect to $x$. Some texts write\footnotemark \ $(C)'=0$.
%
\footnotetext{One weakness of Taylor's ``prime'' notation is that
we do not know what variable we are taking the derivative
with respect to.  For instance, in an earlier example
we have fuel volume $V$ as a function of position $s$,
and so ${dV}/{ds}$ measured the flow rate of fuel
per mile.  However, since $s=s(t)$, we have $V=V(s(t))$, so
ultimately $V=V(t)$, i.e., $V$ can be written as a
(algebraically different) function of $t$ instead, in which
case we can calculate $\ds{dV}/{dt}$, measuring the
flow rate with respect to time.  So when asked to calculate
$V'$, or even $V'(5)$,
 there is this ambiguity which is not present in the Leibniz
notation.

If one wrote $V'(s)$, it would probably be understood to be $dV/ds$
and not $dV/dt$.  Similarly, $V'(5\text{ seconds})$ would be understood
to mean $dV/dt$ evaluated at $t=5\text{ seconds}$.}
%
With this theorem we can write,
for example,
$$\frac{d}{dx}\left(x^3+28\right)=\frac{d}{dx}\left(x^3\right)+\frac{d}{dx}
\left(\vphantom{x^3}28\right)=3x^2+0=3x^2.$$
With very little practice one learns to write
quickly ${\frac{d}{dx}\left(x^3+28\right)=3x^2}$.

We need just one more result before we can find derivatives
of arbitrary polynomials.  This answers the
question of what to do with the coefficients of a polynomial,
and multiplicative constants in general.
%
\begin{theorem} Multiplicative constants are preserved
in the derivative.  In other words,
\begin{equation}
\frac{d}{dx}\left(C\cdot f(x)\right)=C\cdot\frac{d}{dx}f(x).
\label{DerivativeAndMultiplicativeConstants}\end{equation}
\label{TheoremOnDerivativeAndMultiplicativeConstants}\end{theorem}
The proof is left as an exercise.  It follows from the fact
that multiplicative constants ``go along for the ride''
in limits as well.
(See again Theorem~\ref{UsualLimitTheorems}.)
For a simple example, we have
$$\frac{d}{dx}\left(5x^7\right)=5\cdot\frac{d}{dx}\left(x^7\right)
=5\cdot7x^6=35x^6.$$
Again, with very little practice one learns to compute
such a derivative in one step.
Note how the derivative operator
$\frac{d}{dx}$ treats additive constants (which do not survive)
differently from multiplicative constants (which do survive).
We can combine the power rule (\ref{PowerRule}),
(\ref{DerivativeOfAConstant}), and (\ref{DerivativeAndMultiplicativeConstants})
to quickly compute the derivative of any given polynomial
(where $n\in\mathbb{N}$):
%
%\begin{equation}
%\begin{aligned}{ }&\frac{d}{dx}\left(
%a_nx^n+a_{n-1}x^{n-1}+\cdots+a_2x^2+a_1x+a_0\right)\\
%&=a_n\cdot nx^{n-1}+a_{n-1}\cdot (n-1)x^{n-2}+\cdots+a_2\cdot2x+a_1.
%\end{aligned}
%\label{DerivativeOfAPolynomial}
%\end{equation}
\begin{equation}\begin{aligned}
\frac{d}{dx}\left(\vphantom{1_2x^2}\right.&\left.
a_nx^n+a_{n-1}x^{n-1}+\cdots+a_2x^2+a_1x+a_0\right)\\
&=a_n\cdot nx^{n-1}+a_{n-1}\cdot (n-1)x^{n-2}+\cdots+a_2\cdot2x+a_1.
\label{DerivativeOfAPolynomial}\end{aligned}\end{equation}

%$$\begin{array}{ccccccccccc}
%\ds{\frac{d}{dx}\left(\vphantom{a_nx^n}\right.}
%a_nx^n&+&a_{n-1}x^{n-1}&+&\cdots&+&a_2x^2&+&a_1x&+&a_0
%\ds{\left.\vphantom{a_nx^n}\right)}\\ \\
%=a_n\cdot nx^{n-1}&+&a_{n-1}(n-1)a^{n-2}&+&\cdots&+
%&a_2\cdot2x&+&a_1.\end{array}$$

To be clear on the logic, note that we first use the sum rule to
break this into a sum of derivatives of the $a_kx^k$, $k=1,\cdots,n$
and $a_0$,
calculating the derivatives of the $a_kx^k$ terms in
turn, each time  using the fact that the
multiplicative constants $a_k$ are along
for the ride, and the power rule giving $a_k\cdot kx^{k-1}$.
The final term $a_0$ is an additive constant
with  derivative zero and thus does
not appear on the right hand side of (\ref{DerivativeOfAPolynomial}).
%
\bex To see how (\ref{DerivativeOfAPolynomial}) can be
carried out quickly, we list a couple of examples:
\begin{align*}
\frac{d}{dx}\left(5x^4+9x^2+13x+47\right)&=5\cdot4x^3+9\cdot2x^1+13\cdot1+0\\
             &=20x^3+18x+13.\\
\frac{d}{dx}\left(9-6x+5x^{11}\right)&=0+(-6)\cdot1+5\cdot11x^{10}    \\
             &=-6+55x^{10}.\end{align*}
\label{PolynomialDerivativeExample}\eex
%
Note that the negative sign also  ``goes along for the ride,'' since
it is just a factor of $-1$.  In fact we could list
a {\it derivative of a difference} rule,
$$\frac{d}{dx}\left(f(x)-g(x)\right)=\frac{d}{dx}f(x)-\frac{d}{dx}g(x),$$
but that would be redundant given the sum rule, and
how a multiplicative constant $-1$ (or $-2$, or $-6$, etc.) is preserved
in the derivative.

We need to also point out that to use (\ref{DerivativeOfAPolynomial}),
we need to have the function written in the form of the left hand side of that
equation.
\bex $\ds{\frac{d}{dx}\left[(x^2+1)^2\right]
=\frac{d}{dx}\left[x^4+2x^2+1\right]=4x^3+4x.}$\eex
In the above we needed to multiply out the polynomial.
Thus $\frac{d}{dx}[(x^2+1)^2]\ne2(x^2+1)$,
since we are taking the derivative with respect
to $x$ and not $(x^2+1)$.

We point out again that it should be clear from the previous examples that
(\ref{DerivativeOfAPolynomial}) is much simpler than using the
original definition of the derivative (as a limit of difference
quotients (\ref{DifferenceQuotientDerivativeDefinition}),
page~\pageref{DifferenceQuotientDerivativeDefinition})
to calculate derivatives of polynomials.

\subsection{Applications to Graphing Polynomials}
Recall that while $f(x)$ gives the height of the graph $y=f(x)$
at a particular value of $x$, the derivative $f'(x)$
gives the slope.  If the slope is positive the graph
is ``sloping upwards;'' if negative the graph is ``sloping
downwards.''  Another way to speak of such things is
to discuss functions which are {\it increasing} or {\it decreasing}
on an interval, say $(a,b)$.

\begin{definition}
Consider a function $f(x)$ with an interval $(a,b)$ contained in the domain.
\begin{enumerate}
\item We say $f(x)$ is {\bf increasing} on $(a,b)$ if and only if
      $(\forall x,y\in(a,b))(x<y\longleftrightarrow f(x)<f(y))$.
\item We say $f(x)$ is {\bf decreasing} on $(a,b)$ if and only if
      $(\forall x,y\in(a,b))(x<y\longleftrightarrow f(x)>f(y))$.
\end{enumerate}
(Note that it is possible that a function is not consistently increasing or
consistently decreasing on a given interval.)\end{definition}
Clearly, for an increasing function on $(a,b)$, the height increases
as $x$ increases through the interval.  Similarly, for
a decreasing function on $(a,b)$, the height decreases
as $x$ increases through the interval.  If we know exactly
where a function is increasing, and where it is decreasing,
that information can be of great help in plotting or
analyzing the function.  To see what this has to
do with derivatives we state the following theorem.  Its
proof relies on the Mean Value Theorem which will be introduced
in a later section.  However, it should already have the ring of
truth given what we know of derivatives and slopes.

\begin{theorem}Suppose $f(x)$ is defined for $x\in(a,b)$, and $f'(x)$
              exists for $x\in(a,b)$.  Then
  \begin{enumerate}
   \item $ (\forall x\in(a,b))(f'(x)>0)
                     \implies f(x)\text{ is increasing on }(a,b)$;
   \item $ (\forall x\in(a,b))(f'(x)<0)
                     \implies f(x)\text{ is decreasing on }(a,b)$.
  \end{enumerate}
(Again, if $f'(x)$ changes sign on $(a,b)$, then neither of these hold.)
\end{theorem}

\bex\label{XXX-3XExample}
To see how we might use this to graph polynomials, consider
the graph of the function $f(x)=x^3-3x$.
This function is continuous on all of $\Re=(-\infty,\infty)$.
Also notice that
\begin{align*}
\lim_{x\to\infty}f(x)&=\lim_{x\to\infty}\left[x^3\left(1-\frac3{x^2}\right)
               \right]\overset{\infty\cdot1}{\longeq}\infty,\\
\lim_{x\to-\infty}f(x)&=\lim_{x\to-\infty}\left[x^3\left(1-\frac3{x^2}\right)
               \right]\overset{-\infty\cdot1}{\longeq}-\infty.\end{align*}
If we draw a sign chart for $f(x)$, showing where the function
is positive and where it is negative, we can get some
idea of what the graph looks like.  To construct a sign chart
for any function we look at all the
possible points where the function can change signs. Recall that
the Intermediate Value Theorem (Corollary~\ref{IntermediateValueTheorem},
page~\pageref{IntermediateValueTheorem})
implies a function $f(x)$ can only change signs, as we increase $x$,
by either passing through zero height or having a discontinuity.
Since our particular $f(x)$ here is continuous on all $\Re$,
we look to where $f(x)=0$ to divide $\Re$ into intervals of constant sign.
Now $f(x)=x^3-3x=x(x^2-3)$ is zero for $x=0,\pm\sqrt3$.  This
gives us four intervals on which $f(x)$ does not change signs.
We can test for the sign of $f(x)$ at a single point in each interval
to get the sign of $f(x)$ on that interval.  As we did
in Section~\ref{ContinuityOnIntervalsSection}, we construct
the sign chart for $f(x)$:

\begin{center}
\begin{pspicture}(-0.2,-1)(12,2)
\psline{<->}(2,0)(12,0)
   \psline(4.5,-.2)(4.5,.2)
      \rput(4.5,-.5){$-\sqrt3$}
   \psline(7,-.2)(7,.2)
      \rput(7,-.5){$0$}
   \psline(9.5,-.2)(9.5,.2)
      \rput(9.5,-.5){$\sqrt3$}
\rput[l](-0.2,1.5){Function:}
\rput(7,1.5){$f(x)=x(x^2-3)$}

\rput[l](-0.2,.5){Sign Factors:}
\rput[l](-0.2,1.){Test $x=$}
  \rput(3.25,1){$-10$}
\rput(3.25,.5){\bominus\boplus}
  \rput(5.75,1){$-1$}
\rput(5.75,.5){\bominus\bominus}
  \rput(8.25,1){$1$}
\rput(8.25,.5){\boplus\bominus}
  \rput(10.75,1){$10$}
\rput(10.75,.5){\boplus\boplus}

\rput[l](-0.2,-.5){Sign $f(x)$:}
\rput(3.25,-.5){\bominus}
\rput(5.75,-.5){\boplus}
\rput(8.25,-.5){\bominus}
\rput(10.75,-.5){\boplus}
\end{pspicture}
\end{center}
From the sign chart and the behavior as $x\to\pm\infty$ we
can get some idea of what the graph of $f(x)$ looks like.
That information is reflected, however imprecisely,
in Figure~\ref{RoughGraphOfXXX-3X}.
\begin{figure}\begin{center}
\begin{pspicture}(-6,-3)(6,3)
\psset{xunit=2cm}
\psaxes{<->}(0,0)(-3,-3)(3,3)
\rput(-1.732,.5){$-\sqrt3$}
\psline(-1.732,-.15)(-1.732,.15)
\rput(1.732,.5){$\sqrt3$}
\psline(1.732,-.15)(1.732,.15)
\pscurve(-2.5,-3)(-1.732,0)(-.7,1.3)(0,0)(0,0)(.7,-1.3)(1.732,0)(2.5,3)
\pscircle*(-.75,1.3){.07}
\pscircle*(.75,-1.3){.07}
\rput(-.75,1.6){local maximum?}
\rput(.75,-1.6){local minimum?}
\end{pspicture}\end{center}
\caption{Rough graph of $f(x)=x^3-3x$ based upon its sign
chart and behavior as $x\to\pm\infty$.
In particular we do not know the exact
locations of the local maximum(s) or minimum(s) without
investigating the derivative of $f(x)$.}
\label{RoughGraphOfXXX-3X}\end{figure}
A serious drawback to such a graph is that we know
from the Extreme Value Theorem (Corollary~\ref{ExtremeValueTheorem},
page~\pageref{ExtremeValueTheorem})
that there will be a value in $[-\sqrt3,0]$ which is
a {\bf local maximum}, and another in $[0,\sqrt3]$ which is
a {\bf local minimum}, but we do not know exactly where these
are from the sign chart of the function  (we will formally define the
boldface terms shortly). However, a sign chart for the {\bf derivative}
of $f(x)$ can possibly give us this information.

Since $f(x)=x^3-3x$, it follows quickly that $f'(x)=3x^2-3$.
Recall that intervals where $f'>0$, the function $f$ is increasing,
while those intervals on which $f'<0$ the function is decreasing.
Since $f'(x)$ is also an easily factored
polynomial, constructing its sign chart is
easy.  Note $f'(x)=3x^2-3=3(x^2-1)=3(x+1)(x-1)$ is zero
exactly where $x=\pm1$.

\begin{center}
\begin{pspicture}(-0.2,-2)(12,2)
\psline{<->}(2,0)(11,0)
   \psline(5,-.2)(5,.2)
      \rput(5,-.5){$-1$}
   \psline(8,-.2)(8,.2)
      \rput(8,-.5){$1$}
  % \rput[l](-0.2,1.5){Function:}
\rput(7,1.5){$f'(x)=3(x+1)(x-1)$}
\rput[l](-0.2,1){Test $\hphantom{f'(}x\hphantom{)}=$}
\rput[l](-.2,.5){Sign $f'(x)=$}
\rput[l](-0.2,-.5){Sign $f'(x)$:}
\rput(3.5,1){$-2$}
  \rput(3.5,.5){\boplus\bominus\bominus}
  \rput(3.5,-.5){\boplus}
\rput(6.5,1){$0$}
  \rput(6.5,.5){\boplus\boplus\bominus}
  \rput(6.5,-.5){\bominus}
\rput(9.5,1){$10$}
  \rput(9.5,.5){\boplus\boplus\boplus}
  \rput(9.5,-.5){\boplus}
\rput[l](-.2,-1.25){Behavior of $f(x)$:}
  \rput(3.5,-1){INC}
   \rput(3.5,-1.5){$\nearrow$}
   \rput(6.5,-1.5){$\searrow$}
   \rput(9.5,-1.5){$\nearrow$}
\rput(6.5,-1){DEC}
  \rput(9.5,-1){INC}
\end{pspicture}
\end{center}

Here we used ``INC'' to abbreviate increasing, which we also
signified by the arrow pointing upwards ($\nearrow$), and
we used ``DEC'' and ($\searrow$) to signify decreasing.
>From this we see we get a local maximum at
$(-1,f(-1))=(-1,2)$, and a local minimum at
$(1,f(1))=(1,-2)$.  These two bits of information allow us
to draw a more accurate sketch of the graph of
$f(x)=x^3-3x$, as illustrated in Figure~\ref{GraphOfXXX-3X}.
That graph is computer-generated, but we can get a
very accurate picture of the function's general behavior
by plotting the information we have gathered: the
sign of $f$, including the {\bf $x$-intercepts} (where $f(x)=0$),
the limiting behavior of $f(x)$ as $x\to\pm\infty$,
and where $f(x)$ is increasing/decreasing, including
any local maximum and minimum points.\footnote{%
%%%%%%%% FOOTNOTE
It is
also worth noticing that $f'(x)=3(x+1)(x-1)\longrightarrow\infty$
for both $x\to\infty$ and $x\to-\infty$, and so the
slope of $f(x)$ grows larger as $x\to\pm\infty$.
This is not the case with all graphs (see Figure~\ref{FunctionWithTangents2},
page~\pageref{FunctionWithTangents2}
for example), but it is a nice feature to notice when plotting
a graph such as Figure~\ref{GraphOfXXX-3X} above.}
%%%%% END FOOTNOTE
\begin{figure}
\begin{center}
\begin{pspicture}(-6,-3)(6,3)
\psset{xunit=2cm}
\psaxes{<->}(0,0)(-2.5,-3)(2.5,3)
\rput(-1.7,.35){$-\sqrt3$}
\psline(-1.732,-.15)(-1.732,.15)
\rput(1.732,.3){$\sqrt3$}
\psline(1.732,-.15)(1.732,.15)
\psplot{-2.1}{2.1}{x 3 exp x 3 mul sub}
\pscircle[fillstyle=solid,fillcolor=black](-1,2){.08}
\pscircle[fillstyle=solid,fillcolor=black](1,-2){.08}
\pscircle[fillstyle=solid,fillcolor=black](-1.732,0){.08}
\pscircle[fillstyle=solid,fillcolor=black](1.732,0){.08}
\rput(-1,2.3){local maximum}
\rput(1,-2.3){local minimum}

\end{pspicture}
\end{center}\caption{Partial graph of $f(x)=x^3-3x$ showing
the sign of $f(x)$, the limiting behavior as $x\to\pm\infty$,
and the sign of $f'(x)$ (which indicates also the
locations of local extrema). The $x$-intercepts (where $f(x)=0$),
the local maximum and local minimum points are also illustrated.}
\label{GraphOfXXX-3X}
\end{figure}
\eex
It is important to distinguish the meanings of a sign
chart for $f(x)$, and one for $f'(x)$.  The former
just tells us where the function is below or above
the $x$-axis; the latter tells us where the function
is increasing and where the function is decreasing.

In the above we used the following terms, which we now
define:
\begin{definition}Given a function $f(x)$.
\begin{enumerate}
\item We call a point $x_0$ a {\bf local maximum} of $f(x)$
      if and only if
\begin{equation}(\exists(a,b)\ni x_0)(\forall x\in (a,b))(f(x)\le f(x_0)).
\end{equation}
\item We call a point $x_0$ a {\bf local minimum} of $f(x)$
\begin{equation}(\exists(a,b)\ni x_0)(\forall x\in (a,b))(f(x)\ge f(x_0)).
\end{equation}
\end{enumerate}
\end{definition}
In other words, $x_0$ is a local maximum of $f(x)$ if there
is an open interval containing $x_0$ in which the function
is never greater than $x_0$ on that interval.  Local
minimum is defined analogously.  If $f(x)$
is continuous in an open interval around $x_0$, and
$f'$ exists in that interval, then a change of signs
of $f'$ at $x_0$ indicates one of these {\it local extrema}.
If, for instance, $f'>0$ to the left of $x_0$ and $f'<0$
to the right, then $f$ increases before and decreases after $x_0$,
making $x_0$ a local maximum.  This can be seen in the
derivative sign chart and graph above for our example function
$f(x)=x^3-3x^2$.
\subsection{Derivatives of Sine and Cosine}
In this section we show how $\sin x$ and $\cos x$ are
both differentiable, compute their derivatives, and apply
them to functions involving the chain rule.
We will prove the following theorem.

\begin{figure}\begin{center}

\hfill\begin{pspicture}(-1,-1)(5.6,1.3)
\psset{xunit=.8cm,yunit=.8cm}
\psaxes[labels=none,ticks=none]{<->}(0,0)(-.5,-1.25)(7,1.25)
  \psline(-.2,1)(.2,1)
  \psline(-.2,-1)(.2,-1)
  \rput[r](-.4,1){1}
  \rput[r](-.4,-1){$-1$}
  \psline(1.570796,-.2)(1.570796,.2)
  \rput(1.570796,-.5){$\frac{\pi}2$}
  \psline(3.141596,-.2)(3.141596,.2)
  \rput(3.1415926,-.5){$\pi$}
  \psline(4.7123890,-.2)(4.7123890,.2)
  \rput(4.7123890,-.5){$\frac{3\pi}2$}
  \psline(6.28318531,-.2)(6.28318531,.2)
  \rput(6.28318531,-.5){$2\pi$}
     \psplot[plotpoints=1000]{-.5}{7}{x 3.1415926535 div 180 mul sin}
            \rput(3.25,1.6){$y=\sin x$}
  \rput{270}(3.14,-1.8){$\implies$}
\end{pspicture}\hfill
\begin{pspicture}(-1,-1)(5.6,1.3)
\psset{xunit=.8cm,yunit=.8cm}
\psaxes[labels=none,ticks=none]{<->}(0,0)(-.5,-1.25)(7,1.25)
  \psline(-.2,1)(.2,1)
  \psline(-.2,-1)(.2,-1)
  \rput[r](-.4,1){1}
  \rput[r](-.4,-1){$-1$}
  \psline(1.570796,-.2)(1.570796,.2)
  \rput(1.570796,-.5){$\frac{\pi}2$}
  \psline(3.141596,-.2)(3.141596,.2)
  \rput(3.1415926,-.5){$\pi$}
  \psline(4.7123890,-.2)(4.7123890,.2)
  \rput(4.7123890,-.5){$\frac{3\pi}2$}
  \psline(6.28318531,-.2)(6.28318531,.2)
  \rput(6.28318531,-.5){$2\pi$}
     \psplot[plotpoints=1000]{-.5}{7}{x 3.1415926535 div 180 mul cos}
          \rput(3.25,1.6){$y=\cos x$}
  \rput{270}(3.14,-1.8){$\implies$}
\end{pspicture}\hfill
\vskip.4truein

\hfill\begin{pspicture}(-1,-1)(5.6,1.3)
\psset{xunit=.8cm,yunit=.8cm}
\psaxes[labels=none,ticks=none]{<->}(0,0)(-.5,-1.25)(7,1.25)
  \psline(-.2,1)(.2,1)
  \psline(-.2,-1)(.2,-1)
  \rput[r](-.4,1){1}
  \rput[r](-.4,-1){$-1$}
  \psline(1.570796,-.2)(1.570796,.2)
  \rput(1.570796,-.5){$\frac{\pi}2$}
  \psline(3.141596,-.2)(3.141596,.2)
  \rput(3.1415926,-.5){$\pi$}
  \psline(4.7123890,-.2)(4.7123890,.2)
  \rput(4.7123890,-.5){$\frac{3\pi}2$}
  \psline(6.28318531,-.2)(6.28318531,.2)
  \rput(6.28318531,-.5){$2\pi$}
     \psplot[plotpoints=1000]{-.5}{7}{x 3.1415926535 div 180 mul cos}
           \rput(3.25,1.6){$\frac{dy}{dx}=\cos x$}
\end{pspicture}\hfill
\begin{pspicture}(-1,-1)(5.6,1.3)
\psset{xunit=.8cm,yunit=.8cm}
\psaxes[labels=none,ticks=none]{<->}(0,0)(-.5,-1.25)(7,1.25)
  \psline(-.2,1)(.2,1)
  \psline(-.2,-1)(.2,-1)
  \rput[r](-.4,1){1}
  \rput[r](-.4,-1){$-1$}
  \psline(1.570796,-.2)(1.570796,.2)
  \rput(1.570796,-.5){$\frac{\pi}2$}
  \psline(3.141596,-.2)(3.141596,.2)
  \rput(3.1415926,-.5){$\pi$}
  \psline(4.7123890,-.2)(4.7123890,.2)
  \rput(4.7123890,-.5){$\frac{3\pi}2$}
  \psline(6.28318531,-.2)(6.28318531,.2)
  \rput(6.28318531,-.5){$2\pi$}
     \psplot[plotpoints=1000]{-.5}{7}{0 x 3.1415926535 div 180 mul sin sub}
            \rput(3.25,1.6){$\frac{dy}{dx}=-\sin x$}
\end{pspicture}\hfill

\bigskip

\end{center}
\caption{Partial graphs of $y=\sin x$, $y=\cos x$, and
their respective derivative functions graphed below them.}
\label{SineAndCosineAndDerivativesFigure}\end{figure}

\begin{theorem} The functions $\sin x$ and $\cos x$ are
differentiable for all $x\in\Re$, and---when $x$
is measured in {\bf radians}---their derivatives
are given by:
\begin{align}
\frac{d\,\sin x}{dx}&=\cos x,\label{SineDerivative}\\
\frac{d\,\cos x}{dx}&=-\sin x.\label{CosineDerivative}
\end{align}\end{theorem}

These should seem reasonable given the respective graphs of
Figure~\ref{SineAndCosineAndDerivativesFigure}.
For instance, for the sine curve we have the following data:
$$
\begin{array}{rcrrrrr}
x&=&0,&\ \frac{\pi}2,&\ \pi&\ \frac{3\pi}2,&\ 2\pi\\
\sin x&=&0,&1,&0,&-1,&0\\
\cos x&=&1,&0,&-1,&0,&1\end{array}$$
Looking at the graph of $\sin x$ as drawn in
Figure~\ref{SineAndCosineAndDerivativesFigure},
the slopes at these points and the values for $\cos x$
seem at least compatible.  Similarly for the cosine
curve:
$$
\begin{array}{rcrrrrr}
x&=&0,&\ \frac{\pi}2,&\ \pi&\ \frac{3\pi}2,&\ 2\pi\\
\cos x&=&1,&0,&-1,&0,&1\\
-\sin x&=&0,&-1,&0,&1,&0\\\end{array}$$
We will prove the derivative formula for $\sin x$, and leave
the derivative of $\cos x$ as an exercise.  (The two
computations are very similar.)

%\begin{proof}{\bf(\ref{CosineDerivative}):}
%Define $f(x)=\cos x$.  We want to show $f'(x)=-\sin x$.
%The proof uses a trigonometric identity on the third
%line, and two previously proved
%theorems on the last line:
%$$
%\cos(\alpha+\beta)=\cos\alpha\cos\beta-\sin\alpha\sin\beta,$$
%$$\lim_{\theta\to0}\frac{1-\cos\theta}\theta=0,
%\qquad\qquad
%\lim_{\theta\to0}\frac{\sin\theta}{\theta}=1.$$
%These are, respectively, (\ref{Cos(Alpha+Beta)}),
%(\ref{(1-CosX)/(X)Limit}) and (\ref{SinX/XLimitTheoremEquation}).
%Now we compute $f'(x)$:
%\begin{align*}
%f'(x)&=\lim_{\Delta x\to0}\frac{f(x+\Delta x)-f(x)}{\Delta x}\\
%&= \lim_{\Delta x\to0}\frac{\cos(x+\Delta x)-\cos (x)}{\Delta x}\\
%&=\lim_{\Delta x\to0}
%\frac{\cos x\cos\Delta x-\sin x\sin\Delta x-\cos x}{\Delta x}\\
%&=\lim_{\Delta x\to0}\left[
%\frac{\cos x(\cos \Delta x-1)}{\Delta x}-\frac{\sin x\sin\Delta x}{\Delta x}
%\right]\\
%&=\lim_{\Delta x\to0}\left[\cos x\cdot\frac{\cos\Delta x-1}{\Delta x}
%-\sin x\frac{\sin\Delta x}{\Delta x}\right]\\
%&=\cos x\cdot 0 - \sin x\cdot 1
%=-\sin x,\qquad\text{q.e.d.}
%\end{align*}
%\end{proof}
\begin{proof}{\bf(\ref{SineDerivative})}: The proof is based upon
the following:
\begin{align*}
\sin(\alpha+\beta)&=\sin\alpha\cos\beta+\cos\alpha\sin\beta,\\
\lim_{\theta\to0}\frac{\sin\theta}\theta&=1,\\
\lim_{\theta\to0}\frac{1-\cos\theta}{\theta}&=0,\end{align*}
which are, respectively,
(\ref{Sin(Alpha+Beta)}) from page~\pageref{Sin(Alpha+Beta)},
(\ref{SinX/XLimitTheoremEquation}) from
page~\pageref{SinX/XLimitTheoremEquation}, and
(\ref{(1-CosX)/(X)Limit}) from page~\pageref{(1-CosX)/(X)Limit}.
We will use the limit-definition of the derivative, expand
using the formula for $\sin(\alpha+\beta)$, and rearrange the
terms so we can use the trigonometric limits above.
\begin{align*}
f'(x)&=\lim_{\Delta x\to0}\frac{f(x+\Delta x)-f(x)}{\Delta x}\\
&=\lim_{\Delta x\to0}\frac{\sin(x+\Delta x)-\sin x}{\Delta x}\\
&=\lim_{\Delta x\to0}\frac{\sin x\cos\Delta x+\cos x\sin\Delta x-\sin x}
                          {\Delta x}\\
&=\lim_{\Delta x\to0}\frac{\sin x(\cos\Delta x-1)+\cos x\sin\Delta x}
                          {\Delta x}\\
&=\lim_{\Delta x\to0}\left[\sin x\cdot\frac{\cos\Delta x-1}{\Delta x}
                          +\cos x\cdot\frac{\sin\Delta x}{\Delta x}\right]\\
&=\sin x\cdot 0+\cos x\cdot 1\\
&=\cos x,\qquad\text{q.e.d.}
\end{align*}
\end{proof}
Now we combine what we know into other examples.
\bex Find $f'(x)$ if $f(x)=x^2+\sin x-3\cos x$.

\underline{Solution}:
$$f'(x)=\frac{d}{dx}\left[x^2+\sin x-3\cos x\right]
       =2x+\cos x-3(-\sin x)=2x+\cos x+3\sin x.$$
\eex
We can also use these derivatives to find where functions involving
$\sin x$ and $\cos x$ are increasing/decreasing, and thus find any
local extrema
(that is, local maxima and minima).
\bex Consider the function $f(x)=\sin x-\cos x$.  Find where
$f(x)$ is increasing and where $f(x)$ is decreasing, and use this
information to plot $f(x)$.

\underline{Solution}:
Here $f'(x)=\cos x-(-\sin x)=\cos x+\sin x$.  Since this is defined
and continuous everywhere, we will check where it is zero to
detect where it ($f'(x)$ here) possibly changes signs.
The technique below works anytime we are interested
in solving $a\sin x+b\cos x=0$, where $a,b\ne0$:
\begin{align*}
\cos x+\sin x=0&\iff \sin x=-\cos x\\
               &\iff \frac{\sin x}{\cos x}=-1\\
               &\iff \tan x=-1.
\end{align*}
The reason we can divide by $\cos x$ is because there are no solutions
where $\cos x=0$, because such solutions would require also $\sin x=0$,
and these cannot be zero simultaneously because
(recall) $\sin^2x+\cos^2x=1$.  So we are looking for $x\in\Re$ such that
$\tan x=-1$. This occurs  in the second quadrant (if $x$ represents
an angle in standard position) and in the fourth quadrant, with
reference angles $\pi/4$:

\begin{center}
\begin{pspicture}(-2,-2)(2,2)
\psaxes[labels=none]{<->}(0,0)(-2,-2)(2,2)
\pscircle(0,0){1}
\psline{<->}(-2,2)(2,-2)
\end{pspicture}
\end{center}

\noindent Thus we are looking for angles $x=\frac{3\pi}4+n\pi$, where
$n=0,\pm1,\pm2,\pm3,\cdots$.  Now $f(x)=\cos x+\sin x$ is $2\pi$-periodic,
so we can analyze one period to see what the graph
should look like.  We will use the points
$x=-\pi/4,3\pi/4,7\pi/4$ for our sign chart, and declare the pattern
from there:

\begin{center}
\begin{pspicture}(0,0)(9,6)
\rput(6,6){$f'(x)=\cos x+\sin x$}
\rput[l](0,5.3){Test $x$=}
  \rput(4.5,5.3){$0$}
  \rput(7.5,5.3){$\pi$}
\rput[l](0,4.7){$f'(x)=$}
  \rput(4.5,4.7){$1+0$}
  \rput(7.5,4.7){$-1+0$}
\psline{|-|}(3,4)(9,4)
\rput(3,3.5){${\frac{-\pi}4}$}
\rput(6,3.5){${\frac{3\pi}4}$}
\rput(9,3.5){${\frac{7\pi}4}$}

\rput[l](0,2.8){Sign $f'$:}
   \rput(4.5,2.8){\boplus}
   \rput(7.5,2.8){\bominus}
\rput[l](0,2.2){Behavior of $f$:}
   \rput(4.5,2.2){$\nearrow$}
   \rput(7.5,2.2){$\searrow$}
\end{pspicture}
\end{center}

\noindent Because this behavior continues, we see a
local maximum at $\left(\frac{3\pi}4,f\left(\frac{3\pi}4\right)\right)
=\left(\frac{3\pi}4,\sqrt2\right)$,
since
 $$f(3\pi/4)=\sin\frac{3\pi}4-\cos\frac{3\pi}4=\frac{\sqrt2}2-\frac{-\sqrt2}2
=\frac{\sqrt2+\sqrt2}2=\frac{2\sqrt2}2=\sqrt2.$$
This local maximum height then
repeats every $2\pi$ in both (left and right) directions. Similarly,
because of the sign chart and the fact that this function
(and its derivative and its derivative's sign chart) repeats
every $2\pi$,  we have
a local minimum at, for instance,
$\left(\frac{7\pi}4,f\left(\frac{7\pi}4\right)\right)
=\left(\frac{7\pi}4,-\sqrt2\right)$, which also repeats every
$2\pi$ in both directions. This function is
graphed in Figure~\ref{f(x)=SinX-CosXFigure}
\begin{figure}
\begin{center}
\begin{pspicture}(-6.28,-2)(6.28,2)
\psaxes[labels=none,Dx=.7854,Dy=1.4142]{<->}(0,0)(-6.28,-2)(6.28,2)
\psplot[plotpoints=1000]{-6.28}{6.28}{x 3.1415926538 div 180 mul sin %
x 3.1415926538 div 180 mul cos sub}

\rput(.5,1.4142){$\sqrt2$}
\rput(.7,-1.4142){$-\sqrt2$}

\rput(-3.1416,-.3){$-\pi$}
\rput(3.1416,-.3){$\pi$}
\rput(2.36,-.5){$\frac{3\pi}4$}\rput(-.785,-.5){$\frac{-\pi}4$}
\rput(-3.927,-.5){$\frac{-5\pi}4$}
\rput(5.498,-.5){$\frac{7\pi}4$}

\end{pspicture}
\end{center}
\caption{Partial graph of $f(x)=\sin x-\cos x$, showing for instance
the local minima at $x=7\pi/4$ and $x=-\pi/4$, and the local
maxima at $x=3\pi/4$ and $x=-5\pi/4$.  Each local extremum is
repeated every $2\pi$. See Example~\ref{f(x)=SinX-CosXExample}.}
\label{f(x)=SinX-CosXFigure}\end{figure}
\label{f(x)=SinX-CosXExample}

\eex

\bex Let $f(x)=x+\sin x$.  Find where $f(x)$ is increasing and where $f(x)$
is decreasing.

\underline{Solution}: Here $f'(x)=1+\cos x=0$ when $\cos x=-1$,
which is at $x=\pm\pi, \pm3\pi, \pm5\pi, \cdots$.  A partial sign chart
is given below:

\begin{center}
\begin{pspicture}(-0.2,-2)(12,2)
\psline{<->}(0,0)(12,0)
   \psline(3,-.2)(3,.2)
      \rput(3,-.5){$-\pi$}
   \psline(6,-.2)(6,.2)
      \rput(6,-.5){$\pi$}
   \psline(9,-.2)(9,.2)
      \rput(9,-.5){$3\pi$}

\rput(7,1.5){$f'(x)=1+\cos x$}
\rput[l](-0.2,1){Test $\hphantom{f'(}x\hphantom{)}=$}
%\rput[l](-.2,.5){Sign $f'(x)=$}
\rput[l](-0.2,-.5){$f'(x)$:}
\rput(3.5,1){$-2$}
%  \rput(1.5,.5){\boplus\bominus\bominus}
  \rput(1.5,-.5){\boplus}
\rput(4.5,1){$0$}
%  \rput(4.5,.5){\boplus\boplus\bominus}
  \rput(4.5,-.5){\boplus}
\rput(7.5,1){$10$}
%  \rput(7.5,.5){\boplus\boplus\boplus}
  \rput(7.5,-.5){\boplus}
\rput(10.5,1){$10$}
%  \rput(10.5,.5){\boplus\boplus\boplus}
  \rput(10.5,-.5){\boplus}

%\rput[l](-.2,-1.25){Behavior of $f(x)$:}
   \rput(1.5,-1.5){$\nearrow$}
   \rput(4.5,-1.5){$\nearrow$}
   \rput(7.5,-1.5){$\nearrow$}
   \rput(10.5,-1.5){$\nearrow$}
\end{pspicture}
\end{center}

\eex

So this function is actually always increasing, only
briefly having zero slope at the odd multiples of $\pi$.
Note that these points occur at $(\pi,\pi)$,
$(3\pi,3\pi)$, $(7\pi,7\pi)$, etc., and
 $(-\pi,-\pi)$,
$(-3\pi,-3\pi)$, $(-7\pi,-7\pi)$, etc.
This function is graphed in Figure~\ref{GraphOfX+SinX},
showing this behavior.

\begin{figure}
\begin{center}
\begin{pspicture}(-3.6,-3.6)(3.6,3.6)
\psset{xunit=.3cm,yunit=.3cm}
\psaxes[labels=none,Dx=3.1416]{<->}(0,0)(-12,-12)(12,12)
%\psplot{-6}{6}{x 3.1415926536 div 180 mul sin x add}
\psplot[plotpoints=1000]{-12}{12}{x 3.1415926536 div 180 mul sin x add}
\rput(-9.625,-.7){$-3\pi$}
\rput(-6.483,-.7){$-2\pi$}
\rput(-3.342,-.7){$-\pi$}
\rput(3.142,-.7){$\pi$}
\rput(6.283,-.7){$2\pi$}
\rput(9.425,-.7){$3\pi$}

\rput(1,3){3}
\rput(1,6){6}
\rput(1,9){9}
\rput(1.3,-3){$-3$}
\rput(1.3,-6){$-6$}
\rput(1.3,-9){$-9$}
\end{pspicture}
\end{center}
\caption{Partial graph of $f(x)=x+\sin x$.  The derivative being
$f'(x)=1+\cos x$, which is positive except at
$x=\pm\pi,\pm3\pi,\pm5\pi,\cdots$, the function is always
increasing, momentarily ``leveling off'' at these points where
$f'(x)=0$.}
\label{GraphOfX+SinX}
\end{figure}

\subsection{Other Applications}

We can look back at our earlier discussion of the derivative
to see some other applications of our present differentiation
rules.  For instance, if we have a particle with a position
function $s(t)=6t^2-9t+15$, we immediately get the velocity
function:
$$s(t)=6t^2-9t+15\implies v=\frac{ds}{dt}=\frac{d}{dt}\left[
      6t^2-9t+15\right]=12t-9.$$
If $s$ is in meters and $t$ in seconds, then $v=\frac{ds}{dt}$
is in meters/second.

If instead, $s(t)=\sin t$, then $v(t)=\frac{ds(t)}{dt}
=\frac{d}{dt}\sin t=\cos t$, so a sinusoidal motion gives
a similar (cosinusoidal?) velocity.

For another example,
if we have the volume of a tank given as a function of time
$t$ by $V(t)=t(10-t)$, $0\le t\le 10$ then the volume in the tank is
changing at a rate (for $0<t<10$) of
$$\frac{dV}{dt}=\frac{d}{dt}\left[10t-t^2\right]=10-2t.$$
If $V$ is in gallons and $t$ is in minutes, then
$\frac{dV}{dt}$ is in gallons/minute. The maximum volume of the
tank occurs at $t=5$, since before then we have $\frac{dV}{dt}>0$,
while after $t=5$ we have $\frac{dV}{dt}<0$.  The actual
maximum volume is then $V(5)=5(10-5)=25$.

There are countless other examples of {\it related rates}
we can investigate using just the rules of this section.
However, we will be much better equipped to pursue
applications after we develop the other differentiation
rules in the next sections.  Eventually we will tackle
many and varied such problems to illustrate how the
calculus is applied to real-world questions.

\newpage
\begin{center}\underline{\Large{\bf Exercises}}\end{center}
\bigskip

\begin{multicols}{2}

\begin{enumerate}
\item Find the following derivatives.
\begin{enumerate}
\item $\ds{\frac{d}{dx}\left[x^2-199x+27\right]}$.
\item $\ds{\frac{d}{dx}\left[\frac12x^2+2x\right]}$.
\item $\ds{\frac{d}{dt}\left[t^7-19t+10^6\right]}$.
\item $\ds{\frac{d}{dx}\left[(x+9)(x-3)\right]}$.
\item $\ds{\frac{d}{dy}\left[10-9y^8\right]}$.
\item $\ds{\frac{d}{dx}\left(2x+5\right)^2}$.
\end{enumerate}

\item Show that $$\ds{\frac{d}{dx}\left(x^2\cdot x^3\right)
\ne\left(\frac{d}{dx}\left(x^2\right)\right)
\!\left(\frac{d}{dx}\left(x^3\right)\right).}$$
Why does this not violate Theorem~%
\ref{TheoremOnDerivativeAndMultiplicativeConstants}
(i.e., (\ref{DerivativeAndMultiplicativeConstants}))?
\label{NoSimpleProductRuleExercise}
\item Give an alternate proof of the integer power rule,
Theorem~\ref{PowerRule} by using
\begin{multline*}
a^n-b^n=(a-b)\left(a^{n-1}+a^{n-2}b\right.\\ \left.+a^{n-3}b^2
+\cdots+ab^{n-2}+b^{n-1}
\right).\end{multline*}
(\underline{Hint}: $a^n$ will be your $f(x+\Delta x)$ term,
and $b^n$ will be $f(x)$.)
\item Suppose $s(t)=3t^2-2t+19$.  Find $v(t)$.  Also
find when the particle is moving to the right ($v>0$), and when
it is moving left ($v<0$).
\item Graph the function $f(x)=x^4-4x^2$, showing all
$x$-intercepts, all local maxima and minima.
(See Example \ref{XXX-3XExample}, page \pageref{XXX-3XExample}.)

\item Use $\cos(\alpha+\beta)=\cos\alpha\cos\beta-\sin\alpha\sin\beta$
to prove (\ref{CosineDerivative}), page~\pageref{CosineDerivative}:
$$\frac{d\cos x}{dx}=-\sin x.$$
It may be helpful to see the proof for the derivative of $\sin x$.

\item Graph $f(x)=\sin x+\cos x$ for $x\in[-2\pi,2\pi]$,
showing where this function is increasing and where it is decreasing.
\item Graph $f(x)=x+2\cos x$ over a reasonable interval, showing
where this function is increasing and where it is decreasing.
Also show its behavior as $x\to\pm\infty$.

\item 1(f) above must be expanded (``multiplied out'')
before using the power rule.  The answer is $8x+20$.
Compute 1(f) above using instead the technique in
Footnote~\ref{FootnoteFirstSeeChainRule},
page~\pageref{FootnoteFirstSeeChainRule}. (There $u=2x+5$).
\end{enumerate}
\end{multicols}
\newpage
%%%%%%
%%%%%%
%%%%%%
\section{Chain Rule I}
The chain rule is perhaps the most important of the
differentiation rules.  It is immensely rich in application,
and very elegantly stated when notation is chosen wisely.
In this section we will look closely at the rule itself,
and the underlying intuition of the rule.

 The mechanics
of applying the rule are of utmost importance, but as with
other calculus principles, understanding the intuition
aids in determining when and how to apply the chain rule.
Because of the importance and theoretical richness of the
chain rule, the reader is encouraged to revisit this
section from time to time, to reinforce this
most important topic.

In its simplest form, the chain rule dictates  how
we must calculate derivatives of compositions
of functions, i.e., functions of the form $h(x)=f(g(x))$,
especially when
we know how to calculate $f'$ and  $g'$.
With it we will be
able to calculate derivatives for a much
wider class of functions,  find slopes on
implicit curves, and to find so-called related rates
relationships among variables.

We will first state
the chain rule using Taylor's ``prime'' notation
and  then  re-write it in terms
of the Leibniz notation.  Eventually the latter will be given
preferential treatment, for in writing the chain rule
using Leibniz, we will get a first glance at some of the true
power of that notation.
\subsection{Chain Rule in Prime Notation}
\begin{theorem}{\rm\bf(Chain Rule)}
Suppose that $h(x)=f(g(x))$, where $g'(a)$ exists and
$f'(g(a))$ exists.  Then
\begin{equation}
h'(a)=[f'(g(a))]g'(a).
\end{equation}
\end{theorem}
%
Another way of writing this in Taylor's notation is
\begin{equation}\left(f(g(x))\right)'=f'(g(x))g'(x).
\label{PrimeNotationChainRule}\end{equation}
Note that there is an ``outer'' function, namely $f$,
and an ``inner function'' $g$.  So the chain rule
is sometimes stated that we compute the derivative
of the outer function {\it with respect to the inner function},
that is $f'(g(x))$, and then multiply by the derivative of
the inner function, i.e., by $g'(x)$.  That is a common,
colloquial way of expressing the chain rule.  It should be
mentioned that ``multiplying by the derivative of the inner
function'' is the step that is most commonly forgotten
in such derivative problems.

\bex Compute $f'(x)$ if $f(x)=(x^2+3x)^2$.

\underline{Solution}:
Besides the unwieldy ``limit definition,'' thus far there
are two possible methods for computing $f'(x)$ here:
\begin{itemize}
\item Expand the function first, and then compute the derivative, as
we would need to do if we had only the methods of the previous section:
$$h(x)=x^4+6x^3+9x^2\implies h'(x)=4x^3+18x^2+18x.$$
\item Use the chain rule.  Here the ``outer function'' is
      $f(x)=x^2$ (squaring the input),
      and the ``inner function'' is $g(x)=x^2+3x$.
      Note that $f'(x)=2x$ while $g'(x)=2x+3$.  Using the chain rule
      we would have
      $$h'(x)=[f'(g(x))]g'(x)=\left[2(g(x))^1\right]g'(x)
            =\left[2(x^2+3x)^1\right](2x+3).$$
Note that this gives $h'(x)=2(2x^3+9x^2+9x)=4x^3+18x^2+18x$ as before.
\end{itemize}
\eex
As we will see, there are simpler ways of looking at the chain
rule than labeling an ``outer function'' $f(x)$ and
an  ``inner function'' $g(x)$, calculating $f'$ and $g'$, and
evaluating at $g(x)$ and $x$, respectively.  Still, there are advantages over
expanding the function first.  For instance, expanding might not
be so easy.  Also, the final answer is somewhat factored which
helps in determining where the derivative is positive and negative.
The next example will demonstrate some of these
advantages more dramatically.

\bex Find $h'(x)$ if $h(x) =(x^3+27x+9)^{55}$.

\underline{Solution}:
Certainly we do not want to multiply this out
to use earlier rules.  Instead we just notice that this
is a composition of two functions, with the
``outer'' function being $f(x)=x^{55}$ and the
``inner'' function being $g(x)=x^3+27x+9$.
Now $f'(x)=55x^{54}$, while $g'(x)=3x^2+27$.  Thus
$$h'(x)=[f'(g(x)]g'(x)=55(g(x))^{54}\cdot g'(x)
=55(x^3+27x+9)^{54}\cdot(3x^2+27).$$
Even if we had somehow expanded the original, 165-degree polynomial first,
and then calculated the derivative, it is unlikely
we would have noticed that our resulting 164-degree polynomial
answer factors so nicely.\eex

The chain rule has much to say about derivatives of functions which
contain trigonometric functions in their structures.
Below are two examples where
the ``outer function'' and ``inner function'' are
squaring and sine functions, respectively and then vice-versa.
\bex Find $h'(x)$ if $h(x)=\sin^2x.$

\underline{Solution}: Note that $h(x)=(\sin x)^2$, so the
``outer function'' is $f(x)=x^2$, while the ``inner function''
is $\sin x$.  Next note that $f'(x)=2x$ and $g'(x)=\cos x$.  Thus
$$h'(x)=[f'(g(x))]g'(x)=[2(g(x))]g'(x)=2\sin x\cdot\cos x.$$
\eex
\bex Suppose $h(x)=\sin x^2$.  Here $f(x)=\sin x$, $g(x)=x^2$,
$f'(x)=\cos x$, $g'(x)=2x$.  Hence
$$h'(x)=[f'(g(x))]g'(x)=\cos g(x)\cdot g'(x)=\cos x^2\cdot2x=2x\cos x^2.$$
(It is customary to write the polynomial factor before the trigonometric
function factor in the final answer,
so it is clearer what terms are inside the trigonometric
function, and which are multiplying the trigonometric function.)
\label{SinXXWithPrimes}\eex

Note how it is crucial to identify the outer function and the inner function.
It is also important that the inner function $g(x)$ is entered into
the derivative $f'$ of the outer function.

To show that the chain rule makes sense from the limit-definition
standpoint as a derivative rule, we next offer a partial proof
of the chain rule.  Note how the way the limit is re-written reflects
the ultimate statement of the chain rule.  It also reflects much of the
intuition of the rule.

\subsection{Partial Proof of Chain Rule}
We will not completely
prove the chain rule in this context because of some technical
difficulties which arise when
proving the rule in its most general form.  However, we will look
at a proof in perhaps the most common case, which is
the case that $g(x+\Delta x)-g(x)\longto 0$ ``properly''
(so that we also have %not only does $g(x+\Delta x)-g(x)\longto 0$,
$(\exists\delta>0)[0<|\Delta x|<\delta\longrightarrow
g(x+\Delta x)-g(x\ne0]$.
In such a case we can safely divide and multiply by $g(x+\Delta x)-g(x)$
in the limit definition of the derivative to get
\begin{align*}
\frac{d}{dx}[f(g(x))]&=
   \lim_{\Delta x\to 0}\frac{f(g(x+\Delta x))-f(g(x))}{\Delta x}\\
  &=\lim_{\Delta x\to 0}
      \underbrace{\frac{f(g(x+\Delta x))-f(g(x))}{g(x+\Delta x)-g(x)}}_{(I)}
        \cdot
       \underbrace{\frac{g(x+\Delta x)-g(x)}{\Delta x}}_{(II)}.\end{align*}
Now we claim that this limit is $f'(g(x))g'(x)$.  The second
term $(II)$ clearly has limit $g'(x)$, by definition.
Under the assumption that $g(x+\Delta x)-g(x)\longto0$ properly
as $\Delta x\to0$, we can substitute
$\Delta g(x)=g(x+\Delta x)-g(x)\longto0$,
and rewrite the limit $(I)$\footnotemark  %%% FOOTNOTEMARK
$$\lim_{\Delta g(x)\to0}\frac{f(g(x)+\Delta g(x))-f(g(x))}{\Delta g(x)}
  =f'(g(x)).$$
\footnotetext{%%%
%%% FOOTNOTE
When we rewrite $f(g(x+\Delta x))=f(g(x)+\Delta g(x))$,
we were justified because
\begin{align*}
g(x+\Delta x)&=(g(x+\Delta x)-g(x))+g(x)\\
&=\Delta g(x)+g(x)\\ &= g(x)+\Delta g(x).\end{align*}
%%% END FOOTNOTE
}%
Note that the computation above is also correct even if
$\Delta g(x)\longto 0^+$ or $\Delta g(x)\longto 0^-$ properly,
because the
existence of the two-sided limit represented by $f'(g(x))$
is assumed to exist in our statement of the chain rule theorem.

\subsection{Leibniz Notation and the Chain Rule}
Before we see how the chain rule is stated with Leibniz
notation, first we will make some observations
about that notation.  For example, the following
three formulas say the same thing---how the square of
a quantity changes with respect
to the quantity---albeit with different
variables:
$$\frac{d\,x^2}{dx}=2x, \qquad \frac{d\,t^2}{dt}=2t,\qquad
\frac{d\,u^2}{du}=2u.$$
See Figure~\ref{XTU} for a graphical interpretation of this fact.
It is important that in each equation the variables matched.
(It is \underline{\it not} true,
for instance, that $d\,u^2/dx=2u$, as we shall soon see.)

\begin{figure}
\begin{center}
\begin{pspicture}(-2,-1)(2,4.2)
\psaxes{<->}(0,0)(-2,-1)(2,4)
\psplot{-2}{2}{x dup mul}
\rput(.10,4.2){$x^2$}
\rput(2,.2){$x$}
\pscircle[fillcolor=black,fillstyle=solid](1.4141,2){.07}
\end{pspicture}\quad
\begin{pspicture}(-2,-1)(2,4.2)
\psaxes{<->}(0,0)(-2,-1)(2,4)
\psplot{-2}{2}{x dup mul}
\rput(.10,4.2){$t^2$}
\rput(2,.2){$t$}
\pscircle[fillcolor=black,fillstyle=solid](1.4141,2){.07}
\end{pspicture}\quad
\begin{pspicture}(-2,-1)(2,4.2)
\psaxes{<->}(0,0)(-2,-1)(2,4)
\psplot{-2}{2}{x dup mul}
\rput(.10,4.2){$u^2$}
\rput(2,.2){$u$}
\pscircle[fillcolor=black,fillstyle=solid](1.4141,2){.07}
\end{pspicture}
\end{center}

\caption{Three identical graphs: $x^2$ versus $x$,
$t^2$ versus $t$, and $u^2$ versus $u$.  All have the
same slope---though these are dubbed $\frac{dx^2}{dx}=2x$,
$\frac{dt^2}{dt}=2t$ and $\frac{du^2}{du}=2u$
respectively---at each fixed horizontal axis value.
One such value is represented by a black dot on each of the three graphs.}
\label{XTU}
\end{figure}

Now suppose we have a differentiable function $u=u(x)$ and want to take
the derivative of $\left(u(x)\right)^2$. The ``outer''
function is $f(x)=x^2$ (i.e., squaring what is inside),
while the ``inner'' function is $u=u(x)$.  Consider
how we find the derivative of $(u(x))^2$ (a chain rule problem)
with Taylor's ``prime'' notation (\ref{PrimeNotationChainRule}), and with
Leibniz's notation:
\begin{alignat}{3}
&\text{Taylor:}&&\qquad&\left((u(x))^2\right)'&=2(u(x))^1\cdot u'(x)\\
&\text{Leibniz:}&&&\frac{d\,u^2}{dx}&=\frac{d\,u^2}{du}\cdot\frac{du}{dx}
=2u\cdot\frac{du}{dx}.\label{ALeibnizMethod}
\end{alignat}
The two notations say the same thing, but the Leibniz notation
has several advantages, two of which we point out here:
\begin{itemize}
\item  Resemblance to algebraic manipulations: it appears
that we simply decomposed  $\frac{d\,u^2}{dx}$ by
dividing and multiplying by
$du$, yielding derivatives that made sense and could be
calculated by known rules: the first by the power rule,
and the second by whatever method gives us $u'(x)$.
\item Variable of differentiation appears explicitly:
we know when we are taking the derivative with respect
to $x$, and when it is with respect to $u$.
\end{itemize}
Compare (\ref{ALeibnizMethod})  to our partial proof from the last subsection.
Before giving more computational examples, we will look at another argument
for the validity of the chain rule.  We begin with a very simple example.
\bex
Suppose we have a vehicle
which always achieves a fuel efficiency rating of 35 mile/gallon,
and each gallon costs \$1.40.  Then we can ask
what is the cost per mile.  We can think of this situation
as total cost $C$ being a function of total gallons consumed $g$,
i.e., $C=C(g)$  and total
gallons as a function of total miles, i.e., $g=g(m)$.
Ultimately cost is then a (composite) function of miles,
i.e., $C=C(g(m))$.  Now cost per mile will be cost per gallon
times gallons per mile.  In other words, the  rate of change in $C$
with respect to total miles $m$ is
\begin{equation}
\underbrace{\frac{\$1.40}{\text{ gallon}}}_{\ds{\frac{dC}{dg}}}
\ \cdot\
\underbrace{\frac{1\text{ gallon}}
{35\text{\vphantom{g} mile}}}_{\ds{\frac{dg}{dm}}}
=\underbrace{
\vphantom{\frac{\$1.40}{\text{ gallon}}}
\$0.04/\text{mile}}_{\ds{\frac{dC}{dm}}}.
\label{DollarsPerMileExampleEquation}\end{equation}
\begin{pspicture}(-6,0)(6,0)
\rput(0.14,.8){$\cdot$}
\rput(1.9,.8){$=$}
\end{pspicture}
\eex
This  example  is simple because these rates do not change.
Still, it is reasonable that
even if these rates $dC/dg$ and $dg/dm$ only
hold for an instant in time, {\it during that instant} $\frac{dC}{dm}$
will still be the product $\frac{dC}{dg}\cdot\frac{dg}{dm}$ as above.
(This is not a proof, but an argument for reasonableness.)
For that reason, we can similarly do the following
(but where the ``instant'' is a particular value of $x$):
\begin{equation}\frac{d\,(x^3+1)^2}{dx}
=\frac{d\,(x^3+1)^2}{d(x^3+1)}\cdot\frac{d\,(x^3+1)}{dx}
=2(x^3+1)^1\cdot3x^2.\label{ChainRuleDecompFor(x^3+1)^2}\end{equation}
That $d(x^3+1)^2/d(x^3+1)=2(x^3+1)$ is not much different from
the argument in Figure~\ref{XTU}, page~\pageref{XTU},
except the ``horizontal axis''
would be $(x^3+1)$ while the vertical would be $(x^3+1)^2$.
The derivative with respect to $x$---which is a ``hidden''
variable upon which the others depend---is found by compensation,
that is, the rate of change of $(x^3+1)^2$ with respect to
$x$ is found by first finding its rate of change with respect
to $(x^3+1)$, and then multiplying by a compensating factor
which is the rate of change of $(x^3+1)$ with respect to $x$.

Here we want to know how $(x^3+1)^2$ changes with respect to
$x$, so we first ask how does $(x^3+1)^2$ changes
with respect to $(x^3+1)$, i.e.,  how does the square
of a quantity change with respect to that
quantity (power rule)---and
multiply by how $(x^3+1)$ changes as $x$ changes.\footnote{%
%%% FOOTNOTE
This is somewhat similar to compensating for unmatched units in physics or
chemistry problems.  If we travel 60 miles in 75 minutes, and
we want our average speed in miles/hour, we can first find miles/minute,
and then multiply by a compensating factor which relates minutes
to hours:
$$\text{speed}=\frac{60\text{ mile}}{75\text{ minute}}
              =0.8\ \frac{\text{mile}}{\text{minute}}
                 \qquad\cdot\underbrace{\frac{60\text{ minute}}
                     {1\text{ hour}}}_{%
                  \overset{\ds{\text{compensating}}}{\ds{\text{factor}}}}
              =48\,\frac{\text{mile}}{\text{hour}}.$$
Since the question was how the distance relates to hours, we first
did the easy computation relating distance to minutes, and
then compensated by multiplying how minutes relate to hours.
%%% END FOOTNOTE
}%
\hphantom{. }%
With this kind of argument we can extend the power rule
to have a chain rule version,
\begin{align}
\frac{du^n}{dx}&=\underbrace{\frac{du^n}{du}}_{||}\cdot\,\frac{du}{dx},\quad
                     \text{i.e.,}\notag\\
\frac{du^n}{dx}&=nu^{n-1}\cdot\frac{du}{dx}.\label{PowerRuleWithChainRule}
\end{align}%
\bex We can now quickly calculate the following
derivatives, which would be more difficult without the chain rule:
\begin{itemize}
\item $\ds{\frac{d\,(29x-x^2)^4}{dx}
=4(29x-x^2)^3\cdot\frac{d}{dx}(29x-x^2)
=4(29x-x^2)^3(29-2x)}$.
\item $\ds{\frac{d\,(x+21)^9}{dx}=9(x+21)^8\cdot\frac{d(x+21)}{dx}
           =9(x+21)^8\cdot 1=9(x+21)^8}$. Note that
occasionally the derivative $\frac{du}{dx}$
of the ``inner function'' is just $1$.
\item $\ds{\frac{d}{dx}(5x-9)^8=8(5x-9)^7\cdot\frac{d}{dx}(5x-9)
=8(5x-9)^7\cdot5=40(5x-9)^7}$.

\end{itemize}
\eex
%
When we computed $\frac{d}{dx}(5x-9)^8$, we could have written
\begin{equation}
\frac{d(5x-9)^8}{dx}=\frac{d(5x-9)^8}{d(5x-9)}\cdot\frac{d(5x-9)}{dx}
=8(5x-9)^7\cdot5,\label{ExampleForExpandedStyleOnChainRulesW/Powers}
\end{equation}
and this is quite correct.  However it is not standard practice to
write the middle step.  Indeed most authors prefer to avoid
having complicated expressions in the denominator of a
differential operator, preferring denominators as in
$\frac{d}{dx}$, $\frac{d}{dt}$, $\frac{d}{du}$,
etc.  In this text we will still occasionally
write as in (\ref{ExampleForExpandedStyleOnChainRulesW/Powers})
for clarity (which is akin to using a truth table
to show a style of argument is valid),
but more often we will just state the
chain rule version (\ref{PowerRuleWithChainRule})  of the power rule with the
correct terms in place of the general $u$:
\begin{equation}\frac{d}{dx}(5x-9)^8=8(5x-9)^7\cdot\frac{d}{dx}(5x-9)
=8(5x-9)^7\cdot5=40(5x-9)^7,\label{ExampleForStyleOnChainRulesW/Powers}
\end{equation}
as in the example.  The kind of thinking that one can often settle
into for such examples is that we are taking the derivative,
with respect to $x$, of
a quantity raised to the eighth power, which gives us
eight times the quantity to the seventh power, but then times
the derivative of that quantity with respect to $x$ (to compensate
for the fact that we first took the derivative of the quantity
to the eighth power {\it with respect to that quantity} and
not with respect to $x$).  That way of thinking fits nicely into
the ``prime'' statement of the chain rule, and is clearly illustrated
by the Leibniz-style decomposition of the derivative into the
two factors $\frac{d(5x-9)^8}{dx}=
\frac{d(5x-9)^8}{d(5x-9)}\cdot \frac{d(5x-9)}{dx}$, but also
gives us a shortcut---albeit not for the careless---for
computing these derivatives.

{\bf The reader is encouraged in the strongest possible terms to
always write the first step of ``power rule with chain rule''
problems as in (\ref{ExampleForStyleOnChainRulesW/Powers})
in practice.}  This will avoid errors, and will reinforce
the proper use of the chain rule version of the
power rule, (\ref{PowerRuleWithChainRule}).
We now list several further examples of this rule.

\begin{itemize}
\item $\ds{\frac{d\,(2x+9)^3}{dx}=3(2x+9)^2\cdot\frac{d}{dx}(2x+9)
                     =3(2x+9)^2\cdot2=6(2x+9)^2}$.
\item $\ds{\frac{d\,\sin^2x}{dx}
             =\frac{d}{dx}(\sin x)^2
             =2(\sin x)\frac{d}{dx}\sin x
             =2\sin x\cos x}$.
\item $\ds{\frac{d}{dx}(x^2+\cos x)^4=
            4(x^2+\cos x)^3\frac{d}{dx}(x^2+\cos x)
            =4(x^2+\cos x)^3(2x-\sin x)}$.
\item $\ds{\frac{d}{dx}\left(3x^2+6x+7\right)^7
            =7\left(3x^2+6x+7\right)^6\cdot
             \frac{d}{dx}\left(3x^2+6x+7\right)}$

            \qquad $\ds{=7\left(3x^2+6x+7\right)^6\left(6x+6\right)
            =7(3x^2+6x+7)^6\cdot6(x+1)=42(3x^2+6x+7)(x+1)}$.
\end{itemize}
Note that the chain rule version of the power rule,
$\frac{d\,u^n}{dx}=nu^{n-1}\cdot\frac{du}{dx}$,
does not contradict the earlier power rule that $\frac{d\,x^n}{dx}
=nx^{n-1}$.
For instance, when ``$u$'' is equal to $x$, we can write
$$\frac{d\,x^9}{dx}=9x^8\cdot\frac{dx}{dx}=9x^8\cdot1=9x^8,$$
which agrees with our original power rule, which here would
give us $\frac{d\,x^9}{dx}=9x^8$. Thus chain rule version of the power rule
in fact generalizes the original power rule.
\subsection{Chain Rule Derivatives of Sine and Cosine}
Now we look at derivatives of $\sin u$ and $\cos u$ with
respect to $x$, assuming $u=u(x)$, i.e., that $u$ is actually
a function of $x$.  Recall (\ref{SineDerivative}) and
(\ref{CosineDerivative}) from page \pageref{SineDerivative}:
$\frac{d\sin x}{dx}=\cos x$ and $\frac{d\cos x}{dx}=-\sin x$.
The chain rule versions of the
derivatives of sine and cosine then become
\begin{align}
\frac{d\sin u}{dx}&=\cos u\cdot\frac{du}{dx},\label{DerivativeSineU}\\
\frac{d\cos u}{dx}&=-\sin u\cdot\frac{du}{dx}.\label{DerivativeCosineU}
\end{align}
The proofs utilize the Leibniz notation's decomposition pattern as before:
\begin{alignat*}{2}
\frac{d\sin u}{dx}&=\frac{d\sin u}{du}\cdot\frac{du}{dx}&&=
                                     \cos u\cdot\frac{du}{dx},\\
\frac{d\cos u}{dx}&=\frac{d\cos u}{du}\cdot\frac{du}{dx}&&=
                                     -\sin u\cdot\frac{du}{dx},
\end{alignat*}
q.e.d.  Now we are free to use (\ref{DerivativeSineU})
and (\ref{DerivativeCosineU}) where applicable.
In the next example we show two methods of computing a particular
derivative: using a Leibniz-style decomposition, and
applying (\ref{DerivativeSineU}) directly.
\bex If $f(x)=\sin x^2$, then we can compute $f'(x)$ the following
two ways:
\begin{align}
\frac{d\sin x^2}{dx}&=\frac{d\sin x^2}{dx^2}\cdot\frac{dx^2}{dx}
                     =\cos x^2\cdot 2x=2x\cos x^2,\label{LeibStySinXX}\\
\frac{d\sin x^2}{dx}&=\cos x^2\cdot\frac{dx^2}{dx}=\cos x^2\cdot2x=
                       2x\cos x^2.\label{LeibStyAbbrevSinXX}\end{align}
\eex
In the second method (\ref{LeibStyAbbrevSinXX})
for computing the derivative above,
we did just insert $u=x^2$ into (\ref{DerivativeSineU}),
but the justification for that can also be seen in the first
method (\ref{LeibStySinXX})  with the Leibniz-style decomposition.
Note also that we computed this same derivative in
Example~\ref{SinXXWithPrimes}, page \pageref{SinXXWithPrimes}
using the prime notation.

\bex Compute $\frac{d\,f(z)}{dz}$ if $f(z)=\cos(z^3+\sin z)$.

\underline{Solution}: Here the names of the variables have changed,
but the principle of the chain rule is the same.  Again we will
compute this two ways, the second
 using (\ref{DerivativeCosineU}),
except with $z$ in place of $x$:
\begin{align*}
f'(z)&=\frac{d}{dz}\,\cos(z^3+\sin z)
      =\frac{d\cos(z^3+\sin z)}{d(z^3+\sin z)}
         \cdot\frac{d(z^3+\sin z)}{dz}
      =-\sin(z^3+\sin z)\cdot(3z^2+\cos z),\\
f'(z)&=\frac{d}{dz}\,\cos(z^3+\sin z)
      =-\sin(z^3+\sin z)\cdot\frac{d(z^3+\sin z)}{dz}
      =-\sin(z^3+\sin z)\cdot(3z^2+\cos z).
\end{align*}
\eex
Accepted practice is to compute the above derivative using the latter
method, and so that is the method students should eventually strive to
reproduce. As in an earlier discussion involving the power
rule, one can think of this example as using the thought pattern
that says {\it the derivative of cosine is minus sine\dots,
multiplied by the derivative of what is inside the cosine. }%
That is perhaps an over-simplification, and should be informed by awareness
of what we get from the Leibniz-style expansion.

To be clear on what (\ref{DerivativeSineU}) and (\ref{DerivativeCosineU})
say, and why these should hold, consider the following abstract
equations, which are in fact restatements of (\ref{DerivativeSineU}):%
\footnotemark
\begin{alignat*}{2}
\frac{d\sin u}{dw}&=\frac{d\sin u}{du}\cdot\frac{du}{dw}
                  &&=\cos u\cdot\frac{du}{dw},\\
\frac{d\sin\theta}{d\xi}&=\frac{d\sin\theta}{d\theta}\cdot\frac{d\theta}{d\xi}
                  &&=\cos\theta\cdot\frac{d\theta}{d\xi},\\
\frac{d\sin x}{dt}&=\frac{d\sin x}{dx}\cdot\frac{dx}{dt}
                  &&=\cos x\cdot\frac{dx}{dt}.\end{alignat*}
\footnotetext{%
%%% FOOTNOTE
Just to be sure, it should be pointed out that when we write for instance
$\cos x\cdot\frac{dx}{dt}$, we mean that the $\frac{dx}{dt}$ is outside
of the cosine function, i.e., we mean $(\cos x)\cdot\frac{dx}{dt}$.
Note that many texts assume this meaning without making it explicit with
the dot ``$\cdot$,'' and simply write $\cos x\,\frac{dx}{dt}$.
As a matter of style, it is assumed the derivative $\frac{dx}{dt}$ is
not part of the argument of the cosine function in such a case.
%%% END FOOTNOTE
}

\noindent Note that in all the cases, the decomposition's first
factor let us use the known derivative formula for sine---because
the variables matched---and then we compensated for introducing
the new variable's derivative (as a fraction of differentials)
with the second factor.

We now point out that it is quite common for the chain
rule to apply more than once in a particular problem.
Our next example below shows a case of a function
within a function within a function, and the example
following will be a sum of two functions, each requiring
a chain rule.

\bex Compute $\frac{d}{dx}\left[\sin^3(4x)\right]$.

\underline{Solution}:  Note that the function can be
rewritten $\left[\sin4x\right]^3$.
Now we compute the derivative, first applying the power rule
version of the chain rule (\ref{PowerRuleWithChainRule}), page
\pageref{PowerRuleWithChainRule}, and then
(\ref{DerivativeSineU}), page \pageref{DerivativeSineU}.
Then we show the same computation using the Leibniz-style decomposition.
\begin{align*}
\frac{d[\sin4x]^3}{dx}&=3[\sin4x]^2\cdot\frac{d\sin4x}{dx}\\
                      &=3\sin^24x\cdot\cos4x\frac{d(4x)}{dx}\\
                      &=3\sin^24x\cos4x\cdot4=12\sin^24x\cos4x.\\
\frac{d[\sin4x]^3}{dx}
  &=\frac{d[\sin4x]^3}{d[\sin4x]}\cdot\frac{d\sin4x}{d(4x)}\cdot
                   \frac{d(4x)}{dx}\\
  &=3[\sin4x]^2\cdot\cos4x\cdot4=12\sin^24x\cos4x.\end{align*}
\eex
So the Leibniz-style decomposition will work for longer ``chains''
of functions within functions.  But so will the abbreviated
chain rules which say $\frac{du^3}{dx}=3u^2\cdot\frac{du}{dx}$,
and $\frac{d\sin u}{dx}=\cos u\cdot\frac{du}{dx}$, which was
the first approach in the computations above: after applying
the power rule, the ``inner'' derivative called another
chain rule.\footnote{%%%
%%% FOOTNOTE
This phenomenon of ``rules calling other rules'' occurs repeatedly
throughout the rest of the textbook.  We will see it occasionally
in this section, and it will become the norm in later sections.
%%% END FOOTNOTE
}
  Again, it is best
to strive for the abbreviated approach in practice, though
both approaches are worth studying (and of course the decomposition
explains the abbreviated approach).

\bex Find $f'(x)$ if $f(x)=\sin^2x+\cos^2x$.

\underline{Solution}: The larger structure of this function is that
of a sum of two functions, so first we use the sum rule,
which tells us to add (and thus first compute) the derivatives
of $\sin^2x$ and $\cos^2x$.  These are then both chain rules.
\begin{align*}
f'(x)&=\frac{d}{dx}\left[\sin^2x+\cos^2x\right]\\
    &=\frac{d}{dx}\left[\sin^2x\right]+\frac{d}{dx}\left[\cos^2x\right]\\
    &=\frac{d}{dx}\left[(\sin x)^2\right]+\frac{d}{dx}\left[(\cos x)^2\right]\\
    &=2(\sin x)\frac{d}{dx}\sin x+2(\cos x)\frac{d}{dx}\cos x\\
    &=2\sin x\cos x+2\cos x(-\sin x)\\
    &=2\sin x\cos x-2\cos x\sin x\\
    &=0.\end{align*}
Actually this is what we should hope would be the answer, for the original
function we are taking the derivative of is actually constant:
$$\frac{d}{dx}\left[\sin^2x+\cos^2x\right]=\frac{d}{dx}[1]=0.$$
\eex
It happens frequently in calculus that it is advantageous to algebraically
rewrite a function before taking its derivative.  In fact we did that
each time we took a derivative of $\sin^2x=(\sin x)^2$, the latter
notation being more obvious in illustrating the composition
(function inside of a function) structure of the original function.
For calculus to be consistent (which it is, so no need to fear!),
we should be able to rewrite the function and get the same derivative,
as long as we rewrite the function correctly.  The derivative rules
are eventually sufficient to compute the derivative no matter how
the function is rewritten, but some forms of a given function
are easier to deal with than others.

\subsection{Power Rule for Rational Powers}

With the chain rule we have enough theoretical development to
show that the power rule actually holds for any constant
power which is a rational number $p/q$ (where $p,q\in\mathbb{Z}$,
and of course $q\ne0$).
Recall that the set of all rational
numbers was denoted $\mathbb{Q}$, for ``quotients,'' i.e.,
fractions, of integers.  We already proved the rule for powers
$n\in\{0,1,2,3,\cdots\}$, and that result is used in the
proof for rational powers which we leave the proof until the end
of this section, so we can expeditiously come to examples.
But first, the theorem.

\begin{theorem}{\rm\bf(Power Rule for Rational Powers)}
For any $r\in\mathbb{Q}-\{0\}$ (i.e., nonzero rational numbers),
\begin{align}
\frac{d\,x^r}{dx}&= rx^{r-1},\label{RationalPowerRuleEquation}\\
\frac{d\, u^r}{dx}&=ru^{r-1}\cdot\frac{du}{dx}.
\label{ChainRuleVersionOfPowerRule}\end{align}
\label{PowerRuleForRationalPowers}\end{theorem}
\bex For example, the following (which was an exercise with
difference quotient limits in Section~\ref{DerivativeSection1})
yields quickly to the power rule:
$$\frac{d\,\sqrt{x}}{dx}=\frac{d\,x^{1/2}}{dx}
=\frac12x^{1/2-1}=\frac12x^{-1/2}=\frac1{2\sqrt{x}}.$$
\eex
In fact, this particular derivative occurs often enough
that it, along with its chain rule
version, deserves special attention
(and should be committed to memory):
\begin{align}
\frac{d\,\sqrt{x}}{dx}&=\frac1{2\sqrt{x}},\\
 \frac{d\,\sqrt{u}}{dx}&=\frac{1}{2\sqrt{u}}\cdot\frac{du}{dx}.
\end{align}
\bex Find $f'(x)$ for $\ds{f(x)=\sqrt{x^2+1}}$.
$$f'(x)=\frac{d}{dx}\sqrt{x^2+1}=\frac1{2\sqrt{x^2+1}}\cdot\frac{d}{dx}
\left(x^2+1\right)=\frac1{2\sqrt{x^2+1}}\cdot(2x)
=\frac{x}{\sqrt{x^2+1}}.$$\eex
Note that in the above example
the ``outer'' function was the square root, while
the ``inner'' function is $x^2+1$.  One could write (though
again, it is not standard practice):
$$\frac{d}{dx}\sqrt{x^2+1}=
 \frac{d\sqrt{x^2+1}}{d(x^2+1)}\cdot\frac{d(x^2+1)}{dx}
=\frac1{2\sqrt{x^2+1}}\cdot2x=\frac{x}{\sqrt{x^2+1}}.$$

\bex Suppose $f(x)=\sqrt{x+\sqrt{x}}$.  Then the Leibniz decomposition
would look like
$$
\frac{d f(x)}{dx}
=\frac{d\sqrt{x+\sqrt{x}}}{d\left(x+\sqrt{x}\right)}
    \cdot\frac{d\left(x+\sqrt{x}\right)}{dx}
=\frac1{2\sqrt{x+\sqrt{x}}}\cdot\left(1+\frac1{2\sqrt{x}}\right).$$
Again---and especially with practice---one would usually not
write the decomposition in the first step, but should
instead write
$$\frac{d}{dx}\sqrt{x+\sqrt{x}}=\frac1{2\sqrt{x+\sqrt{x}}}
  \cdot\frac{d\left(x+\sqrt{x}\right)}{dx}
   =\frac1{2\sqrt{x+\sqrt{x}}}\cdot\left(1+\frac1{2\sqrt{x}}\right).$$
\eex
A common mistake in the above example is to think of $\sqrt{x}$
as the inner function, since geometrically it somehow appears
to be innermost.  In fact the inner function is actually the whole
of $x+\sqrt{x}$.
\bex Suppose $\ds{f(x)=\frac2{(x^3-9x+7)^7}}$.  Then
\begin{align*}
f'(x)&=\frac{d}{dx}\left[2(x^3-9x+7)^{-7}\right]\\
     &=2\cdot(-7)(x^3-9x+7)^{-8}\frac{d}{dx}(x^3-9x+7)\\
     &=-14(x^3-9x+7)^{-8}(3x^2-9)\\
     &=\frac{-14(3x^2-9)}{(x^3-9x+7)^8}.\end{align*}
\eex
In the previous example we were able to use the
chain rule version (\ref{ChainRuleVersionOfPowerRule})
of the power rule once we wrote the function as
a power of a polynomial, albeit negative and with a multiplicative constant
along for the ride.  The next example calls for a rewriting (for simplicity),
and then calls the chain rule twice.

\bex $\ds{f(x)=\sqrt[3]{\frac1{x+\sqrt{x^3+9}}}}$.
\begin{align*}
f'(x)&=\frac{d}{dx}\left[\sqrt[3]{\frac1{x+\sqrt{x^3+9}}}\,\right]\\
&=\frac{d}{dx}\left(x+\sqrt{x^3+9}\,\right)^{-1/3}\\
&=-\frac13\left(x+\sqrt{x^3+9}\,\right)^{-4/3}
   \cdot\frac{d}{dx}\left(x+\sqrt{x^3+9}\,\right)\\
&=-\frac13\left(x+\sqrt{x^3+9}\right)^{-4/3}
 \cdot\left[1+\frac1{2\sqrt{x^3+9}}\cdot\frac{d}{dx}(x^3+9)\right]\\
&=-\frac13\left(x+\sqrt{x^3+9}\right)^{-4/3}
 \cdot\left[1+\frac{3x^2}{2\sqrt{x^3+9}}\right]
\end{align*}\eex
In the calculation above, we first rewrote the expression as a
$\frac{-1}3$ power, then used the chain rule version of the
power rule, and used the chain rule {\it again} in calculating
the derivative of that ``inner'' function.

Now we prove the power rule for rational numbers
$$r\in\mathbb{Q}\implies\frac{d\,x^r}{dx}=rx^{r-1},$$
from which the chain rule version also follows.
The proof is in two steps, the first being a proof in the case
of negative integer powers, from  which we can eventually
recover all rational power cases.

\begin{proof}
Now we will use the chain rule to show that the
power rule, $\frac{d}{dx}x^r=rx^{r-1}$, holds
also for any rational power $r=p/q$, with
$p,q$ nonzero integers.   (The case $p=0$ is trivial
and the case $q=0$ is meaningless.)
The proofs below are included for completeness,
and also because they foreshadow a method we
will use extensively later in the text, that
method being {\it implicit differentiation}.

First we will show that the power rule holds
for $y=x^n$ for any negative integer exponents  $n$.
In such cases we can write
$y=x^{-m}$ for a positive integer exponent $m$ (namely $-n$).
But then $y^{-1}=x^m$.  Furthermore  we already showed
in Section~\ref{DerivativeSection1}
(Example~\ref{FunctionWithTangentsExample3},
page \pageref{FunctionWithTangentsExample3}) that
the derivative definition gives us
$\frac{dy^{-1}}{dy}=-1/y^2$ (though the variable used in the
proof there was $x$).
Using this and the chain rule, we get
\begin{alignat*}{2}
&&y^{-1}&=x^m\\
&\implies\qquad&\frac{d}{dx}\left[y^{-1}\right]&=\frac{d}{dx}\left[x^m\right]\\
&\implies&-\frac1{y^2}\cdot\frac{dy}{dx}&=mx^{m-1}\\
&\implies&\frac{dy}{dx}&=-y^2mx^{m-1}\\
&&&=-(x^n)^2(-n)x^{-n-1}\\
&&&=nx^{2n-n-1}\qquad=nx^{n-1},\qquad\text{q.e.d.}
\end{alignat*}

It is important to that we interpret the first implication
correctly.  Recall that $y=x^n$, so $y$ is a function
of $x$.  But then so is $y^{-1}$ and, in fact,
$y^{-1}$ and $x^m$ are {\it the same functions of $x$}.
Hence, if $y^{-1}$ and $x^m$ were graphed versus $x$, the
graphs would be the same, so the slopes at each $x$-value would
be the same. Therefore $y^{-1}$ and $x^m$ have the same
derivative with respect to $x$.

Now we will use the chain rule in a similar way to compute the derivatives
of rational powers of $x$.  Suppose $y=x^{p/q}$, where
$p,q\in\mathbb{Z}-\{0\}$ are nonzero integers,
and that $r=p/q$ is in simplified form.  Then we can raise both
sides of $y=x^{p/q}$ to the power $q$ to get\footnotemark
\footnotetext{%
%%%%%%% FOOTNOTE
Note that $p$ or $q$ (but not both, since $p/q$ is simplified)
could be negative, but what we are about to do is justified
by the previous result that the power rule also works for negative
integer exponents.
%%%%%%%%  END FOOTNOTE
}
\begin{alignat*}{2}
&&y^q&=x^p\\
&\implies\qquad&\frac{d\,y^q}{dx}&=\frac{d\,x^p}{dx}\\
&\implies\qquad&qy^{q-1}\frac{dy}{dx}&=px^{p-1}\\
&\implies&\frac{dy}{dx}&=\frac{p}{q}y^{1-q}x^{p-1}
                       =\frac{p}q\left(x^{p/q}\right)^{1-q}x^{p-1}
                       =\frac{p}q\cdot x^{\frac{p}q-p}x^{p-1}
                       =\frac{p}q\cdot x^{\frac{p}q-1},\end{alignat*}
which can be rewritten  $\frac{dy}{dx}=rx^{r-1}$.  Thus $y=x^r$ implies the
form that we sought to prove for the derivative.
\end{proof}

In fact, once we have logarithms we can define $y=x^r$ for all $r\in\Re$,
and find again that the derivative is given by the same formula as
in our power rules here.
\newpage

\begin{center}\underline{\Large{\bf Exercises}}\end{center}
\bigskip
\begin{multicols}{2}
\begin{enumerate}
\item Find the following derivatives using the power rule.
You may need to rewrite a function as a power, but the
chain rule will not be necessary in any case.
(One could make these into chain rule problems, but
that will be the more difficult approach in each.)
\begin{enumerate}
\item $\ds{\frac{d}{dx}\left[\frac1{x^{11}}\right]}$.
\item $\ds{\frac{d}{dx}\left[\frac1{\sqrt{x}}\right]}$.
\item $\ds{\frac{d}{dx}\left[\sqrt[3]{x^4}\right]}$.
\item $\ds{\frac{d}{dx}\left[\frac{6}{x}\right]}$.
\item $\ds{\frac{d}{dt}\left[\frac1{2t^2}\right]}$.
\item $\ds{\frac{d}{dy}\left[\sqrt{9y}\right]}$
\end{enumerate}

\item Find the following derivatives.
\begin{enumerate}
\item $\ds{\frac{d}{dx}\left[(1-9x)^{11}\right]}$.
\item $\ds{\frac{d}{dx}\left[27(3x^2-10x+55)^2\right]}$.
\item $\ds{\frac{d}{dx}\left[\sqrt{2x^5-1}\right]}$
\item $\ds{\frac{d}{dx}(3x+1)^2}$.  (Do two ways: chain rule,
and by first expanding the square.)
\end{enumerate}
\item $f'(x)$ for each of the following:
\begin{enumerate}
\item $\ds{f(x)=(x+5)^{100}}$.
\item $\ds{f(x)=(2x+5)^{100}}$.
\item $\ds{f(x)=\frac{1}{(x^4-x+1)^3}}$.
\item $\ds{f(x)=\sqrt{x+\sqrt{x+\sqrt{x}}}}$.
\end{enumerate}
\item Compute the following derivatives:
\begin{enumerate}
\item $\ds{\frac{d\sin z}{dx}}$
\item $\ds{\frac{d\cos\theta}{dt}}$
\item $\ds{\frac{d\,x^7}{dt}}$
\item $\ds{\frac{d\sin(\cos x)}{d\cos x}}$
\end{enumerate}
\item Compute the following derivatives:
\begin{enumerate}
\item $\ds{\frac{d\sin\sqrt{x}}{dx}}$
\item $\ds{\frac{d}{dx}\sqrt{\sin x}}$
\item $\ds{\frac{d\sin(\cos x)}{dx}}$
\item $\ds{\frac{d}{dx}\cos^3x}$
\item $\ds{\frac{d}{dx}\cos(x+\cos x)}$
\end{enumerate}
\item Find $h'(9)$ if $h(x)=f(g(x))$, $g(9)=5$, $g'(9)=2$, and
        $f'(5)=7$.
\item On the unit circle, $y^2=1-x^2$.  If we take either the
upper semicircle or the lower semicircle, then $y$ is also
a function of $x$.  Find the tangent line to the graph at
the point $(3/5,4/5)$ by finding $\frac{dy}{dx}$ two ways:
\begin{enumerate}
\item Using $\ds{y=\sqrt{1-x^2}}$ for the upper semicircle, and
the chain rule.
\item By applying $\frac{d}{dx}$ to both sides of $y^2=1-x^2$,
as we did in the proof of Theorem~\ref{PowerRuleForRationalPowers},
and then solving for $\frac{dy}{dx}$, and plugging into that
expression $(x,y)=(3/5,4/5)$.
\end{enumerate}
\item Using $\sec x=(\cos x)^{-1}$,
\begin{enumerate}
\item derive
$\ds{\frac{d}{dx}\sec x=\sec x\tan x}$.
\label{FindSecant'sDerivativeWithChainRuleExercise}
\item
Use (a) and the chain rule to
compute
$\ds{\frac{d}{dx}\sec\sqrt{x^2+1}}$.
\end{enumerate}

\end{enumerate}

\end{multicols}

\newpage
\newpage
\section{Product, Quotient and Other Trigonometric Rules}
In this section we first introduce the rule for the differentiation
of a product of two functions.  From that and the chain rule,
we will derive a rule for differentiating a quotient of two
functions.  With a quotient rule we will be able to
use the rules for $\sin x$ and $\cos x$ to
derive rules for $\tan x$ and $\cot x$.  For completeness
we will also compute the rules for $\sec x$ and $\csc x$
and thus finish
our rules for the six basic trigonometric functions.

The rules for calculating the derivative of a product or
a quotient are not as simple as for a sum or difference.
However they are straightforward when applied correctly.

\subsection{Product Rule Stated and First Applied}
We begin with the statement and some discussion of the product rule,
followed by several examples demonstrating its mechanics.
The actual proof we leave until the next subsection.
\begin{theorem}{\rm\bf(Product Rule)}
At each $x$ for which $\frac{d}{dx}f(x)$
and $\frac{d}{dx}g(x)$ exist, so
does the derivative
$\frac{d}{dx}\left(f(x)\cdot g(x)\right)$ exist,
and it is given by
\begin{equation}
\frac{d}{dx}\left[f(x)\cdot g(x)\right]
=f(x)\frac{d}{dx}g(x)+g(x)\frac{d}{dx}f(x).
\label{ProductRule}\end{equation}\label{ProductRuleTheorem}
\end{theorem}
Though we defer the proof, we can make a couple of observations.
\begin{itemize}
\item This is {\bf not} simply the product of the two
      derivatives. (See for example
      Exercise~\ref{NoSimpleProductRuleExercise} in
      Section~\ref{FirstDiffRules}, page
      \pageref{NoSimpleProductRuleExercise}.)
\item Recall that multiplicative constants are preserved
      in the derivative: $\frac{d}{dx}(Cf(x))=C\frac{d}{dx}f(x)$.
      One could say the the constant ``amplifies'' the function by the
      factor $C$, and that this amplifying factor is preserved in
      the rate of change, or derivative, of the new function $Cf(x)$.
      (For example, $C=2$ doubles the function, and thus doubles
      the rate of change.)

      \ \ \ Next notice that the first term of (\ref{ProductRule})
      treats $f(x)$ as though it were a constant amplifying the
      change in (i.e., derivative of) $g(x)$, while the
      second term treats $g(x)$ as though it were a constant
      amplifying the change in $f(x)$.  In this way the
      product rule accounts for the changes in each function,
      as amplified by the other.  A close scrutiny of the
      proof shows how this emerges.
\end{itemize}\label{NotesOnProductRule}

Our first example shows how the product rule gives us
what we expect for a very simple case.
\bex Let $f(x)=x^5$.  Then $f'(x)=5x^4$ from the power rule.
But we can also write $f(x)=x^3\cdot x^2$, from which the
product rule gives
$$\frac{d}{dx}\left[x^3\cdot x^2\right]
=x^3\cdot\frac{d}{dx}(x^2)+x^2\cdot\frac{d}{dx}(x^3)
=x^3\cdot2x+x^2\cdot3x^2=2x^4+3x^4=5x^4.$$
\eex
Of course the product rule will be of much more
use than proving things we already knew.  The
next example requires the product rule
(or some {\it very} clever tricks with difference quotients!):
\bex Suppose $f(x)=x^2\sin x$.  This is a product of
two differentiable\footnote{%
%%%%%%%%%%%  FOOTNOTE
If the functions are not
differentiable, this fact appears as we take the derivatives
on the right-hand side of the product rule statement
(\ref{ProductRule}).  Thus
we usually just apply the rule---instead of checking differentiability
first.}%%%%%%%% END FOOTNOTE
\  functions.  Its derivative is given by
$$f'(x)=\frac{d(x^2\sin x)}{dx}
=x^2\cdot\frac{d\sin x}{dx}+\sin x\cdot\frac{d(x^2)}{dx}
=x^2\cos x+\sin x\cdot2x
=x(x\cos x+2\sin x)
$$
The last step was just an algebraic one, factoring the final answer
as much as possible.
\eex

Now we list several simple examples to illustrate the basic mechanics
of the product rule.
\begin{itemize}
\item $\ds{\frac{d}{dx}\left[(3x^2+5x-9)(5x^3+7x^2+27x-4)\right]}$

$\ds{=(3x^2+5x-9)\frac{d}{dx}(5x^3+7x^2+27x-4)
 +(5x^3+7x^2+27x-4)\frac{d}{dx}(3x^2+5x-9)}$

$\ds{=(3x^2+5x-9)(15x^2+14x+27)+(5x^3+7x^2+27x-4)(6x+5)}$.

\item $\ds{\frac{d}{dx}(x\cos x)=x\cdot\frac{d}{dx}\cos x
                           +\cos x\cdot\frac{d}{dx}x
    =x(-\sin x)+\cos x\cdot1=-x\sin x+\cos x}$.
%\item $\ds{\frac{d}{dx}\left[x\sqrt[3]{x^2+1}\right]
%       =\frac{d}{dx}\left[x(x^2+1)^{1/3}\right]
%       =x\frac{d}{dx}(x^2+1)^{2/3}+(x^2+1)^{1/3}]frac{d}{dx}{x}}$
\item $\ds{\frac{d}{dt}[PV]=P\cdot\frac{dV}{dt}+V\cdot\frac{dP}{dt}}$.

\end{itemize}

One of the interesting aspects of the calculus is the various ways
that the consistency of differentiation (derivative-taking) rules
can be seen by using different strategies for  particular derivatives.
Earlier we showed how to use the product rule
to compute $\frac{d}{dx}(x^2\cdot x^3)=5x^4$, which we also computed
with the power rule $\frac{d}{dx}(x^5)=5x^4$.
For another example, the behavior of multiplicative constants in
taking derivatives gives us, for example,
$\frac{d}{dx}(2\sin x)=2\frac{d}{dx}\sin x
=2\cos x$.  But we can also compute this with the product rule:
$$\frac{d}{dx}(2\sin x)=2\cdot\frac{d}{dx}\sin x+\sin x\cdot\frac{d}{dx}(2)
=2\cos x+\sin x\cdot0=2\cos x+0=2\cos x,$$
as before. Of course the rule on multiplicative constants
(page \pageref{TheoremOnDerivativeAndMultiplicativeConstants}) is faster.

Because the product rule calls for the derivatives of
the factors, it often calls upon other rules to compute
these component derivatives.  Conversely, other rules
may call upon the product rule.
As we saw with the chain rule, it is crucial that we
look at the overall structure of a function to see
which rule to apply first, and then work our way in
towards the inner structures as the differentiation rules
require in their turns.  The next two examples are product rules
first, which then call the chain rule.
\bex Suppose $f(x)=\sin x^2\cos x^3.$  This is foremost
     a product of two functions,\footnote{%%%
%%%% FOOTNOTE
Note that $\sin x^2\cos x^3$ is taken to be a
product.  Indeed, it is understood that
the sine and cosine functions here are separate factors.  The convention is to
understand this function, as written, in the following way:
$$\sin x^2\cos x^3=(\sin x^2)(\cos x^3).$$
Also note that $x^2$ is the argument of the sine, and $x^3$ the
argument of cosine.  Thus this function could also be written
$(\sin(x^2))\cdot(\cos(x^3))$.
%%%% END FOOTNOTE
} so we need the product rule first.
\begin{align*}
f'(x)&=\frac{d}{dx}\left[\sin x^2\cos x^3\right]\\
     &=\sin x^2\cdot\frac{d}{dx}\cos x^3+\cos x^3\cdot\frac{d}{dx}\sin x^2\\
     &=\sin x^2\cdot\left(-\sin x^3\cdot\frac{d}{dx}x^3\right)
       +\cos x^3\cdot\left(\cos x^2\cdot\frac{d}{dx}x^2\right)\\
     &=(\sin x^2)(-\sin x^3)(3x^2)+\cos x^3\cos x^2\cdot2x\\
     &=-3x^2\sin x^2\sin x^3+2x\cos x^3\cos x^2.
\end{align*}
Thus, when we took the derivatives called for by the product rule, these
required the chain rule.
(We could have factored the final computation but it is not necessary.)
\eex
For a polynomial example, consider the following:
\bex $f(x)=(x^2+2x+3)^2(x^2+1)^3$.  Without the product
rule we would be forced to carry out the multiplications,
but since this is written as
a product of two functions, we can instead use the product rule.
\begin{align*}
f'(x)&=\frac{d}{dx}\left[(x^2+2x+3)^2(x^2+1)^3\right]\\
     &=(x^2+2x+3)^2\cdot\frac{d}{dx}(x^2+1)^3+(x^2+1)^3\cdot
            \frac{d}{dx}(x^2+2x+3)^2\\
     &=(x^2+2x+3)^2\cdot3(x^2+1)^2\cdot\frac{d}{dx}(x^2+1)
      +(x^2+1)^3\cdot2(x^2+2x+3)^1\frac{d}{dx}(x^2+2x+3)\\
     &=(x^2+2x+3)^2\cdot3(x^2+1)^2(2x)+(x^2+1)^3\cdot2(x^2+2x+3)(2x+2)\\
     &=6x(x^2+2x+3)^2(x^2+1)^2+(4x+4)(x^2+1)^3(x^2+2x+3)\\
     &=(x^2+2x+3)(x^2+1)^2\left[6x(x^2+2x+3)+(4x+4)(x^2+1)\right]\\
     &=(x^2+2x+3)(x^2+1)^2\left[6x^3+12x^2+18x+4x^3+4x+4x^2+4\right]\\
     &=(x^2+2x+3)(x^2+1)^2\left[10x^3+16x^2+22x+4\right].
\end{align*}
Again, the statement of the product rule here called for
derivatives of the factors, and each of those required a
chain rule.  Note how one factor of $(x^2+2x+3)$ and two
factors of $(x^2+1)$ were factored from each term.
\eex

It is also possible that a product rule can occur within
a chain rule, as in the following.
\bex Suppose $f(x)=\sqrt{\sin x\cos x}$.  Then
\begin{align*}
f'(x)&=\frac{d}{dx}\sqrt{\sin x\cos x}\\
    &=\frac1{2\sqrt{\sin x\cos x}}\cdot\frac{d}{dx}(\sin x\cos x)\\
    &=\frac1{2\sqrt{\sin x\cos x}}\cdot\left[\sin x\frac{d}{dx}\cos x
             +\cos x\frac{d}{dx}\sin x\right]\\
   &=\frac1{2\sqrt{\sin x\cos x}}\cdot\left[\sin x(-\sin x)
             +\cos x\cos x\right]\\
   &=\frac{-\sin^2x+\cos^2x}{2\sqrt{\sin x\cos x}}.
\end{align*}
This is not the only method for solving this problem, but it
is perhaps the most straightforward.\footnote{%
%%%%%%%%%%% FOOTNOTE
Actually,
with trigonometry we can rewrite the problem and the answer,
using $\sin2\theta=2\sin\theta\cos\theta$ and
$\cos2\theta=\cos^2\theta-\sin^2\theta$.  Below,
``$\implies$'' represents another chain rule problem
(calling yet another chain rule).
$$f(x)=\sqrt{\frac12\sin2x}
\qquad\implies\qquad f'(x)=\frac{\cos2x}{2\sqrt{
   \frac12\sin2x}}.$$}
%%%%%%%%%%% END FOOTNOTE
\eex

We can also use these product-rule derived
derivatives to help graph functions.
\bex $f(x)=x\sqrt{1-x^2}$.  This function we will differentiate and
then graph.
\begin{align*}
f'(x)&=x\cdot\frac{d}{dx}\sqrt{1-x^2}+\sqrt{1-x^2}\cdot\frac{d}{dx}(x)\\
&=x\cdot\frac1{2\sqrt{1-x^2}}\cdot\frac{d}{dx}(1-x^2)
+\sqrt{1-x^2}\cdot1\\
&=x\cdot\frac{1}{2\sqrt{1-x^2}}\cdot(-2x)+\sqrt{1-x^2}\\
&=\frac{-x^2}{\sqrt{1-x^2}}+\sqrt{1-x^2}.\end{align*}
To graph this function we would like to know where it is
increasing and where it is decreasing and hence local extrema.
But even before delving into the derivative, we
can first notice the domain of $f(x)$ is $-1\le x\le 1$,
and the function (height) itself is zero at $x=0,\pm 1$
($x$-intercepts).

Next we proceed to see where $f'>0$ and $f'<0$.
For such a task, it is best if the derivative
is written as a single fraction, with numerator and denominator
factored:
$$f'(x)=\frac{-x^2}{\sqrt{1-x^2}}+\sqrt{1-x^2}\cdot
\frac{\sqrt{1-x^2}}{\sqrt{1-x^2}}=\frac{-x^2+1-x^2}{\sqrt{1-x^2}}
=\frac{1-2x^2}{\sqrt{1-x^2}}.$$
Now we see that this is undefined ($f'$ DNE)
except for $-1<x<1$.
The fraction which is $f'$ is zero exactly where the numerator
is zero and the denominator is not.  Thus
$$f'(x)=0\iff 1-2x^2=0\iff 1=2x^2\iff \frac12=x^2\iff x=\pm\frac1{\sqrt2}
\approx\pm0.7071.$$
From this we can make a sign chart for $f'$ to see where $f$ is
increasing/decreasing.

\begin{center}
\begin{pspicture}(-0.2,-2)(12,2.3)
\psline(2,0)(11,0)
   \pscircle[fillstyle=solid,fillcolor=white](2,0){.1}
   \pscircle[fillstyle=solid,fillcolor=white](11,0){.1}
   \rput(2,-.5){$-1$}
   \rput(11,-.5){$1$}
  \psline(5,-.2)(5,.2)
      \rput(5,-.5){$-\frac{1}{\sqrt2}$}
   \psline(8,-.2)(8,.2)
      \rput(8,-.5){$\frac{1}{\sqrt2}$}
  % \rput[l](-0.2,1.5){Function:}
\rput(5.9,2){$\ds{f'(x)=\frac{1-2x^2}{\sqrt{1-x^2}}}$}
\rput[l](-0.2,1){Test $\hphantom{f'(}x\hphantom{)}=$}
\rput[l](-.2,.5){Sign $f'(x)=$}
\rput[l](-0.2,-.5){Sign $f'(x)$:}
\rput(3.5,1){$-.9$}
  \rput(3.5,.5){\bominus/\boplus}
  \rput(3.5,-.5){\bominus}
\rput(6.5,1){$0$}
  \rput(6.5,.5){\boplus/\boplus}
  \rput(6.5,-.5){\boplus}
\rput(9.5,1){$.9$}
  \rput(9.5,.5){\bominus/\boplus}
  \rput(9.5,-.5){\bominus}
\rput[l](-.2,-1.25){Behavior of $f(x)$:}
  \rput(3.5,-1){DEC}
   \rput(3.5,-1.5){$\searrow$}
   \rput(6.5,-1.5){$\nearrow$}
   \rput(9.5,-1.5){$\searrow$}
\rput(6.5,-1){INC}
  \rput(9.5,-1){DEC}
\end{pspicture}
\end{center}

We see a local minimum at $x=-1/\sqrt2$, and a local
maximum at $x=1/\sqrt2$.  The actual points are
\begin{alignat*}{2}
\left(-\frac{1}{\sqrt2},\,f\left(-\frac{1}{\sqrt2}\right)\right)
&=\left(-\frac{1}{\sqrt2},\,-\frac1{\sqrt2}\cdot\sqrt{1/2}\right)&&\approx
    \left(-0.7071,\,-\frac12\right),\\
\left(\frac{1}{\sqrt2},\,f\left(\frac{1}{\sqrt2}\right)\right)
&=\left(\frac{1}{\sqrt2},\,\frac1{\sqrt2}\cdot\sqrt{1/2}\right)&&\approx
    \left(0.7071,\,\frac12\right).\end{alignat*}
All this behavior leads us to the graph, which is given in
Figure~\ref{xsqrt(1-x^2)graph}.  Notice the (computer generated)
graph there also reflects
that $\ds{f'(x)=\frac{1-2x^2}{\sqrt{1-x^2}}\longto-\infty}$
as $x\to-1^+$ or $x\to1^-$.
\eex

\begin{figure}
\begin{center}
\begin{pspicture}(-6,-2.5)(6,2.5)
\psset{xunit=3cm,yunit=3cm}
\psaxes[Dy=.5]{<->}(0,0)(-2,-1)(2,1)
\psplot[plotpoints=1000]{-1}{1}{x 1 x dup mul sub sqrt mul}
\psline(-.7071,-.05)(-.7071,.05)
  \rput(-.7071,-.17){$\frac{-1}{\sqrt2}$}
  \pscircle[fillcolor=black,fillstyle=solid](-.7071,-.5){.07}
\psline(.7071,-.05)(.7071,.05)
  \rput(.7071,-.17){$\frac{1}{\sqrt2}$}
  \pscircle[fillcolor=black,fillstyle=solid](.7071,.5){.07}
\end{pspicture}
\end{center}
\caption{Complete graph of $f(x)=x\sqrt{1-x^2}$, with local
extrema marked at $x=\pm1/\sqrt2$.}
\label{xsqrt(1-x^2)graph}\end{figure}

\subsection{Product Rule Proof}

The proof of the product rule is not accomplished by ``brute force,''
but instead utilizes some clever rewriting.  Questions of {\it why}
one thinks of
the ``trick'' used to make it work should not immediately distract
from the fact it does.  Many of the proofs used today have
been condensed over the decades, or even centuries since the
first proofs, and are therefore quite short because revisits
to earlier proofs naturally lead us to shortcuts.
As a result, proofs often look less like the natural paths
of discovery and more like terse explanations.  Nonetheless
there is knowledge to be gained from even these short
proofs---for instance, the ``trick'' may be useful in another
context---and so they are worth reading and understanding, though
again we will almost always just quote the results---without
reference to their proofs---when solving problems.

The proof of the product rule depends upon another
theorem which is intuitive, is important in its own right,
and has its own short, somewhat clever proof.
In sum, the theorem says that to have a well-defined slope
at $x=a$, a function must also be continuous there.
\begin{theorem} ($f'(a)$ exists)
 $\implies$ ($f(x)$ is continuous at $x=a$).
\label{DifferentiabilityImpliesContinuityTheorem}\end{theorem}

\begin{proof} Recall that
$$f'(a) \text{ exists}\qquad \iff \qquad f'(a)=
 \lim_{\Delta x\to0}\frac{f(a+\Delta x)-f(a)}{\Delta x}
  \in\Re,$$
i.e., the limit exists as a (finite) real number.
We need to show that this implies $f(x)$ is continuous at $x=a$,
which is equivalent to $\ds{\lim_{x\to a}f(x)=f(a)}$
(Theorem~\ref{ContinuityImpliesLimit=Function},
page \pageref{ContinuityImpliesLimit=Function}).
First we
re-write this limit using the substitution
$x=a+\Delta x$, which gives
$x\to a\iff\Delta x\to0$ properly.  Then
we perform an algebraic expansion of the argument
of the limit by  subtracting and adding
$f(a)$ (which  exists and is real or the above limit
could not exist and be finite), and divide and multiply
by $\Delta x$, to get
\begin{align*}\lim_{x\to a}f(x)&=
\lim_{\Delta x\to0}f(a+\Delta x)\\
&=\lim_{\Delta x\to0}\left[f(a+\Delta x)-f(a)+f(a)\right]\\
&=\lim_{\Delta x\to0}\left[\frac{f(a+\Delta x)-f(a)}{\Delta x}\cdot\Delta x%
+f(a)\right]\\
%&=\lim_{\Delta x\to 0}\left[\Delta x\cdot\frac{f(a+\Delta x)-f(a)}{\Delta x}
%+f(a)\right]\\
&=f'(a)\cdot0+f(a)=f(a), \text{\qquad q.e.d.}
\end{align*}
\end{proof}
Note that the last line of the proof used the fact that
the difference quotient approached the finite number $f'(a)$,
and so the limit form was ``$f'(a)\cdot0+f(a)$,'' yielding $f(a)$.

This theorem is sometimes described as ``differentiability
implies continuity.''  In fact differentiability is a stronger
criterion than continuity.\footnote{%
%%%%% FOOTNOTE
It is quite possible to have
the left and right limits in the definition of the derivative
be different, making the derivative nonexistent, while
the function can still be continuous.  An example is
$f(x)=|x|$ at $x=0$.  From the left, the difference
quotients are all $-1$, while from the right they are all
$1$.  (Recall the function is $-x$ for $x<0$, and $x$ for $x\ge0$.)
It is also possible for the limit in the derivative definition
to be infinite and the
function still continuous, as with $f(x)=\sqrt[3]{x}$, with
$f'(x)=1/(3x^{2/3})\longrightarrow\infty$ as $x\to0$.}
%%%%%%%%%%% END FOOTNOTE
 This result is also interesting in its contrapositive form
(recall $P\rightarrow Q\iff(\sim Q)\rightarrow(\sim P)$):
$$f(x)\text{ discontinuous at }x=a
\qquad\implies\qquad f'(x)\text{ DNE at }x=a.$$
To paraphrase, at the point $x=a$, to have a tangent
line the function must be continuous, and equivalently,
a function which is
discontinuous can not have a tangent line.
Now we use Theorem~\ref{DifferentiabilityImpliesContinuityTheorem}
and some algebraic tricks to prove the product rule.

\begin{proof}{\bf(Product Rule)} Suppose $f(x)$ and $g(x)$
are both differentiable at a given $x$, i.e., $f'(x)$ and $g'(x)$
both exist.  Then $f$ and $g$ are both continuous at $x$, and
%$$\frac{d}{dx}\left[\vphantom{\frac22}f(x)g(x)\right]
%=\lim_{\Delta x\to0}\frac{f(x+\Delta x)g(x+\Delta x)-f(x)g(x)}{\Delta x}$$
\begin{align*}
\frac{d}{dx}\left[\vphantom{\frac22}f(x)g(x)\right]
&=\lim_{\Delta x\to0}\frac{f(x+\Delta x)g(x+\Delta x)-f(x)g(x)}{\Delta x}\\
&=\lim_{\Delta x\to0}
\frac{f(x+\Delta x)\biggl[g(x+\Delta x)-g(x)\biggr]
   +g(x)\biggl[f(x+\Delta x)-f(x)\biggr]}
{\Delta x}\\
&=\lim_{\Delta x\to0}\left[f(x+\Delta x)\cdot
               \frac{g(x+\Delta x)-g(x)}{\Delta x}+
g(x)\cdot\frac{f(x+\Delta x)-f(x)}{\Delta x}\right]\\
&=\vphantom{\frac{X}X}f(x)g'(x)+g(x)f'(x),\qquad\text{q.e.d.}
\end{align*}\end{proof}
The last line of the proof follows because
 as $\Delta x\to0$, by continuity (which the previous theorem
gives us from the differentiability) we have $f(x+\Delta x)\to f(x)$,
and the two difference quotients approach $f'(x)$ and $g'(x)$
respectively, while $g(x)$ is constant in the limit
(which is in $\Delta x$, not $x$).
The middle two lines were simply algebra, with the
``clever trick'' in the second line
using the fact that $AB-CD=A(B-D)+D(A-C)$, except
here it was with $f(x+\Delta x)g(x+\Delta x)-f(x)g(x)$.
\subsection{Quotient Rule}
We often need to find derivatives of functions of the
form $h(x)=f(x)/g(x)$.  We can rewrite these as
$h(x)=f(x)\left(g(x)\right)^{-1}$, and use the
product rule, which will then call the chain rule, to get
\begin{align*}
h'(x)&=\frac{d}{dx}\left[f(x)(g(x))^{-1}\right]\\
&=f(x)\frac{d}{dx}\left[(g(x))^{-1}\right]
   +(g(x))^{-1}\frac{d}{dx}f(x)\\
&=f(x)\left[(-1)(g(x))^{-2}\frac{d}{dx}g(x)\right]
   +(g(x))^{-1}\frac{d}{dx}f(x)\\
&=\frac{-f(x)\frac{d}{dx}g(x)}{(g(x))^2}+\frac{\frac{d}{dx}f(x)}{g(x)}\\
&=\frac{-f(x)\frac{d}{dx}g(x)}{(g(x))^2}+
     \frac{g(x)\frac{d}{dx}f(x)}{(g(x))^2}.
\end{align*}
Combining the two fractions and putting the term with the negative sign
$(-)$ second, we can write:
\begin{theorem}If $f$ and $g$ are differentiable at $x$, and $g(x)\ne0$, then
\begin{equation}\frac{d}{dx}\left[\frac{f(x)}{g(x)}\right]
=\frac{g(x)\frac{d}{dx}f(x)-f(x)\frac{d}{dx}g(x)}{(g(x))^2}.
\label{QuotientRule}
\end{equation}
\label{QuotientRuleTheorem}\end{theorem}
As noted in the derivation, this rule is actually redundant
given the availability of the product and quotient rules.
However, it is useful especially because the
resulting derivative emerges as an already-combined fraction.
\bex Find $f'(x)$ if $\ds{f(x)=\frac{\sin x}{x}}$.

\underline{Solution}: Using the quotient rule we have
$$f'(x)=\frac{x\frac{d}{dx}\sin x-\sin x\frac{d}{dx}(x)}{(x)^2}
     =\frac{x\cos x-\sin x}{x^2}.$$
\eex
The quotient rule is especially useful for rational functions,
i.e., ratios of polynomials.
\bex Suppose $\ds{f(x)=\frac{x^3-8}{x^2-9}}$.  Then
\begin{align*}f'(x)&=
   \frac{(x^2-9)\frac{d}{dx}(x^3-8)-(x^3-8)\frac{d}{dx}(x^2-9)}{(x^2-9)^2}\\
 &=\frac{(x^2-9)(3x^2)-(x^3-8)(2x)}{(x^2-9)^2}\\
 &=\frac{3x^4-27x^2-2x^4+16x}{(x^2-9)^2}\\
 &=\frac{x^4-27x^2+16x}{(x^2-9)^2}.\end{align*}
\eex
As with the product rule, the quotient rule can be
embedded within a chain or product rule, or vice-versa.
The following uses a rule derived in the
Exercise~\ref{FindSecant'sDerivativeWithChainRuleExercise},
page \pageref{FindSecant'sDerivativeWithChainRuleExercise},
namely that $\frac{d}{dx}\sec x=\sec x\tan x$.
\bex Suppose $\ds{f(x)=\sec\left(\frac{x}{x-1}\right)}$.
Then
\begin{align*}f'(x)&=\frac{d}{dx}\sec\left(\frac{x}{x-1}\right)\\
       &=\sec\left(\frac{x}{x-1}\right)\tan\left(\frac{x}{x-1}\right)\cdot
 \frac{d}{dx}\left(\frac{x}{x-1}\right)\\
  &=\sec\left(\frac{x}{x-1}\right)\tan\left(\frac{x}{x-1}\right)
 \cdot\left(\frac{(x-1)\cdot\frac{d}{dx}(x)-x\cdot\frac{d}{dx}(x-1)}
         {(x-1)^2}\right)\\
&=\sec\left(\frac{x}{x-1}\right)\tan\left(\frac{x}{x-1}\right)
 \cdot\frac{(x-1)(1)-(x)(1)}{(x-1)^2}\\
&=\sec\left(\frac{x}{x-1}\right)\tan\left(\frac{x}{x-1}\right)
 \cdot\frac{-1}{(x-1)^2}\\
&=\frac{-1}{(x-1)^2}
 \sec\left(\frac{x}{x-1}\right)\tan\left(\frac{x}{x-1}\right).
\end{align*}
\eex
In fact the quotient rule for this particular problem could have
been avoided through long division, giving
$\frac{d}{dx}\left(\frac{x}{x-1}\right)
=\frac{d}{dx}\left(1+\frac1{x-1}\right)$, making for
a simple power/chain rule, but the quotient rule was
straightforward, and left that factor as a single fraction.
For an example of chain rules inside
a quotient rule, consider
the next example.
\bex Suppose $\ds{f(x)=\frac{\cos2x}{\sqrt{x^2-1}}}$.  Then
\begin{align*}
f'(x)&=\frac{\sqrt{x^2-1}\frac{d}{dx}\cos2x-\cos2x\cdot
   \frac{d}{dx}\sqrt{x^2-1}}{\left(\sqrt{x^2-1}\right)^2}\\
  &=\frac{\sqrt{x^2-1}\cdot\left(-\sin2x\cdot\frac{d}{dx}(2x)\right)
    -\cos2x\cdot\ds{\frac1{2\sqrt{x^2-1}}\cdot\frac{d}{dx}(x^2-1)}}{x^2-1}\\
&=\frac{\sqrt{x^2-1}\cdot\left(-2\sin2x\right)-\ds{\frac{\cos2x\cdot\not{2}x}
   {\not{2}\sqrt{x^2-1}}}}{x^2-1}\underbrace{\cdot\frac{\sqrt{x^2-1}}{\sqrt{x^2-1}}
   }_{\text{To Simplify}}\\
&=\frac{-2(x^2-1)\sin2x-x\cos2x}{(x^2-1)^{3/2}}.
\end{align*}
\eex
It is an interesting exercise in both calculus and
algebraic simplification to derive the same conclusion
using $f(x)=\cos2x\cdot(x^2-1)^{-1/2}$ and the product rule
(which would also call the chain rule twice).
\subsection{Tangent,Cotangent, Secant and Cosecant Rules}
The following are derivative rules for the remaining trigonometric
functions.  These rules are given in both simple
(``matching variable'') and chain rule versions.
\begin{alignat}{2}
\frac{d \tan x}{dx}&=\sec^2x,\qquad\qquad
    &\frac{d\tan u}{dx}&=\sec^2u\cdot\frac{du}{dx}.\label{TangentDerivative}
     \\
\frac{d \cot x}{dx}&=-\csc^2x,\qquad\qquad
    &\frac{d\cot u}{dx}&=-\csc^2u\cdot\frac{du}{dx}.\label{CotangentDerivative}
\\
\frac{d\sec x}{dx}&=\sec x\tan x,&\frac{d\sec u}{dx}&=
                        \sec u\tan u\cdot\frac{du}{dx}.
                  \label{SecantDerivative}\\
\frac{d\csc x}{dx}&=-\csc x\cot x,\qquad\qquad\qquad\qquad&\frac{d\csc u}{dx}&=
                        -\csc u\cot u\cdot\frac{du}{dx}.
                  \label{CosecantDerivative}
     \end{alignat}
These should all be memorized.  It may help to
notice patterns when comparing the derivatives of tangent
and cotangent, secant and cosecant, and how these are similar
to the comparison of sine and cosine derivatives.
In short, these formulas come in function/cofunction pairs.

We will prove the derivative of $\tan x$ is $\sec^2x$ and
leave the rest for exercises.  The chain rule
versions then follow.  To see the formula for the tangent, we
rewrite it as the quotient of sine and cosine, and use the quotient
rule.
\begin{align*}
\frac{d}{dx}\tan x&=\frac{d}{dx}\left[\frac{\sin x}{\cos x}\right]\\
&=\frac{\cos x\cdot\frac{d\sin x}{dx}-\sin x\cdot\frac{d\cos x}{dx}}{(\cos x)^2}\\
&=\frac{\cos x\cos x-(\sin x)(-\sin x)}{\cos^2x}\\
&=\frac{\cos^2x+\sin^2x}{\cos^2x}
=\frac1{\cos^2x}=\sec^2x,\\ \\
\frac{d}{dx}\tan u&=\frac{d}{du}\tan u\cdot\frac{du}{dx}
                  =\sec^2u\cdot\frac{du}{dx}.\end{align*}
The fourth line above used some trigonometric identities
($\sin^2\theta+\cos^2\theta=1$, $1/\cos\theta=\sec\theta$).
The last line was our usual chain rule argument,
given $\frac{d\tan x}{dx}=\sec^2x$ was already proved.
With (\ref{TangentDerivative})--(\ref{CosecantDerivative}),
and derivatives of sine and cosine from earlier((\ref{SineDerivative}),
(\ref{CosineDerivative}), page \pageref{SineDerivative}),
we finally have derivatives of all six trigonometric functions.

Every student of calculus should memorize the derivatives of
the trigonometric functions, {\it and be able to derive these
new ones} from knowing the derivatives of $\sin x$ and $\cos x$.

Now we can apply these.  First we look at some of the simpler examples.
\bex \qquad

\begin{itemize}
\item $\ds{\frac{d}{dx}\sec x^9=\sec x^9\tan x^9\cdot\frac{d}{dx}(x^9)
           =\sec x^9\tan x^9\cdot9x^8=9x^8\sec x^9\tan x^9}$.
\item
$\ds{\frac{d}{dx}x^2\tan x=x^2\cdot\frac{d}{dx}\tan x
              +\tan x\cdot\frac{d}{dx}(x^2)=x^2\sec^2x+2x\tan x}$.
\item $\ds{\frac{d}{dx}\left[\frac{x}{\tan x}\right]=\frac{d}{dx}(x\cot x)
=x\cdot\frac{d}{dx}(\cot x)+\cot x\cdot\frac{d}{dx}(x)
=(x)(-\csc^2x)+\cot x}$

$\ds{=-x\csc^2x+\cot x}$.
\end{itemize}\eex
Note that we turned a quotient rule into a product rule for the
last derivative problem.

Before continuing with more complicated examples, we should briefly
consider  why  it makes sense graphically that
$\frac{d}{dx}\tan x=\sec^2x$.
The graph of $f(x)=\tan x$ is given
in Figure~\ref{GraphTanXForSlopes}, and so we
can consider its derivative formula in light of that graph.
Now that derivative is always positive where defined;
$\sec^2x>0$, and in fact $\sec^2x=1/\cos^2x\ge1$.  Thus $\tan x$ is
always increasing in any interval on which it is defined.
Furthermore $\sec^2x\to\infty$ as $x\to\pm\frac{\pi}2,\pm\frac{3\pi}2,
\pm\frac{5\pi}2$, etc., and that has implications for the
graph.  Of course $\tan x=\sin x/\cos x$ has
vertical asymptotes at each of those $x$-values (where $\cos x=0$
and $\sin x=\pm 1$).  Finally, note that
$\left.\frac{d\tan x}{dx}\right|_{x=0}=\left.\vphantom{\frac22}\sec^2x
\right|_{x=0}=\frac1{\cos^20}=1$, for instance, so the slope through
the $(0,\tan0)=(0,0)$ is 1.  That slope repeats every $\pi$ in both
directions, due to the $\pi$-periodic nature of the tangent.

\begin{figure}
\begin{center}
\begin{pspicture}(-6,-3)(6,3)
\psaxes[labels=none,Dx=1.5708]{<->}(0,0)(-6,-3)(6,3)
\psline[linestyle=dashed](-4.7124,-3)(-4.7124,3)
\psline[linestyle=dashed](-1.5708,-3)(-1.5708,3)
\psline[linestyle=dashed](4.7124,-3)(4.7124,3)
\psline[linestyle=dashed](1.5708,-3)(1.5708,3)

\psplot{-6}{-5.03}{x 3.1415927 div 180 mul sin x %
            3.1415927 div 180 mul cos div}
\psplot{-4.39}{-1.89}{x 3.1415927 div 180 mul sin x %
            3.1415927 div 180 mul cos div}
\psplot{-1.25}{1.25}{x 3.1415927 div 180 mul sin x %
            3.1415927 div 180 mul cos div}
\psplot{1.89}{4.39}{x 3.1415927 div 180 mul sin x %
            3.1415927 div 180 mul cos div}
\psplot{5.03}{6}{x 3.1415927 div 180 mul sin x %
            3.1415927 div 180 mul cos div}
\rput(-3.14,-.3){$-\pi$}
\rput(3.14,-.3){$\pi$}

\rput(-.78,-3){QIV}
\rput(-2.4,-3){QIII}
\rput(-3.93,-3){QII}
\rput(-5.50,-3){QI}

\rput(.78,-3){QI}
\rput(2.4,-3){QII}
\rput(3.93,-3){QIII}
\rput(5.50,-3){QIV}

\end{pspicture}
\end{center}
\caption{Partial graph of $y=\tan x$.  Since $y=\sin x/\cos x$,
there are vertical
asymptotes at each $x$-value where $\cos x=0$ (and
$\sin\theta=\pm1$).  Recall that $\tan x$ is positive
if $x$ represents an angle in the first or third quadrants,
and negative in the second and fourth quadrants, so the
quadrants represented by the $x$-values are labeled
QI--QIV.  Note that $\frac{d}{dx}\tan x=\sec^2x$ which
is positive where defined (same as where $\tan x$ is defined),
and thus $\tan x$ is an increasing
function where defined.}
\label{GraphTanXForSlopes}
\end{figure}

\bex Here is a typical chain rule problem involving the tangent.
\begin{align*}
\frac{d}{dx}\tan \sqrt{x^2-1}
&=\sec^2\sqrt{x^2-1}\frac{d}{dx}\sqrt{x^2-1}
=\sec^2\sqrt{x^2-1}\cdot\frac1{2\sqrt{x^2-1}}\cdot\frac{d(x^2-1)}{dx}\\
&=\frac{\sec^2\sqrt{x^2-1}}{2\sqrt{x^2-1}}\cdot2x
=\frac{x\sec^2\sqrt{x^2-1}}{\sqrt{x^2-1}}.\end{align*}
\eex
Note that, tempting as it may be,
the radicals above cannot be combined or canceled in
any of the steps; one is outside the secant-squared function,
and the other is safely quarantined inside.  Note also that
squaring the secant function does not alter its argument
$\sqrt{x^2-1}$.
\bex Another chain rule problem is the following:
$$\frac{d}{dx}\cot^3x=3(\cot x)^2\frac{d}{dx}\cot x
=3\cot^2x(-\csc^2x)=-3\cot^2x\csc^2x.$$
\eex
\bex One product rule problem is the following:
\begin{align*}
\frac{d}{dx}(\sec x\tan x)
&=\sec x\cdot\frac{d}{dx}\tan x+\tan x\frac{d}{dx}\sec x\\
&=\sec x\sec^2x+\tan x\sec x\tan x\\
&=\sec^3x+\sec x\tan^2x.\end{align*}
There is so much algebraic structure built into the trigonometric
functions that such an answer can be rewritten many different
ways.  Recall that $\tan^2x+1=\sec^2x$.  Thus our final answer
can be written
$$\sec x(\sec^2x+\tan^2x)=\sec x(\sec^2x+\sec^2x-1)=\sec x(2\sec^2x-1),$$
for instance. Another alternative is $\sec x(\tan^2x+1+\tan^2x)
=\sec x(2\tan^2x+1)$.  When we study integration particularly, it is important
to consider such options.  \eex

\subsection{Putting Rules Together---Carefully}

This subsection is just a reminder that, when
computing the derivative of a complicated function
it is quite
possible to use several of the previous differentiation rules.
In such cases we need to recognize which rules apply, and
then exactly how to invoke them.

 It is easy to lapse into
intellectual laziness by skipping steps, but this is
an error-prone habit which does not save any time in the
long run.  Some steps can be combined into other steps with little
risk, especially with practice (the sum
and additive and multiplicative constant rules come to mind).
However, the quotient, product, power, trigonometric, and
all forms  of the chain rule should be written out
in their own steps {\it before} we compute the derivatives
internal to these rules.  For instance,
it is tempting to compute all at once:
\begin{multline*}
\frac{d}{dx}\left[(x^3+9x^2+\sin 2x)(\tan x^5)\right]
\\ =(x^3+9x^2+\sin2 x)(\sec^2x^5\cdot5x^4)
+\tan x^5\cdot(3x^2+18x+\cos2 x\cdot2).\end{multline*}
However, this approach has a couple of disadvantages
which become more important as functions become
increasingly complicated.  First, we have to
keep track of what rule applies where, without the
benefit of breaking it into steps.  Second,
if we would like to check our work we can try to
re-read what we wrote, but we find ourselves again
performing the same mental gymnastics we did the first
time, and likely repeating any mistakes we made that first time.
We can go a long way towards avoiding
these difficulties by writing out all the steps.
Since each step invokes a single differentiation rule
(though we may apply different rules to different terms
in the same ``step''), much of our work is recopying the
line above, which takes very little time.  Care in
``bookkeeping'' will translate into clearer thinking
and less error (and easier error correction!).  Consider
the following approach to the problem above:
\bigskip

$\ds{\frac{d}{dx}\left[(x^3+9x^2+\sin x)(\tan x^5)\right]
}$
\begin{align*}
{}&=\left(x^3+9x^2+\sin2x\right)\frac{d}{dx}\left(
       \tan x^5\right)+\left(\tan x^5\right)
       \cdot\frac{d}{dx}\left(x^3+9x^2+\sin2x\right)\\
&=\left(x^3+9x^2+\sin2x\right)\sec^2x^5\cdot\frac{d\,x^5}{dx}
+\tan x^5\cdot\left(3x^2+18x+\cos2x\cdot\frac{d(2x)}{dx}\right)\\
&=(x^3+9x^2+\sin2 x)(\sec^2x^5\cdot5x^4)
+\tan x^5\cdot(3x^2+18x+\cos2x\cdot 2)\\
&=5x^4(x^3+9x^2+\sin2x)\sec^2x^5+(3x^2+18x+2\cos2x)\tan x^5.
\end{align*}

Ultimately this given function is a product, so
the first step was exactly the statement of the product rule.
In the next line, we begin to take the derivatives
demanded within the product rule, and find some power rules
(with the multiplicative constants along for the ride---i.e.,
with the rule that multiplicative constants are preserved),
and a couple of chain rules which we write out exactly.
Next we compute the derivatives of the ``inside''
functions demanded  by the chain rule, and finally we
do some algebra to make the result more presentable.
Note how we can re-read this with great assurance that it
is correct, since each step follows differentiation rules
in obvious (though the terms themselves may be complicated)
ways.

In the examples which
follow we will continue to write out all the steps, while
being careful to invoke them in the proper order.
In effect, we work from the outside (large-structure)
inwards.

\bex
Find $f'(x)$ if $\ds{f(x)=2\sin^3 5x+\csc\sqrt{x^2+1}}$

\noindent
This is first a sum, and then there are several chain rules
which come into play.
\begin{align*}
f'(x)&=\frac{d}{dx}\left(2\sin^35x\right)
+\frac{d}{dx}\left(\csc\sqrt{x^2+1}\right)\\
&=2\frac{d}{dx}\sin^35x+\left(-\csc\sqrt{x^2+1}
\cot\sqrt{x^2+1}\cdot\frac{d\,\sqrt{x^2+1}}
{dx}\right)\\
&=2\cdot3\sin^25x\cdot\frac{d\sin5x}{dx}
-\csc\sqrt{x^2+1}\cot\sqrt{x^2+1}\cdot
\frac1{2\sqrt{x^2+1}}\frac{d(x^2+1)}{dx}\\
&=6\sin^25x\cos5x\cdot\frac{d(5x)}{dx}
-\frac{\csc\sqrt{x^2+1}\cot\sqrt{x^2+1}}{2\sqrt{x^2+1}}\cdot2x\\
&=6\sin^25x\cos5x\cdot5-\frac{x\csc\sqrt{x^2+1}\cot\sqrt{x^2+1}}
{\sqrt{x^2+1}}\\
&=30\sin^25x\cos5x-\frac{x\csc\sqrt{x^2+1}\cot\sqrt{x^2+1}}
{\sqrt{x^2+1}}.\end{align*}
\eex
\bex Find $f'(x)$ if $\ds{f(x)=\sin^3\left(x^2\tan x\right)}$.

\noindent This is first a power and chain rule problem,
since $\ds{f(x)=\left[\sin\left(x^2\tan x\right)\right]^3}$.
After a second, trigonometric chain rule we will have a product rule.
It is not necessary to notice all this structure from the beginning;
it all becomes apparent as we dissect the
function, applying
the appropriate differentiation rules as we go:
\begin{align*}
f'(x)&=3\left[\sin\left(x^2\tan x\right)\right]^2
\cdot\frac{d}{dx}\left[\sin\left(x^2\tan x\right)\right]\\
&=3\sin^2\left(x^2\tan x\right)\cdot\cos(x^2\tan x)\cdot
\frac{d}{dx}\left(x^2\tan x\right)\\
&=3\sin^2\left(x^2\tan x\right)\cos(x^2\tan x)
\cdot\left(x^2\frac{d\,\tan x}{dx}+\tan x\cdot\frac{d\,x^2}{dx}\right)
\\
&=3\sin^2\left(x^2\tan x\right)\cos\left(x^2\tan x\right)
\cdot\left(x^2\sec^2x+\tan x\cdot 2x\right)\\
&=3\left(x^2\sec^2x+2x\tan x\right)
\sin^2\left(x^2\tan x\right)\cos\left(x^2\tan x\right).
\end{align*}
\eex

In some cases it is best to simplify algebraically
before applying differentiation rules.  For an obvious
illustration of this,
consider the following.
\bex Here we compute $\ds{\frac{d}{dz}\left[\frac{1+\ds{\frac{z+1}{z-1}}}
{1-\ds{\frac{z+1}{z-1}}}
\right].}$
A method of brute force would be to perform the quotient rule
and continue from there:

\qquad$\ds{=\frac{\left(1-\frac{z+1}{z-1}\right)\frac{d}{dz}
\left(1+\frac{z+1}{z-1}\right)-\left(1+\frac{z+1}{z-1}\right)
\frac{d}{dz}\left(1-\frac{z+1}{z-1}\right)}{\left(1-
\frac{z+1}{z-1}\right)^2}}$,

\noindent from which we need to compute two more quotient
rules.  However, if we instead simplify the function
from the beginning, our work is greatly simplified too:

$$
=\frac{d}{dz}\left[\frac{1+\ds{\frac{z+1}{z-1}}}{1-\ds{\frac{z+1}{z-1}}}
\cdot\frac{z-1}{z-1}\right]
=\frac{d}{dz}\left[\frac{z-1+(z+1)}{z-1-(z+1)}  \right]
=\frac{d}{dz}\left[\frac{2z}{-2}\right]=\frac{d}{dz}(-z)=-1.
$$\eex
In applications especially, we are often led to
complicated expressions for functions, for which
we then need to find the derivatives.  It is always better
to look out for such cases in which algebraic simplification
from the beginning will simplify our calculus tasks,
as well as give us a look at a simpler form of the original
function.  As complicated as the above function first
appeared, it was simply the function $-z$ (where both
original and simplified are both defined, which for this
problem means $z\ne1$).

\begin{center}\underline{\Large{\bf Exercises}}\end{center}
\bigskip
\begin{multicols}{2}
\begin{enumerate}
\item For each of the following functions,
      compute the derivatives two different ways:
      \begin{enumerate}[(i)]
        \item  by using the rule called upon by
               the way the function is originally written; and
        \item  by first simplifying the function, and then
               computing the derivative of the simplified function
               in the obvious way (using already established
               derivative formulas).
        \item Show that the answers are the same.
      \end{enumerate}
      For instance, in (a), first use the product rule, and then
      compute $\frac{d}{dx}(x^4)$ with the power rule, and show the
      answers are the same (e.g., both $4x^3$ for this case).
  \begin{enumerate}
  \item $\ds{\frac{d}{dx}\left[x^2\cdot x^2\right]}$
  \item $\ds{\frac{d}{dx}\left[\frac{x^9}{x^3}\right]}$
  \item $\ds{\frac{d}{dx}\left[\cos x\sec x\right]}$
  \item $\ds{\frac{d}{dx}\left[\cos x\tan x\right]}$
  \item $\ds{\frac{d}{dx}\left[\frac1{\cos x}\right]}$
  \item $\ds{\frac{d}{dx}\left[\tan x\cot x\right]}$
  \item $\ds{\frac{d}{dx}\left[\sin x\sec x\right]}$
  \item $\ds{\frac{d}{dx}\left[\frac{1}{\sin x}\right]}$
  \end{enumerate}
\item Compute the following derivatives.
  \begin{enumerate}
  \item $\ds{\frac{d}{dx}\left[\tan^2x\right]}$
  \item $\ds{\frac{d}{dx}\left[\frac{x^2+1}{\sin x-1}\right]}$
  \item $\ds{\frac{d}{dx}\left[\sqrt{1-\csc 2x}\right]}$
  \item $\ds{\frac{d}{dx}\left[x\sin x\cos x\right]}$
  \item $\ds{\frac{d}{dx}\left[\frac{x^3-7x+5}{x^2-3}\right]}$
  \item $\ds{\frac{d}{dx}\left[\frac{1+\frac1{x+1}}{1-\frac1{x-1}}\right]}$
  \item $\ds{\frac{d}{dx}\left[\sin^2x\cos^3x\right]}$
  \item $\ds{\frac{d}{dx}\left[\sec3x\cot5x\right]}$
  \item $\ds{\frac{d}{dx}\left[\frac{x}{\sqrt{x^2+1}}\right]}$
  \item $\ds{\frac{d}{dx}\left[\frac{(x+5)^3}{(x-4)^5}\right]}$.
        Factor the numerator in your answer
        to simplify.
  \item $\ds{\frac{d}{dx}\left[3\cot^29x-\sqrt{\cos6x+1}\right]}$
  \item $\ds{\frac{d}{dx}\left[\tan(x+\tan(x+\tan x))\right]}$

  \end{enumerate}

\item Show that $\frac{d}{dx}[f(x)g(x)h(x)]
=f(x)g(x)h'(x)+f(x)g'(x)h(x)+f'(x)g(x)h(x)$.
What do you think will be the derivative
of $f(x)g(x)h(x)i(x)$?
\end{enumerate}
\end{multicols}

\newpage
\section{Chain Rule II: Implicit Differentiation
\label{ImplicitDifferentiationSection}}
In this section we will apply the chain rule in a
setting of so-called {\it implicit functions},
which are more general than the {\it explicit functions}
we have dealt with so far.  In the next section we
will use the chain rule in still a third context,
{\it related rates}.

In this section we first consider a brief summary and re-examination of
all differentiation rules, including the chain rule.
We then perform some simple differentiation problems
which are of the type typically encountered in a first study
of implicit functions.  We then proceed to the topic of this section,
which is finding the slope, $dy/dx$, for curves which are not
necessarily functions in the purest sense, but which are functions
locally, and anyway for which it is reasonable to ask about
slope.

\subsection{Review of Differentiation Rules}
At this point we have many differentiation rules.
If we look at all the rules so far, {\it except for the
chain rule}, they can be summed up as follows.  First
we had the very general rules, regardless of $f(x)$
and $g(x)$, and {\it fixed constants} $C\in\Re$
 as long as the expressions on the right
existed:
\begin{multicols}{2}
\begin{itemize}
\item $\ds{\frac{d\left[Cf(x)\right]}{dx}=C\cdot\frac{df(x)}{dx}}$
\item $\ds{\frac{d[f(x)+g(x)]}{dx}=\frac{df(x)}{dx}+\frac{dg(x)}{dx}}$
\item $\ds{\frac{d[f(x)\cdot g(x)]}{dx}=f(x)\cdot\frac{dg(x)}{dx}
                             +g(x)\cdot\frac{df(x)}{dx}}$
\item $\ds{\frac{d}{dx}\left[\frac{f(x)}{g(x)}\right]
    =\frac{g(x)\cdot\frac{df(x)}{dx}-f(x)\cdot\frac{dg(x)}{dx}}{[g(x)]^2}}$
\item $\ds{\frac{d\,C}{dx}=0}$
\bigskip

\end{itemize}\end{multicols}
Then we had rules for specific functions, and their chain rule
versions:\footnote{%
%%% FOOTNOTE
The formulas in the right column assume that $u$ is a function of $x$,
but in fact if that is not the case,  that is if $u$ is not a function
of $x$, then both sides of those equations do not make sense.  It
is therefore customary to proceed to write these formulas
because a problem in the left-hand side will manifest
in the right-hand side of each equation in the right column above.
\label{WhatIfUNotAFunctionOfX}}
%%% END FOOTNOTE

\begin{multicols}{2}
\begin{itemize}
\item ${\frac{d}{dx}\left[x^n\right]=n\cdot x^{n-1}}$
\item ${\frac{d}{dx}\sin x=\cos x}$
\item ${\frac{d}{dx}\cos x=-\sin x}$
\item ${\frac{d}{dx}\tan x=\sec^2x}$
\item ${\frac{d}{dx}\cot x=-\csc^2x}$
\item ${\frac{d}{dx}\sec x=\sec x\tan x}$
\item ${\frac{d}{dx}\csc x=-\csc x\cot x}$
\item ${\frac{d}{dx}\sqrt{x}=\frac1{2\sqrt{x}}}$
\item ${\frac{d}{dx}\left[\frac1x\right]=\frac{-1}{x^2}}$
\item ${\frac{d}{dx}\left[u^n\right]=n\cdot u^{n-1}\cdot\frac{du}{dx}}$
\item ${\frac{d}{dx}\sin u=\cos u\cdot\frac{du}{dx}}$
\item ${\frac{d}{dx}\cos u=-\sin u\cdot\frac{du}{dx}}$
\item ${\frac{d}{dx}\tan u=\sec^2u\cdot\frac{du}{dx}}$
\item ${\frac{d}{dx}\cot u=-\csc^2u\cdot\frac{du}{dx}}$
\item ${\frac{d}{dx}\sec u=\sec u\tan u\cdot\frac{du}{dx}}$
\item ${\frac{d}{dx}\csc u=-\csc u\cot u\cdot\frac{du}{dx}}$
\item ${\frac{d}{dx}\sqrt{u}=\frac1{2\sqrt{u}}\cdot\frac{du}{dx}}$
\item ${\frac{d}{dx}\left[\frac1u\right]=\frac{-1}{u^2}\cdot\frac{du}{dx}}$

\end{itemize}
\end{multicols}
(Note that the bottom four rules were just special cases of the power rules.)

While we will not venture here to reinvent the discussion of the
previous section, we will at least notice that when  the variable
of differentiation matches the argument of the function,
we can use the simple derivative rules for that particular function,
and when they do not, we multiply by the derivative of that variable
with respect to the variable of differentiation:
\begin{align}
&\frac{d f(x)}{dx}=f'(x),\\
&\frac{d f(u)}{dx}=f'(u)\cdot\frac{du}{dx}.\label{(F(U))'=F'(U)U'}
\end{align}
For one example of (\ref{(F(U))'=F'(U)U'}), justified with
Leibniz notation, we
had $f(x)=\sin x$ and $u=u(x)$ yielding the following:
$$\frac{d\,\sin u}{dx}=\frac{d\,\sin u}{du}\cdot\frac{du}{dx}=\cos u\cdot
\frac{du}{dx}.$$
The decomposition in the middle step
allowed us to use the sine derivative formula
because the variable in the sine---$u$---matched the
differential operator $\frac{d}{du}$ that appeared in the first term
of the Leibniz-style decomposition.  Writing that step will
become more burdensome as the argument of sine is more complicated,
so we will skip that step in most future computations.

%Sometimes we have several variables (or functions of several variables),
%which are each functions of a single variable.  For instance,
%suppose we are in an $(x,y)$-coordinate plane and our position
%is changing with respect to time $t$.  Then the distance
%from the origin is given as $D=\sqrt{x^2+y^2}$, and itself
%is changing with respect to time.  Thus
%$$\frac{dD}{dt}=\frac{d}{dt}\sqrt{x^2+y^2}
%=\underbrace{\frac1{2\sqrt{x^2+y^2}}}_{\ds{\frac{d\sqrt{x^2+y^2}}{d(x^2+y^2)}}}
%\quad\cdot\underbrace{\frac{d}{dt}\left(x^2+y^2\right).
%\vphantom{\frac1{2\sqrt{x^2+y^2}}}}_{\ds{\cdot
%\quad\quad\frac{d(x^2+y^2)}{dt}\qquad}}$$
%That is simply the chain rule (applied to the power rule).
%The first ``inner variable'' is $x^2+y^2$, which is in turn
%a function of $t$.
%To complete the differentiation, we would write
%\begin{align*}\frac{dD}{dt}&=\frac{d}{dt}\sqrt{x^2+y^2}\\
%&=\frac1{2\sqrt{x^2+y^2}}\cdot\frac{d}{dt}\left(x^2+y^2\right)\\
%&=\frac1{2\sqrt{x^2+y^2}}\left(\frac{d(x^2)}{dt}+\frac{d(y^2)}{dt}\right)\\
%&=\frac1{2\sqrt{x^2+y^2}}\left(2x\frac{dx}{dt}+2y\frac{dy}{dt}\right)
%=\frac{2\left(x\frac{dx}{dt}+y\frac{dy}{dt}\right)}{2\sqrt{x^2+y^2}}
%=\frac{x\frac{dx}{dt}+y\frac{dy}{dt}}{\sqrt{x^2+y^2}}.
%\end{align*}
%In this section, we will be more interested in situations in
%which $y$ is a function of $x$. Examples of the simplest
%computations we will need are given next:

For a few slightly  more complicated examples,
consider the following, noting that the previous
rules still apply if we assume that $y$ is a function of $x$
(see  Footnote~\ref{WhatIfUNotAFunctionOfX}
for the case $y$ is not):
\bex Consider the following three derivative computations.
\begin{itemize}
\item $\ds{\frac{d}{dx}(y^2)=2y\cdot\frac{dy}{dx}}$.
\item $\ds{\frac{d}{dx}\sqrt{y}=\frac1{2\sqrt{y}}\cdot\frac{dy}{dx}}$.
\item $\ds{\frac{d}{dx}(y\sin y)=y\cdot\frac{d(\sin y)}{dx}+\sin y\cdot
                       \frac{d(y)}{dx}=y\cdot\cos y\cdot\frac{dy}{dx}
                       +\sin y\cdot\frac{dy}{dx}}$.
\end{itemize}
\eex
Notice that the last example required first the product rule,
and so the first step was to  write---exactly---the statement
of the product rule, where the product is $y\sin y$.
This is ultimately a product of two functions of $x$, since
we are assuming $y$ is a function of $x$, and thus $\sin y$
is also a (composite) function of $x$.
As with earlier derivatives, it is crucial to write out
{\it precisely} what the general rules dictate.  This becomes
even more critical in the following.
\bex Consider the following derivative computations:
\begin{itemize}
\item $\ds{\frac{d}{dx}(xy^2)=x\,\frac{dy^2}{dx}+y^2\,\frac{dx}{dx}
                   =x\cdot2y\,\frac{dy}{dx}+y^2(1)=2xy\,\frac{dy}{dx}+y^2}$,
\item $\ds{\frac{d}{dx}(x^2+y^2)^2=2(x^2+y^2)^1\frac{d}{dx}(x^2+y^2)
          =2\left(x^2+y^2\right)\left(2x+2y\cdot\frac{dy}{dx}\right)}$\newline
      \hphantom{$\ds{\frac{d}{dx}(x^2+y^2)^2}$}
         $\ds{=4\left(x^2+y^2\right)\left(x+y\,\frac{dy}{dx}\right)}$.
\end{itemize}
\eex
Notice that we skipped an explicit writing of
the  ``sum rule'' step in the second computation above:
$$\frac{d}{dx}\left(x^2+y^2\right)
  =\frac{d}{dx}\left(x^2\right)+\frac{d}{dx}\left(y^2\right)
  =2x+2y\cdot\frac{dy}{dx}.$$
The first term, $\frac{d}{dx}(x^2)$ was a simple power rule
because the variables matched.\footnote{%
%%% FOOTNOTE
We can write ${\frac{d\left(x^2\right)}{dx}
=2x\cdot\frac{dx}{dx}}$ but then, of course,
``inner function's'' derivative is just ${\frac{dx}{dx}}=1$.
%%%% END FOOTNOTE
}  For the second term they
do not match, so we need the chain rule to compute
$\frac{d}{dx}(y^2)=2y\,\frac{dy}{dx}$.\footnote{%
%%%%%%%%%%% FOOTNOTE
One usually does not continue to write, for example,
$$\frac{d}{dx}\left(y^2\right)=\frac{d\,y^2}{dy}\cdot\frac{dy}{dx}
=2y\cdot\frac{dy}{dx},$$
but skips the explicit decomposition step in the middle.
We repeat it occasionally just as a reminder of the computational
reasonableness of the chain rule, best illustrated with Leibniz notation
as above.}
%%%%%%%%%%% END FOOTNOTE
 Notice also that in the first computation
we used the fact that $\frac{dx}{dx}=1$, which is reasonable on its
face, but technically describes the fact that the function $f(x)=x$
is a line with slope 1, i.e., $f'(x)=1$, regardless of $x$.\footnote{
%%%%%%%%%% FOOTNOTE
Of course $\frac{dx}{dx}=1$ also follows from the power rule, loosely
interpreted: $\frac{d}{dx}(x^1)=1x^0$, which seems to
give 1, though technically $x^0=1$ only for $x>0$ (for reasons
we will see later in the text). Still, in this case
the ``formal answer'' $x^0=1$, that is, 1, is in fact the correct answer
for $\frac{d(x^1)}{dx}$. }
%%%%%%%%%% END FOOTNOTE
\bex Consider the following derivative computation:
\begin{align*}
\frac{d}{dx}\sin xy&=\cos xy\cdot\frac{d(xy)}{dx}\\
    &=\cos xy\cdot\left(x\frac{dy}{dx}+y\frac{dx}{dx}\right)\\
    &=\cos xy\cdot\left(x\frac{dy}{dx}+y\right)\\
    &=x\cos xy\,\frac{dy}{dx}+y\cos xy.\end{align*}
\eex
The above example used the chain rule first, and then
the product rule.  The first step could have been
written
\begin{equation}
\frac{d\sin xy}{dx}=\frac{d\sin xy}{d(xy)}\cdot\frac{d(xy)}{dx}.
\label{dsinxy/dx}\end{equation}
Of course it is important to note that, in the Leibniz notation,
$d(xy)$ is taken to be one, encapsulated quantity.
It is {\it not} a multiplication of three quantities,
so for instance $d(xy)/dx\ne y$.
Indeed, $d(xy)/dx=x\cdot(dy/dx) + y\cdot (dx/dx)=
x\cdot (dy/dx)+y$ by the product rule.  However the
chain rule {\it does} allow for the apparent
division and multiplication by $d(xy)$ in the
derivative notation in (\ref{dsinxy/dx}) above.

Two more points should be emphasized regarding the
product rule computation above, which we repeat here:
\begin{equation}
\frac{d(xy)}{dx}=x\,\frac{dy}{dx}+y\,\frac{dx}{dx}.\label{ProductRuleForXY}
\end{equation}
First, note that (\ref{ProductRuleForXY}) is {\it exactly what the
product rule says} for this product $xy$.  Thus it should be
established true from the explicit result of the product rule.
Next, when computing $\frac{d}{dx}(y)$, we get exactly what we would
from the chain rule, or from the power rule.  Thinking of $y$
as a function ``raised to the power 1,'' we might write:
\begin{equation}\frac{d(y)}{dx}=\frac{d(y)}{dy}\cdot\frac{dy}{dx}
=1\cdot\frac{dy}{dx}=\frac{dy}{dx}.\label{LeibnizDY/DX=DY/DX}
\end{equation}
Thus once again the derivative rules are self-consistent,
as is Leibniz notation, properly interpreted.

\newpage\subsection{Implicit Functions and Their Derivatives}
In previous sections we were interested in functions
$y=f(x)$, i.e., where $y$ was given {\it explicitly}
as a function of $x$.  However, there are relationships and
graphs of interest where $y$ is related to $x$ {\it implicitly},
for instance, by an equation which contains
both $y$ and $x$ as variables, except that
$y$ is not solved for as an explicit function of $x$.
Indeed, the graph of the equation
(i.e., the graph of all $(x,y)$ which satisfy
the equation) might not represent a function
at all.  However, it is quite possible for
$y$ to be a function of $x$ {\it locally} near
a point $(x_0,y_0)$ on the graph, and to speak of ``slope'' there.

\begin{definition}
We will say $y$ is {\bf locally} (or {\bf implicitly}) a function of $x$
near $(x_0,y_0)$ if and only if there exists
$\delta,\epsilon>0$ and an open rectangle
$$\left\{(x,y)\,\left.\vphantom{M_M^M}\right|
\, \left(|x-x_0|<\delta\right)\wedge\left(|y-y_0|<\epsilon\right)\right\}$$
such that, within that open rectangle, the
graph represents $y$ as a function
%\footnotemark
of $x$.
\end{definition}
%\footnotetext{By function here we mean, as before, it passes
%the vertical line test, i.e., any vertical line
%intersects the graph in at most one point inside the
%open rectangle.}
A simple example is a circle such as $x^2+y^2=25$.
Except at $(5,0)$ and $(-5,0)$, we can find a small
enough, open rectangle around each point $(x_0,y_0)$ on
the graph so that $y$ is a function of $x$
{\it inside that rectangle}.  Note that it is not necessary
that any vertical line touch the graph inside the rectangle,
but if it
does touch the graph inside the rectangle it can only do so
at one point.

\begin{figure}

\begin{center}
\begin{pspicture}(-4,-4)(4,4)
\psset{xunit=.7cm,yunit=.7cm}

\psframe[linestyle=dashed,%
fillstyle=solid,fillcolor=lightgray](2.5,3.5)(3.5,4.5)
\pscircle[fillstyle=solid,fillcolor=black](3,4){.1}

\psframe[linestyle=dashed,%
fillstyle=solid,fillcolor=lightgray](-1,4.5)(1,5.5)
\pscircle[fillstyle=solid,fillcolor=black](0,5){.1}

\psframe[linestyle=dashed,%
fillstyle=solid,fillcolor=lightgray](-4.8,2.5)(-3.2,3.5)
\pscircle[fillstyle=solid,fillcolor=black](-4,3){.1}

\psaxes{<->}(0,0)(-6,-6)(6,6)

\pscircle[fillstyle=solid,fillcolor=black](0,5){.1}

\psframe[linestyle=dashed,%
fillstyle=solid,fillcolor=lightgray](.1,-5.8989795)(1.9,-3.8989795)
\pscircle[fillstyle=solid,fillcolor=black](1,-4.8989795){.1}

\psframe[linestyle=dashed,%
fillstyle=solid,fillcolor=lightgray](-2.55,-3.05)(-4.55,-4.05)
\pscircle[fillstyle=solid,fillcolor=black](-3.55,-3.55){.1}

\pscircle(0,0){3.5}

\end{pspicture}

\end{center}
\caption{The graph of $x^2+y^2=25$ gives $y$ as a
function of $x$ locally except
at $(-5,0)$ and $(5,0)$.  Some possible open rectangles
centered at various $(x_0,y_0)$ on the graph are drawn,
within each of which (separately) $y$ is a function of $x$.}
\label{CircleForImplicitDifferentiation}\end{figure}

Now suppose we would like to find the slope of
the graph of $x^2+y^2=25$, without solving for $y$
first.\footnotemark\footnotetext{For this one we can
solve for $y$, almost: $\ds{y=\pm\sqrt{25-x^2}}$.
For many curves we
cannot.  Even if we can, it is sometimes easier to
use the equation as it stands.}\hphantom{. }
If we are at a point $(x_0,y_0)$ satisfying the
equation $x^2+y^2=25$, and for which
we can (in principle) find an open rectangle
centered at $(x_0,y_0)$ in which $y=y(x)$,
i.e., in which $y$  is a function of $x$,
then {\it inside such a rectangle},
we have that $y^2=(y(x))^2$ is a (composite) function
of $x$, and $x^2+y^2$ is therefore also a  function of $x$.
Furthermore, $25$ is a (rather trivial) function of $x$ and,
inside the rectangles,
$x^2+y^2$ and $25$ are  in fact the {\it same} function of $x$:
$$\underbrace{x^2+y^2}_{{\begin{array}{c}\text{function of }x\\
\text{ in each rectangle}\end{array}}}
=\underbrace{25.}_{\begin{array}{c}\text{same function of }x\\
\text{in the rectangles}\end{array}}$$
Because these are the same functions of $x$ in an open rectangle, they
have the same derivatives with respect to  $x$ there.  Thus we can state
\begin{equation}
\frac{d}{dx}\left(x^2+y^2\right)=\frac{d}{dx}\left(
\vphantom{x^2}25\right).\label{DerivCircRad5Step1}\end{equation}
Now suppose that we are in a rectangle in which $y$ is
a function of $x$.  In the above we are taking
the derivative with respect to $x$.  The first
term is a simple power rule, but the second is a
chain rule version of the power rule since the
variables do not match, while the other side of the equation
is a constant.  Thus, (\ref{DerivCircRad5Step1}) becomes
$${2x}+{2y\,\frac{dy}{dx}}={0}.$$
It is $\frac{dy}{dx}$ that we want, i.e., the slope
on the original curve.  Fortunately  we can now solve for it:
\begin{alignat*}{2}
&&2x+2y\,\frac{dy}{dx}&=0\\
&\iff&2y\,\frac{dy}{dx}&=-2x\\
&\iff&\frac{dy}{dx}&=\frac{-2x}{2y}=-\frac{x}y.\end{alignat*}
Some more notation is now needed for when we wish to
evaluate this at particular points on the curve.
The value of $\frac{dy}{dx}$ at such $(x_0,y_0)$ on the curve is
written
$$\left.\frac{dy}{dx}\right|_{(x_0,y_0)}.$$
Out loud, this is said, ``$\frac{dy}{dx}$ evaluated at
$\left(x_0,y_0\right)$.''
Looking back at the circle, we can find the slopes
at any $(x_0,y_0)$ which is on the graph:
\begin{align*}
\left.\frac{dy}{dx}\right|_{(3,4)}&=
\left.-\frac{x}y\right|_{(3,4)}=-\frac34,\\
\left.\frac{dy}{dx}\right|_{(0,5)}
&=\left.-\frac{x}{y}\right|_{(0,5)}=-\frac05=0,\\
\left.\frac{dy}{dx}\right|_{(-4,3)}
&=\left.-\frac{x}{y}\right|_{(-4,3)}=-\frac{-4}3=\frac43,
\qquad\text{etc.}\end{align*}
A quick check of the graph in Figure~\ref{CircleForImplicitDifferentiation}
shows that these slope calculations ring true.  In fact,
it is interesting to notice what happens if we attempt to evaluate
$\left.\frac{dy}{dx}\right|_{(5,0)}$. If we naively
insert $(5,0)$ into $\frac{dy}{dx}=-\frac{x}y$, we
would get $-\frac50$, which is undefined.  Thus the
derivative there does not exist, which is born out
by the graph in the sense that there is no
defined slope there. (Note that in the Euclidean geometry sense the
tangent to the circle is a vertical line there.)
Similarly for $(-5,0)$.

We might also be interested in the equation of a tangent line.
For instance, at $(x,y)=(-4,3)$, we have the slope
$$\left.\frac{dy}{dx}\right|_{(-4,3)}=\left.\frac{-x}{y}\right|_{(-4,3)}
  =\frac{-(-4)}{3}=4/3,$$
and so with the point $(-4,3)$ we have the line $y=3+\frac43(x+4)$.
Note that the point $(-4,3)$ is one of the points illustrated as
the center of an open box in Figure~\ref{CircleForImplicitDifferentiation},
and a glance at the point in question shows this to be a reasonable
slope and tangent line there.

Now the circle example above need not use this {\it implicit differentiation}
technique, that is finding $dy/dx$ from an implicit curve where $y$ is not
an explicit function of $x$.  We need not use the technique because
near any such $(x_0,y_0)$ on the curve, we can write $y$ as an
{\it explicit} function of $x$ and compute the derivative.
On the upper semi-circle we have $y=\sqrt{25-x^2}$, and so
$$\frac{dy}{dx}=\frac{d}{dx}\sqrt{25-x^2}
   =\frac1{2\sqrt{25-x^2}}\,\frac{d\left(25-x^2\right)}{dx}
   =\frac{-2x}{2\sqrt{25-x^2}}=\frac{-x}{\sqrt{25-x^2}}.$$
Notice that (on the upper semicircle)
this is the same as the derivative acquired through implicit
differentiation:
$$\frac{dy}{dx}=\frac{-x}{\sqrt{25-x^2}}=\frac{-x}y.$$
A similar analysis shows that on the lower semicircle we also get
two equivalent forms of the derivative:
$$\frac{dy}{dx}=\frac{d}{dx}\left[-\sqrt{25-x^2}\right]=\cdots
    =\frac{x}{\sqrt{25-x^2}}
    =\frac{x}{-y}.$$
Now we consider other examples where it is not clearly possible
to solve for $y$ as an explicit function of $x$.

\bex Consider the curve $\ds{(x^2+y^2)^{3/2}=2xy}$, which is graphed
in Figure~\ref{GraphForExampleWhichIsAlmostR=Sin2Theta},
page~\pageref{GraphForExampleWhichIsAlmostR=Sin2Theta}.  (Much later
in the text we will see how this graph came about.)
First we find $\frac{dy}{dx}$ by applying the differential
operator $\frac{d}{dx}$ to both sides:
\begin{alignat*}{2}
&\qquad&(x^2+y^2)^{3/2}&=2xy\\
&\implies&\frac{d}{dx}\left[(x^2+y^2)^{3/2}\right]&
                   =\frac{d}{dx}\left[2xy\right]\\
&\implies&\frac32(x^2+y^2)^{1/2}\cdot\frac{d}{dx}(x^2+y^2)&=
    2\left[x\frac{dy}{dx}+y\frac{dx}{dx}\right]\\
&\implies&\frac32(x^2+y^2)^{1/2}\cdot\left(2x+2y\,\frac{dy}{dx}\right)
                  &=2\left(x\,\frac{dy}{dx}+y\cdot1\right)\\
&\implies&\qquad\frac32(x^2+y^2)^{1/2}(2x)+\frac32(x^2+y^2)^{1/2}
                                          \left(2y\,\frac{dy}{dx}\right)
                  &=2x\,\frac{dy}{dx}+2y\\
&\implies &3x\sqrt{x^2+y^2}+3y\sqrt{x^2+y^2}\cdot\frac{dy}{dx}&
          =2x\,\frac{dy}{dx}+2y\\
&\implies&3y\sqrt{x^2+y^2}\cdot\frac{dy}{dx}-2x\,\frac{dy}{dx}&
           =2y-3x\sqrt{x^2+y^2}\\
&\implies&\left[3y\sqrt{x^2+y^2}-2x\right]\frac{dy}{dx}&=2y-3x\sqrt{x^2+y^2}\\
&\implies&\frac{dy}{dx}&=\frac{2y-3x\sqrt{x^2+y^2}}{3y\sqrt{x^2+y^2}-2x}.
\end{alignat*}

Now we will compute the slope for two points on the curve,
$\left(\frac1{\sqrt2},\frac1{\sqrt2}\right)$ and
$\left(\frac34,\frac{\sqrt{3}}4\right)$, which are labeled
in Figure~\ref{GraphForExampleWhichIsAlmostR=Sin2Theta},
page~\pageref{GraphForExampleWhichIsAlmostR=Sin2Theta}.
(The reader should verify that these points are actually on
the original curve.)
\begin{itemize}
\item $\ds{\left.\frac{dy}{dx}
       \right|_{\left(\frac1{\sqrt2},\frac1{\sqrt2}\right)}
  =\left.\frac{2y-3x\sqrt{x^2+y^2}}{3y\sqrt{x^2+y^2}-2x}
  \right|_{\left(\frac1{\sqrt2},\frac1{\sqrt2}\right)}
  =\frac{2\cdot\frac1{\sqrt2}-3\cdot\frac1{\sqrt2}
          \sqrt{\left(\frac{1}{\sqrt2}\right)^2
               +\left(\frac{1}{\sqrt2}\right)^2}}
         {3\cdot\frac1{\sqrt2}\sqrt{\left(\frac{1}{\sqrt2}\right)^2
               +\left(\frac{1}{\sqrt2}\right)^2}-2\cdot\frac1{\sqrt2}}}$

\qquad$\ds{=\frac{\sqrt2-\frac{3}{\sqrt2}\cdot1}{\frac3{\sqrt2}\cdot1-\sqrt2}
           =-\frac{\left(\frac3{\sqrt2}-\sqrt2\right)}
                  {\frac3{\sqrt2}-\sqrt2}=-1}$.

This should seem reasonable given the position of this point on the graph.
 For the computation of $\frac{dy}{dx}$ at
$\left(\frac34,\frac{\sqrt{3}}4\right)$ we will
be more brief.
\item $\ds{\left.\frac{dy}{dx}
       \right|_{\left(\frac34,\frac{\sqrt{3}}4\right)}
     =\frac{2\cdot\frac{\sqrt3}4-3\cdot\frac34\sqrt{\frac{12}{16}}}
           {3\cdot\frac{\sqrt{3}}4\sqrt{\frac{12}{16}}-2\cdot\frac34}
     =\frac{\frac{\sqrt3}{2}-\frac94\cdot\sqrt{\frac34}}
           {3\cdot\frac{\sqrt3}4\sqrt{\frac34}-\frac32}
     =\frac{\frac{\sqrt3}{2}-\frac94\cdot\frac{\sqrt3}2}
           {3\cdot\frac{\sqrt3}4\cdot\frac{\sqrt3}2-\frac32}\cdot\frac88
     =\frac{4\sqrt3-9\sqrt3}{9-12}}$

\qquad$\ds{=\frac{-5\sqrt3}{-3\sqrt3}=\frac53\sqrt3\approx2.88675135.}$

This should also seem reasonable from the graph in
Figure~\ref{GraphForExampleWhichIsAlmostR=Sin2Theta}.
\end{itemize}

\label{ExampleWhichIsAlmostR=Sin2Theta}
\eex

\begin{figure}
\begin{center}
\begin{pspicture}(-3,-3)(3,3)
\psset{xunit=2.3,yunit=2.3}
\psaxes{<->}(0,0)(-1.3,-1.3)(1.3,1.3)
\parametricplot{0}{90}{2 t mul sin t cos mul %
                        2 t mul sin t sin mul }
\parametricplot{180}{270}{2 t mul sin t cos mul %
                        2 t mul sin t sin mul }
\pscircle[fillstyle=solid,fillcolor=black](.75,.433){.07}
  \rput(1,.9){$\left(\frac1{\sqrt2},\frac1{\sqrt2}\right)$}
\pscircle[fillstyle=solid,fillcolor=black](.7071,.7071){.07}
  \rput(1.1,.4){$\left(\frac34,\frac{\sqrt3}4\right)$}

\end{pspicture}
\end{center}
\caption{Graph of $(x^2+y^2)^{3/2}=2xy$.
The slope $dy/dx$ at each point $(x,y)$ on the curve is
calculated in Example~\ref{ExampleWhichIsAlmostR=Sin2Theta}.
The points $(x,y)=\left(\frac1{\sqrt2},\frac1{\sqrt2}\right)$
and $(x,y)=\left(\frac34,\frac{\sqrt3}4\right)$ are plotted
as well, for which slopes were computed in that example.}
\label{GraphForExampleWhichIsAlmostR=Sin2Theta}
\end{figure}

The argument in the proof of the power rule
for rational powers of $x$,  Theorem~\ref{PowerRuleForRationalPowers}
on page \pageref{PowerRuleForRationalPowers},
used this implicit differentiation technique.  As in that proof,
we can compute $\frac{dy}{dx}$ without worrying about actually finding
the open rectangles which give $y$ locally as a function of $x$.
The rectangles are important in justifying the technique, but
if something goes wrong, it will usually show up in the final
form of the computed derivative.

%Before proceeding, we point again for emphasis
%that It should be pointed out that this implicit differentiation
%is in fact a simple extension of the chain rule
%(hence the title of this section).
%At times we find a function of $y$ inside these equations.
%According to the chain rule,
%\begin{equation}\frac{d\,f(y)}{dx}=f'(y)\cdot\frac{dy}{dx}.\end{equation}
%Now we present some further
%examples of this implicit differentiation technique.
%{(F(U))'=F'(U)U'}

%\bex Find $\frac{dy}{dx}$ on the curve
%$\sin x=\cos y$.
%Again we apply $\frac{d}{dx}$ to both sides.\footnotemark
%\footnotetext{Recall that this is possible wherever
%the graph gives $y$ locally as a function of $x$.
%Thus the left-hand side and right-hand side of $\sin x=\cos y$
%are the same functions of $x$, and therefore have the
%same derivative.}
%\begin{alignat*}{2}
%&&\sin x&=\cos y\\
%\implies&\qquad&\frac{d\,\sin x}{dx}&=\frac{d\, \cos y}{dx}\\
%\implies&&\cos x&=-\sin y \cdot\frac{dy}{dx}\\
%\implies&&-\frac{\cos x}{\sin y}&=\frac{dy}{dx}.\end{alignat*}
%(It is not important here that we do not have $\iff$.
%There are technical reasons, such as the fact that we can
%add any constant to the first line and still have the second.
%Since we are assuming the first line is true, so must be the last.)
%
%We can then also  talk about tangent lines to the curve
%(even if we cannot easily graph the equation).
%For instance, the point $(3\pi/4,\pi/4)$ is on the curve.
%The tangent line there is given by
%\begin{alignat*}{2}
%{}&{}&y-\frac{\pi}{4}&=\left.\frac{dy}{dx}\right|_{(3\pi/4,\pi/4)}
%\cdot\left(x-\frac{3\pi}{4}\right)\\
%&\iff&\qquad
%y-\frac{\pi}4&=-\frac{\cos\frac{3\pi}4}{\sin\frac{\pi}4}
%\left(x-\frac{3\pi}{4}\right)\\
%&\iff&\qquad y-\frac{\pi}4&=-\frac{-\frac1{\sqrt2}}{\frac1{\sqrt2}}
%\left(x-\frac{3\pi}{4}\right)\\
%&\iff&\qquad y-\frac{\pi}4&=x-\frac{3\pi}{4}\\
%&\iff&y&=x-\frac{\pi}2.
%\end{alignat*}
%\eex

\bex Find $\frac{dy}{dx}$ for the graph $\ds{5x+x^2+y^2+xy=\tan y}$.
\label{UglyImplicitDiffW/TanLine}
This one will require a couple chain rules
for the $y^2$ and $\tan y$ terms, and a product rule
for the $xy$ term.
As before, if we are careful in writing out the product rule
we are less likely to have errors.
\begin{alignat*}{2}
&&\frac{d}{dx}\left[5x+x^2+y^2+xy\right]&=\frac{d\,\tan y}{dx}\\
&\implies&5+2x+2y\cdot\frac{dy}{dx}
+\left[x\,\frac{dy}{dx}+y\,\frac{dx}{dx}\right]&=\sec^2y\cdot\frac{dy}{dx}\\
&\implies&5+2x+2y\,\cdot\frac{dy}{dx}+x\,\frac{dy}{dx}+y
&=\sec^2y\cdot\frac{dy}{dx}\\
&\implies&5+2x+y&=\sec^2y\,\frac{dy}{dx}-2y\,\frac{dy}{dx}-x\,\frac{dy}{dx}\\
&\implies&5+2x+y&=\left(\sec^2y-2y-x\right)\frac{dy}{dx}\\
&\implies&\frac{5+2x+y}{\sec^2y-2y-x}&=\frac{dy}{dx}.
\end{alignat*}
To find the tangent line through $(0,0)$, which is on the graph, we then
compute
$$\left.\frac{dy}{dx}\right|_{(0,0)}=\left.\frac{5+2x+y}{\sec^2y-2y-x}
  \right|_{(0,0)}=\frac{5+0+0}{1-0-0}=5,$$
and so the tangent line through $(0,0)$ has equation $y=5x$.
\eex
Though we do not have the tools to prove it here,
it is true that we
will always be able to solve for $\frac{dy}{dx}$
in these problems.  The basic idea of a proof is that
$\frac{dy}{dx}$ will always be a {\it factor} in the terms in which
it appears, and will only appear to the
first degree, so we are basically solving a {\it linear} equation in the
``variable'' $\frac{dy}{dx}$, albeit with nonconstant coefficients.
So in fact it is no different fundamentally than
solving $Ax+By+C=Dx+Ey+F$ for $y$ (or for $x$, for that matter).
One  moves all terms containing
that variable to one side, the other terms to the other side, factors
the variable from the side which then contains it, and divides by the other
factor.

Of course our implicit differentiation technique begins with calculus
steps and ends with algebra steps.  The entire process can be summarized by
four steps:

\begin{enumerate}[(1)]
\item complete all differentiation steps, flushing out all
terms with a factor $\frac{dy}{dx}$,
\item put all terms with $\frac{dy}{dx}$ factors on one side,
other terms on the other side of the equation,
\item factor the $\frac{dy}{dx}$ from the side which
contains it, and finally,
\item divide by the remaining factor, leaving $\frac{dy}{dx}$
on one side by itself.
\end{enumerate}

\bex Consider the equation $x=\sin y$.  The slope $\frac{dy}{dx}$
is then computed as follows:
\begin{alignat*}{2}
&\qquad\qquad&x&=\sin y\\
&\implies&\frac{d}{dx}[x]&=\frac{d}{dx}[\sin y]\\
&\implies&1&=\cos y\,\frac{dy}{dx}\\
&\implies&\frac1{\cos y}&=\frac{dy}{dx}.
\end{alignat*}
So for instance the slope at $\left(\frac12,\frac{\pi}6\right)$
is given by $\frac{dy}{dx}=1/\cos\frac{\pi}6=\frac1{\sqrt{3}/2}
=2/\sqrt3$, and the equation of the tangent line there is
$$y=\frac{\pi}6+\frac2{\sqrt3}\left(x-\frac12\right).$$

It is also worth noting what happens when $\cos y=0$, and
its implications for $\frac{dy}{dx}$, in light of the graph.

The next example is quite long, but with persistence is also quite do-able.

\label{ExampleX=SineYForImplicitSeciton}
\eex

\begin{figure}[h]
\begin{center}

\begin{pspicture}(-2,-4)(2,4)
\psset{yunit=.5cm}
\psaxes[Dy=20]{<->}(0,0)(-2,-8)(2,8)
\parametricplot[plotpoints=2000]{-8}{8}{t 180 mul 3.14159265 div sin t}

\psline(-.2,-3.1415)(.2,-3.1415)
\psline(-.2,3.1415)(.2,3.1415)
\rput[l](.3,-3.1415){$-\pi$}
\rput[l](.3,3.1415){$\pi$}

\psline(-.2,-6.28)(.2,-6.28)
\psline(-.2,6.28)(.2,6.28)
\rput[l](.3,-6.28){$-2\pi$}
\rput[l](.3,6.28){$2\pi$}
\pscircle[fillcolor=black,fillstyle=solid](.5,.52359){.08}
\end{pspicture}
\end{center}
\caption{Partial graph of $x=\sin y$, which is similar to $y=\sin x$
except that the roles of $x$ and $y$ are reversed.  The point
$(1/2,\pi/6)$ is highlighted from
Example~\ref{ExampleX=SineYForImplicitSeciton}.}
\label{FigureForX=SineYForImplicitSection}\end{figure}

\bex Find $\frac{dy}{dx}$ on the graph of
$\ds{y^3\sec\sqrt{x^2+y^2}=\cos2x}$.
\begin{alignat*}{2}
&&\frac{d}{dx}\left[y^3\sec\sqrt{x^2+y^2}\right]&=\frac{d\,\cos 2x}{dx}\\
&\implies&y^3\frac{d}{dx}\left[\sec\sqrt{x^2+y^2}\right]
+\sec\sqrt{x^2+y^2}\cdot\frac{d\,y^3}{dx}
&=-\sin2x\cdot\frac{d\,2x}{dx}\\
&\implies& y^3\sec\sqrt{x^2+y^2}\tan\sqrt{x^2+y^2}
\cdot\frac{d}{dx}\sqrt{x^2+y^2}\quad&\\
&&+\sec\sqrt{x^2+y^2}\cdot 3y^2\cdot\frac{dy}{dx}
&=-\sin2x\cdot2\\
&\implies&y^3\sec\sqrt{x^2+y^2}\tan\sqrt{x^2+y^2}
\cdot\frac1{2\sqrt{x^2+y^2}}\cdot\frac{d}{dx}(x^2+y^2)
&\\
&&+3y^2\sec\sqrt{x^2+y^2}\cdot\frac{dy}{dx}&=-2\sin2x\\
&\implies&\frac{y^3\sec\sqrt{x^2+y^2}\tan\sqrt{x^2+y^2}
}{2\sqrt{x^2+y^2}}\cdot\left(2x+2y\frac{dy}{dx}\right)\qquad\qquad&\\
&&+3y^2
\sec\sqrt{x^2+y^2}\cdot\frac{dy}{dx}
&=-2\sin2x.\\
\end{alignat*}
Next we apply the distributive in the first term to flush out
the $\frac{dy}{dx}$ terms and get
\begin{multline*}
\frac{xy^3\sec\sqrt{x^2+y^2}\tan\sqrt{x^2+y^2}}{\sqrt{x^2+y^2}}
+\frac{y^4\sec\sqrt{x^2+y^2}\tan\sqrt{x^2+y^2}}{\sqrt{x^2+y^2}}
\cdot\frac{dy}{dx}\\
+3y^2\sec\sqrt{x^2+y^2}\cdot\frac{dy}{dx}=-2\sin2x.
\end{multline*}
Now we put all terms with the factor $\frac{dy}{dx}$ on one side
(here, the left side), and the others on the opposite side:
\begin{multline*}
\frac{y^4\sec\sqrt{x^2+y^2}\tan\sqrt{x^2+y^2}}{\sqrt{x^2+y^2}}
\cdot\frac{dy}{dx}+3y^2\sec\sqrt{x^2+y^2}\cdot\frac{dy}{dx}
\\
=-2\sin2x-\frac{xy^3\sec\sqrt{x^2+y^2}\tan\sqrt{x^2+y^2}}{\sqrt{x^2+y^2}}
\end{multline*}
Next we factor the $\frac{dy}{dx}$:
\begin{multline*}
\left(\frac{y^4\sec\sqrt{x^2+y^2}\tan\sqrt{x^2+y^2}}{\sqrt{x^2+y^2}}
\cdot\frac{dy}{dx}+3y^2\sec\sqrt{x^2+y^2}\right)\frac{dy}{dx}
\\
=-2\sin2x-\frac{xy^3\sec\sqrt{x^2+y^2}\tan\sqrt{x^2+y^2}}{\sqrt{x^2+y^2}}.
\end{multline*}
Finally, we divide to solve for $\frac{dy}{dx}$:

$$\frac{dy}{dx}
=\frac{-2\sin2x-\ds{\frac{xy^3\sec\sqrt{x^2+y^2}\tan\sqrt{x^2+y^2}}
{\sqrt{x^2+y^2}}}}
{\ds{\frac{y^4\sec\sqrt{x^2+y^2}\tan\sqrt{x^2+y^2}}{\sqrt{x^2+y^2}}}
+3y^2\sec\sqrt{x^2+y^2}}.$$

Finally, if we would like, we can multiply the numerator
and denominator by $\ds{\sqrt{x^2+y^2}}$ to get:
$$\frac{dy}{dx}
=\frac{-2\sqrt{x^2+y^2}\sin2x-xy^3\sec\sqrt{x^2+y^2}\tan\sqrt{x^2+y^2}}
{y^4\sec\sqrt{x^2+y^2}\tan\sqrt{x^2+y^2}+3y^2\sqrt{x^2+y^2}
\sec\sqrt{x^2+y^2}}.$$

Although this example may seem tedious, no particular
step is conceptually difficult.  Success in such
a project is nearly as much dependent upon our bookkeeping
skills as upon understanding of derivative rules.

\eex

\subsection{A Mistake to Avoid}
Before finishing this section a remark is in order.
It is tempting to try to simplify an algebraic
equation by taking derivatives of both sides, especially
in the case of polynomial equations.  However,
in such cases we are looking for {\it points} where
one side equals the other, which is very different
from saying the two sides are the same {\it functions}
of, say, $x$.
For a very simple case, consider the equation
\begin{equation}x^2-2x+1=5-2x.\label{DumbExample1}\end{equation}
This succumbs easily to the earlier methods:
\begin{alignat*}{2}&\qquad&x^2-2x+1&=5-2x\\&\iff& x^2&=4\\
&\iff& x&=-2,2\end{alignat*}
so the solution is simply $x=\pm2$.  Now suppose instead we
tried to take derivatives of both sides of (\ref{DumbExample1}):
\begin{alignat*}{2}
&\qquad&2x-2&=-2\\ &\iff& 2x&=0\\ &\iff& x&=0.\end{alignat*}
We see that we get the incorrect answer.  Thus if we
are {\it solving} $f(x)=g(x)$, it does not follow that
$f'(x)=g'(x)$.  It {\it is} true {\it if they are the
same functions}, i.e., same heights everywhere
(and we use this fact in our implicit differentiation
process), but
when we solve algebraic equations we are only interested
in those points where the graphs of the two
(usually different) functions intersect.
It is unlikely that they would share the  same slopes there
as well as the heights. Hence it is important to
use algebraic arguments where appropriate, and calculus
arguments where appropriate.
See Figure~\ref{DumbExample1Figure}.
\begin{figure}
\begin{center}
%\begin{pspicture}(-1.4,-1)(8.4,9)
%\psset{xunit=1.4cm,yunit=.5cm}
%\psaxes[Dy=10]{<->}(0,0)(-1,-10)(6,50)
%\psplot[plotpoints=2000]{-1}{6}{x 8 mul}
%\psplot[plotpoints=2000]{-1}{6}{x dup mul 15 add}
%\end{pspicture}
\begin{pspicture}(-4,-1.5)(4,9)
\psset{yunit=.5cm}
\psaxes[Dy=2]{<->}(0,0)(-4,-3.5)(4,18)
\psplot{-3.23}{4}{x 1 sub dup mul}
\psplot{-4}{4}{5 2 x mul sub}

\rput(2,14){$\ds{\begin{aligned}f(x)&=x^2-2x+1\\
                                g(x)&=5-2x\end{aligned}}$}
\end{pspicture}

\end{center}
\caption{
%Graphs of $f(x)=x^2-2x+1$ and $g(x)=5-2x$.
%Finding $x_0$ solving $f(x)=g(x)$ is {\it not}
%the same (and not  even implied by) solving $f'(x)=g'(x)$.
%Here we see that the $x$-values that solve $f(x)=g(x)$
%are $x=\pm2$,
%i.e., where the two curves meet.
%These points do not also satisfy $f'(x)=g'(x)$,
%or $2x-2=-2$ (which occurs at $x=0$).  From the graph
%it is clear that  the slopes of the
%two curves are different where they intersect.
%In other words, we
%cannot solve algebraic equations by taking the derivatives
%of both sides.  However, if $f(x)$ and $g(x)$ {\it are the
%same functions}, then their derivatives are the same.
The graphs intersect at $x=\pm2$, which is the solution
to $x^2-2x+1=5-2x$.  However, it is clear from the picture
that, though $f(x)=g(x)$ at $x=\pm2$, the derivatives (slopes)
$f'(x)$ and $g'(x)$ at those two points are not the same.
In fact, the derivatives are the same at $x=0$ only,
from $2x-2=-2$ (i.e., $f'(x)=g'(x)$).  A quick look at the graphs
shows the slopes at $x=0$ do appear to  agree.}
\label{DumbExample1Figure}\end{figure}

\newpage

\newpage

\begin{center}\underline{\Large{\bf Exercises}}\end{center}
\bigskip
\begin{multicols}{2}
\begin{enumerate}
\item
\item Consider the algebraic equation
 $$x^2=9.$$
 \begin{enumerate}
 \item Define  functions $f(x)=x^2$ and $g(x)=9$ and graph them
       together  on one grid.
 \item What is its solution of the original equation, i.e.,
       of $f(x)=g(x)$?
 \item What is the graphical significance of the solution
       of $f(x)=g(x)$?
 \item Now consider the equation $f'(x)=g'(x)$ for these two
       functions $f$ and $g$. What is the solution
       of this new equation $f'(x)=g'(x)$?
 \item Explain the significance of the solution of
       $\frac{d}{dx}f(x)=\frac{d}{dx}g(x)$
       for this particular example.
 \item Explain why, if a particular $x$ satisfies $f(x)=g(x)$,
       we cannot expect that it also satisfies $f'(x)=g'(x)$.
 \end{enumerate}
\item Repeat the previous problem for the equation $\sin x=\cos x$,
      for $x\in[0,2\pi]$.
\end{enumerate}

\end{multicols}

\newpage
\section{Arctrigonometric Functions and their Derivatives}

In this and the next three sections, we will explore derivatives of
the last of our standard classes of functions.
Presently we will look at the arctrigonometric functions, while
in the next two sections we will look respectively at exponential, and
then logarithmic functions.  While we will need to be mindful of
the exact natures of these functions, with their derivative formulas
we will usually  be able to simply apply the new formulas
together with the previous rules, and in so doing nearly
finish our study of computing
derivatives.  The final section will be for review, and to consider
some other complications which arise on occasion.

\subsection{One-to-one Functions and Inverses, Briefly}

The arctrigonometric functions are also called the
{\it inverse trigonometric functions}.  There is one
problem with this, in that the trigonometric functions
are not invertible {\it per se}.  But that does not
keep us from defining  inverse functions in specific
local contexts, in ways which are still useful in other contexts.

Recall what it means for a function $y=f(x)$ to be invertible.
It is also described as {\it one-to-one}, meaning that
for $f:S\longrightarrow \Re$, i.e., where $S$ is the domain of $f$,
we have
\begin{equation}
\left(\forall x_1,x_2\in S\right)\left[\left(x_1=x_2\right)
\longleftrightarrow\left(f\left(x_1\right)=
                      f\left(x_2\right)\right)\right]
                \label{One-To-OneDefArcTrigSection}
\end{equation}
Note that for $f$ to be a function we already
have $\left(\forall x_1,x_2\in S\right)
\left[\left(x_1=x_2\right)\longrightarrow
\left( f\left(x_1\right)=f\left(x_2\right)\right)\right]$,
i.e., the input completely determines the output.
For the function to be one-to-one means we also have $\longleftarrow$,
i.e., the output also completely determines what was the input.
When we have such an $f$, we call its {\it inverse} the function
$g$ defined by the property
\begin{equation}
(\forall x\in S)(\forall y\in f(S))[g(y)=x\longleftrightarrow f(x)=y].
\label{DefOfInverseFunctionInGeneral}\end{equation}
In such a context
we then denote this inverse function $g$ using a notation
comes from another mathematical context (not the subject of
this book), seems somewhat out of place here,
but which is so prevalent that it is used universally and will
therefore be adopted here.
That notation for the inverse function is conventionally given by
$f^{-1}$, though here the $-1$ ``exponent'' is definitely not to be construed
as a ``power'' as we would normally.\footnote{%
%%% FOOTNOTE
Indeed, anytime we have an ``exponent'' which is not $-1$, we
assume it is a true exponent.  However, the ``exponent''
$-1$, when immediately modifying a function given by
name such as $f$, $g$, etc., or any of
the named trigonometric functions, it is reserved to denote
instead (what is taken to be) the inverse function.
%%% END FOOTNOTE
} Thus, if $f$ is one-to-one, we have
\begin{alignat}{3}
&(\forall x\in S)&&[f^{-1}(f(x))&&=x],\label{InversesProp1}\\
&(\forall y\in f(S))&&[f(f^{-1}(y))&&=y].\label{InversesProp2}\end{alignat}
In other words, the functions $f$ and $f^{-1}$ ``undo'' each other;
for a one-to-one function $f$ with inverse $f^{-1}$, we have
that their  mappings are reversible:
$$x\overset{f}{\longmapsto}\underbrace{y}_{f(x)}
\overset{f^{-1}}{\longmapsto}\underbrace{x}_{f^{-1}(y)},$$
which as mappings of sets would look like
$$S\overset{f}{\longrightarrow}f(S)\overset{f^{-1}}{\longrightarrow}S.$$

The usual algebraic (as opposed to the graphical)
way to attempt to invert a function $f$ (that is, compute
its inverse function) is to solve the equation $y=f(x)$ for $x$, since
$$f\text{ one-to-one} \iff
  (\forall x,y)\left[ y=f(x)\longleftrightarrow x=f^{-1}(y)\right].$$
(This is just a re-writing of (\ref{DefOfInverseFunctionInGeneral}).)
Often in the process of attempting to calculate $f^{-1}$ we
will discover if it in fact exists, i.e., if $f$ is one-to-one.
There can be many
technicalities, depending upon the original function, but
also many computations are straightforward.
\bex
Consider the function $f(x)=6x-9$.  Compute $f^{-1}(x)$,
and from that also compute
$f^{-1}(f(x))$ and $f(f^{-1}(y))$.

\underline{Solution}: The usual method is essentially to write
$y=f(x)$ and try to solve for $x$.  If it can be done uniquely,
then our equation will be of the form $x=f^{-1}(y)$.
$$
y=f(x)\qquad\iff\qquad y=6x-9\qquad
      \iff\qquad\underbrace{\frac{y+9}6}_{f^{-1}(y)}=x.$$
Including our original function and the answers to the question, we
have:
\begin{align*}
f(x)&=6x-9,\\
f^{-1}(y)&=\frac16(y+9),\\
f^{-1}(f(x))&=\frac16[f(x)+9]=\frac16(6x-9+9)=\frac16(6x)=x,\\
f(f^{-1}(y))&=[(f^{-1}(y)]-9=6\left(\frac16(y+9)\right)-9=
                              (y+9)-9=y.\end{align*}
\eex
Note how applying $f^{-1}$ indeed ``undoes'' the process of applying $f$
to an element in the domain of $f$, while applying $f$ ``undoes'' the
process of applying $f^{-1}$ to an element of $f(S)$.  That is the essence
of (\ref{InversesProp1}) and (\ref{InversesProp2}) from before.

\subsection{The Arctrigonometric Functions and Their Derivatives}

In Table~\ref{TableOfArctrigonometricFunctions},
page~\pageref{TableOfArctrigonometricFunctions}
we summarize the most important conclusions of what
a careful development of the
arctrigonometric functions would yield, including their domains,
their ranges, and their derivatives.
We save the actual derivations for later subsections, since
at this stage we are most interested in derivatives involving
these functions.  However, the detailed derivations are ultimately
quite important and
should be studied for a couple of reasons.
First, the technicalities involved there will
reappear many times in later chapters.
Second, the derivations
are also quite interesting---and useful as exercises---because,
as occurs in many applied problems, the techniques used form an
interesting mix of algebra, trigonometry, and
our calculus techniques, particularly implicit
differentiation.\footnote{%
%%% FOOTNOTE
Indeed, the farther along one gets in mathematical or applied studies,
the more one has to borrow from a growing diversity
of subjects.
It is very often the ``technicalities''---themselves often first
found in derivations,
footnotes or otherwise parenthetically---which play key roles
in solving interesting problems, in both pure and applied mathematics.
%%% END FOOTNOTE
}

However in this subsection
we concentrate on their derivatives, though
we keep
an eye towards their actual definitions, including their domains and
ranges.  Armed with the derivative formulas, we will be able to
greatly expand the class of functions we can differentiate.

Now the trigonometric functions repeat periodically,
so there is no guarantee for
instance that $\sin x_1=\sin x_2$ implies $x_1=x_2$.
The way we nonetheless endeavor to ``invert'' the trigonometric
functions is to temporarily restrict their domains so that they are
forced to be one-to-one.
For instance,  $\sin x$ is one-to-one
on $x\in[-{\pi}/2,{\pi}/2]$, i.e.,
$$\left(\forall x_1,x_2\in\left[-\frac{\pi}2,\frac{\pi}2\right]\right)
\left[\left(\sin x_1=\sin x_2\right)\longleftrightarrow
\left(x_1=x_2\right)\right].$$
This is kind of domain restriction is explained in subsequent subsections,
where for each of the six standard trigonometric functions
we look for a subset of its domain on which
(1) the function is one-to-one, and (2) the set of all outputs
covers the whole range of the original function.\footnote{%
%%% FOOTNOTE
It is
akin to the problem trying to invert the function
$f(x)=x^2$, which  is not one-to-one, since
for instance $f(-5)=f(5)$, while $-5\ne 5$. Since it is impossible to
truly invert $f(x)=x^2$, instead we define the ``principal square
root'' $g(y)=\sqrt{y}$,
which does give us an inverse to $f(x)$ on the set $x\ge0$:
$$\left(\forall x_1,x_2\in[0,\infty)\right)\left[
   \left(x_1=x_2\right)\longleftrightarrow\left(x_1^2=x_2^2\right)\right].$$
While the above is not true if we replace $[0,\infty)$ with the whole
domain $\Re$ of $f$, it is still useful to define such a $g$.
For instance, knowing $f(x)=K$ gives us $x=\pm\sqrt{K}=\pm g(K)$,
so the value of $g(K)$ is still useful in finding a particular
$x$, regardless of whether we ultimately need $x=\sqrt{K}$ or $x=-\sqrt{K}$.
%%% END FOOTNOTE
} %
There are some
other issues which turn out to be easier to accommodate,
such as consistency and compatibility with the other
six trigonometric functions, and which will be explained as we develop
the theory.

Of course the simplest uses for
the arctrigonometric functions
arise from solving trigonometric equations.
For instance, it often happens in applications that we need to solve an
equation such as $\tan\theta=x$ for the variable $\theta$.
%\begin{figure}
%\begin{center}
%\begin{pspicture}(0,-.50)(10,2.5)
%\psline(0,0)(3,0)(3,2)(0,0)
%\psline{->}(3,0)(3,2)
%\rput(1.5,-.3){1}
%\rput(3.3,1){$x$}
%\psarc{->}(0,0){.7}{0}{33.69}
%\rput(1,.3){$\theta$}
%\rput(7,1){$\ds{\left.
%               \begin{array}{c}\tan\theta=x\\
%                                \theta\in\left(\frac{-\pi}2,\frac{\pi}2
%                           \right)\end{array}\right\}
%                \iff\theta=\tan^{-1}x.}$}
%\end{pspicture}
%\end{center}
%\caption{For a given $x\in\Re$, there are infinitely many angles $\theta$
%         for which $\tan\theta=x$.  However, if we restrict our interest
%         to $\theta\in\left(\frac{-\pi}2,\frac{\pi}2\right)$, then
%         we get a unique $\theta$, which we dub $\tan^{-1}x$.}
%\label{ApplicationExampleForArcTangentDiscussion}\end{figure}
For this and other reasons, arctrigonometric functions become of interest.
These are functions which take a {\it number,} such as $x$, and return
an {\it angle} such as $\theta$ (also represented by a number, but
the distinction is important)
for which $x$ is some given trigonometric function of that
angle.  So if we are interested in knowing an angle
$\theta$ such that $\tan\theta=x$,  there
is an arctrigonometric function $\arctan x$ which will give us
such an angle $\theta$ so that indeed $\tan\theta=x$.  Such arctrigonometric
functions as arcsine, arccosine and arctangent
are built into scientific calculators, for instance,
along with the original trigonometric functions sine, cosine and tangent.
These functions allow us to move from
angle to trigonometric function of the angle, and back, almost.

The trouble is that
there is important ambiguity about the angle $\theta$ in such
a problem,
namely that if some angle $\theta$ solves $\tan\theta=x$,
so do all angles of the form $\theta+n\pi$, where $n\in\mathbb{Z}$
(i.e., $\theta\pm\pi,\theta\pm2\pi, \cdots$).
Presently calculators only output a single angle for
such a problem.  Still, knowing one solution is quite useful, as it
indirectly gives us such information as the reference angle
of the other solutions.
For instance, if we use a calculator for a solution to
$\tan\theta=5$, one solution will be given by the calculator
to be $\theta=\tan^{-1}5\approx1.373400767$
(or approximately $78.69006253^\circ$).  If we need an angle in the third
quadrant (not practical in most right-triangle trigonometry,
but useful in many applications nonetheless)
we can instead use, for one example,
$\tan^{-1}5+\pi\approx4.514993421$ (or
$\tan^{-1}5+180^\circ\approx258.6900675^\circ$ if
we want to work in degrees).  The notations $\arctan x$ and
$\tan^{-1}x$ are used interchangeably.\footnote{%%
%%% FOOTNOTE
Again note that the $-1$ ``exponent'' in $\tan^{-1}x$ is not
actually an exponent in the sense of ``power,'' but is rather
a notation borrowed from the study of {\it inverse functions}.
Indeed, we have a name for $(\tan x)^{-1}$, specifically $\cot x$.
%%% END FOOTNOTE
}

Leaving the derivation for later, for now we list the derivatives
in basic and chain rule forms.
\begin{alignat}{3}
\frac{d\,\sin^{-1}x}{dx}&=\frac1{\sqrt{1-x^2}},&\qquad\qquad\qquad
\frac{d\,\sin^{-1}u}{dx}&=\frac1{\sqrt{1-u^2}}\cdot\frac{du}{dx},\\
\frac{d\,\cos^{-1}x}{dx}&=\frac{-1}{\sqrt{1-x^2}},&\qquad\qquad\qquad
\frac{d\,\cos^{-1}u}{dx}&=\frac{-1}{\sqrt{1-u^2}}\cdot\frac{du}{dx},\\
\frac{d\,\tan^{-1}x}{dx}&=\frac1{x^2+1},&
\frac{d\,\tan^{-1}u}{dx}&=\frac1{u^2+1}\cdot\frac{du}{dx},\\
\frac{d\,\cot^{-1}x}{dx}&=\frac{-1}{x^2+1},&
\frac{d\,\cot^{-1}u}{dx}&=\frac{-1}{u^2+1}\cdot\frac{du}{dx},\\
\frac{d\,\sec^{-1}x}{dx}&=\frac1{|x|\sqrt{x^2-1}},&
\frac{d\,\sec^{-1}u}{dx}&=\frac1{|u|\sqrt{u^2-1}}\cdot\frac{du}{dx},\\
\frac{d\,\csc^{-1}x}{dx}&=\frac{-1}{|x|\sqrt{x^2-1}},&
\frac{d\,\csc^{-1}u}{dx}&=\frac{-1}{|u|\sqrt{u^2-1}}\cdot\frac{du}{dx}.
\end{alignat}
Remarkably all these  derivatives
are all ``algebraic'' in nature,\footnote{%%%
%%% FOOTNOTE
``Algebraic'' is in contrast to ``transcendental,'' the latter
referring to trigonometric, arctrigonometric, logarithmic
and exponential functions, for instance.
%%% END FOOTNOTE
}
meaning that they involve only multiplication, division,
polynomials and radicals.  These emerging derivative forms,
developed next and
summarized in Table~\ref{TableOfArctrigonometricFunctions},
will prove crucial in the later development of antiderivatives.
%HHH

\begin{table}
\begin{center}
\scalebox{.9}{
\begin{tabular}{ccccc}
Function & Inputs (Domain) & Outputs (Range)& Outputs Graphed& Derivative\\
\hline
\\
$\sin^{-1}x$ & $x\in[-1,1]$ & $\theta\in
                            \left[-\frac{\pi}{2},\frac{\pi}2\right]$
                            &\begin{pspicture}(-1,0)(1,1)
                             \psaxes{<->}(0,0)(-1,-1)(1,1)
                             \psarc[linecolor=gray]{*-*}(0,0){.5}{-90}{90}
                             \psline{->}(0,0)(1,1)
                             \psarc[linewidth=1pt]{->}(0,0){.5}{0}{45}
                             \rput(.7,.2){$\theta$}
                             \end{pspicture}
                            &$\ds{\frac{d\,\sin^{-1}x}{dx}
                                 =\frac1{\sqrt{1-x^2}}}$\\
$\cos^{-1}x$ & $x\in[-1,1]$ & $\theta\in[0,\pi]$
                            &\begin{pspicture}(-1,0)(1,2)
                             \psaxes{<->}(0,0)(-1,-1)(1,1)
                             \psarc[linecolor=gray]{*-*}(0,0){.5}{0}{180}
                             \psline{->}(0,0)(1,1)
                             \psarc[linewidth=1pt]{->}(0,0){.5}{0}{45}
                             \rput(.7,.2){$\theta$}
                             \end{pspicture}
                            &$\ds{\frac{d\,\cos^{-1}x}{dx}
                                 =\frac{-1}{\sqrt{1-x^2}}}$\\
$\tan^{-1}x$ & $x\in\Re$ & $\theta\in\left(-\frac{\pi}2,\frac{\pi}2\right)$
                            &\begin{pspicture}(-1,0)(1,2)
                             \psaxes{<->}(0,0)(-1,-1)(1,1)
                             \psarc[linecolor=gray]{o-o}(0,0){.5}{-90}{90}
                             \psline{->}(0,0)(1,1)
                             \psarc[linewidth=1pt]{->}(0,0){.5}{0}{45}
                             \rput(.7,.2){$\theta$}
                             \end{pspicture}
                            &$\ds{\frac{d\,\tan^{-1}x}{dx}
                                 =\frac{1}{x^2+1}}$\\
$\cot^{-1}x$ & $x\in\Re-\{0\}$ & $\theta\in
              \left(-\frac{\pi}{2},\frac{\pi}2\right)-\{0\}$
                            &\begin{pspicture}(-1,0)(1,2)
                             \psaxes{<->}(0,0)(-1,-1)(1,1)
                             \psarc[linecolor=gray]{o-o}(0,0){.5}{-90}{0}
                             \psarc[linecolor=gray]{o-o}(0,0){.5}{0}{90}
                             \psline{->}(0,0)(1,1)
                             \psarc[linewidth=1pt]{->}(0,0){.5}{0}{45}
                             \rput(.7,.2){$\theta$}
                             %\psarc[linecolor=gray]{o-o}(0,0){.5}{0}{0}
                             \end{pspicture}
                            &$\ds{\frac{d\,\cot^{-1}x}{dx}
                                 =\frac{-1}{x^2+1}}$\\
$\sec^{-1}x$ & $x\in(-\infty,-1]\cup[1,\infty)$
            & $\theta\in[0,\pi]-\left\{\frac{\pi}2\right\}$
                            &\begin{pspicture}(-1,0)(1,2)
                             \psaxes{<->}(0,0)(-1,-1)(1,1)
                             \psarc[linecolor=gray]{*-o}(0,0){.5}{0}{90}
                             \psarc[linecolor=gray]{o-*}(0,0){.5}{90}{180}
                             \psline{->}(0,0)(1,1)
                             \psarc[linewidth=1pt]{->}(0,0){.5}{0}{45}
                             \rput(.7,.2){$\theta$}
                             \end{pspicture}
                            &$\ds{\frac{d\,\sec^{-1}x}{dx}
                                 =\frac{1}{|x|\sqrt{x^2-1}}}$\\
$\csc^{-1}x$ & $x\in(-\infty,-1]\cup[1,\infty)$
              & $\theta\in\left[-\frac{\pi}2,\frac{\pi}2\right]-\{0\}$
                            &\begin{pspicture}(-1,0)(1,2)
                             \psaxes{<->}(0,0)(-1,-1)(1,1)
                              \psarc[linecolor=gray]{*-o}(0,0){.5}{-90}{0}
                             \psarc[linecolor=gray]{o-*}(0,0){.5}{0}{90}
                             \psline{->}(0,0)(1,1)
                             \psarc[linewidth=1pt]{->}(0,0){.5}{0}{45}
                             \rput(.7,.2){$\theta$}
                             %\psarc[linecolor=gray]{o-o}(0,0){.5}{0}{0}
                             \end{pspicture}
                            &$\ds{\frac{d\,\csc^{-1}x}{dx}
                                 =\frac{-1}{|x|\sqrt{x^2-1}}}$\\
&&&\begin{pspicture}(-1,0)(1,2)
                             %\psaxes{<->}(0,0)(-1,-1)(1,1)
                             \end{pspicture}
&\\
\end{tabular}}\end{center}
\caption{Summary of arctrigonometric functions, their domains and
ranges (given in both interval notation and
graphed as angles through the unit circle),
and their derivatives.  Note that all angles
displayed in the ``Outputs Graphed''
column are assumed to be between $\frac{-\pi}2$ and $\pi$.}
\label{TableOfArctrigonometricFunctions}
\end{table}

Some examples of derivative computations using these follow:
\begin{itemize}
\item $\ds{\frac{d}{dx}\left[\sin^{-1}x^2\right]
 =\frac{1}{\sqrt{1-\left(x^2\right)^2}}\cdot\frac{d\,x^2}{dx}
 =\frac1{\sqrt{1-x^4}}\cdot2x=\frac{2x}{\sqrt{1-x^4}}}$.
\item $\ds{\frac{d}{dx}\left[\tan^{-1}(\tan x)\right]
 =\frac1{(\tan x)^2+1}\cdot\frac{d}{dx}\tan x
 =\frac{1}{\tan^2x+1}\cdot\sec^2x
 =\frac{1}{\sec^2x}\sec^2x=1.}$

A careful look at the original function, particularly in
light of our later development,  would reveal that
$\tan^{-1}(\tan x)=x+n\pi$, so naturally the derivative should be 1.
This sort of thing occurs on occasion when dealing with these.  Indeed
sometimes it is the calculus considerations which first lead us
to such simplifications of the functions.
\item $\ds{\frac{d}{dx}\left[x\sec^{-1}x\right]
  =x\cdot\frac{d}{dx}\left[\sec^{-1}x\right]+\sec^{-1}x\cdot\frac{d\,x}{dx}
  =x\cdot\frac{1}{|x|\sqrt{x^2-1}}+\sec^{-1}x.}$

If we happen to know $x>0$, this simplifies to
$\ds{\frac{x}{x\sqrt{x^2-1}}+\sec^{-1}x=\frac1{\sqrt{x^2-1}}+\sec^{-1}x}$.

If $x<0$ we instead get
$\ds{\frac{x}{-x\sqrt{x^2-1}}+\sec^{-1}x=\frac{-1}{\sqrt{x^2-1}}+\sec^{-1}x}$.

\end{itemize}

\subsection{The Arcsine Function and Its Derivative}

We begin our development with the inverse trigonometric functions which
can be found on scientific calculators: arcsine, arccosine and arctangent
(a.k.a. $\sin^{-1}$, $\cos^{-1}$
and $\tan^{-1}$ respectively).  Though these are the most intuitive in
their derivations, in fact calculus applications find
the most use for the arcsine, arctangent and arcsecant,
so the derivation of the arcsecant will also be presented in
full.  For completeness
we will include results for  arccosecant and arccotangent.

%Each of these trigonometric inverse functions are best
%considered in light of the unit circle development of
%the trigonometric functions.  For this reason we recall

\begin{figure}
\begin{center}
\begin{pspicture}(-2.5,-2.7)(7,2.7)
\psaxes[labels=none,Dx=10,Dy=10]{<->}(0,0)(-2.5,-2.5)(2.5,2.5)
\psarc[linestyle=dashed](0,0){2}{90}{270}
\psarc(0,0){2}{-90}{90}
\psline(0,0)(1.285575,1.532)
\pscircle[fillstyle=solid,fillcolor=black](1.285575,1.532){.07}
\psarc{->}(0,0){.4}{0}{50}
\rput(.6,.3){$\theta$}
\rput[l](1.5,1.6){$(\cos\theta,\sin\theta)$}
  \rput(0,2.7){$\pi/2$}
  \rput(0,-2.7){$-\pi/2$}
  \rput(2.7,0){0}
\psline[linestyle=dashed](0,2)(6,2)
\psline[linestyle=dashed](0,-2)(6,-2)
\rput(6,0){$\ds{\begin{array}{c}\ds{-\frac{\pi}2\le\theta\le\frac{\pi}2}\\
                   \ds{\vphantom{\frac11}-1\le\sin\theta\le1}\end{array}}$}
\psline{->}(6,.75)(6,2)
\psline{->}(6,-.75)(6,-2)

\end{pspicture}
\end{center}
\caption{Diagram showing that part of the unit circle used to
construct the arcsine function.
For all $x\in[-1,1]$, there exists a unique $\theta\in[-\pi/2,\pi/2]$
so that $\sin\theta=x$. }
\label{AnglesOutputByArcsineFigure}
\end{figure}

We begin with the arcsine function. We are thus interested in
finding a function which we will call $\sin^{-1}x$,
or $\arcsin x$, so that $\sin^{-1}x$ returns an angle $\theta$
so that $\sin\theta=x$.  Now the range (of outputs) of $\sin\theta$
is $[-1,1]$, so our function $\sin^{-1}x$ should
be able to input any such $x\in[-1,1]$ and return an angle $\theta$
whose sine is $x$.  As shown in Figure~\ref{AnglesOutputByArcsineFigure},
all such outputs $\sin\theta\in[-1,1]$ are achieved if we
restrict the input of the sine function to $\theta\in\left[-\frac{\pi}2,
\frac{\pi}2\right]$.  Moreover, for each $x\in[-1,1]$ there exists
a unique $\theta\in\left[-\frac{\pi}2,\frac{\pi}2\right]$ such
that $\sin\theta=x$.  Thus we make the following definition:
\begin{definition}
For every $x\in[-1,1]$, define
\begin{equation}
\sin^{-1}x=\text{ ``that }\theta\in\left[-\frac{\pi}2,\frac{\pi}2\right]
            \text{ such that }\sin\theta=x.\text{''}
\label{EquationDefiningArcSine}
\end{equation}
\label{DefinitionOfArcSine}
\end{definition}
Note that $\sin(\sin^{-1}x)=x$, because in that computation we are
taking the sine of an angle---albeit inside of
$\left[-\frac{\pi}2,\frac{\pi}2\right]$---whose sine is $x$, and
so its sine is, naturally, $x$.\footnote{%%%
%%% FOOTNOTE
However $\sin^{-1}(\sin x)$
is $x$ if and only if $x\in\left[-\frac{\pi}2,\frac{\pi}2\right]$,
though $\sin^{-1}(\sin x)$ will at least share the same reference
angle as $x$.
%%% END FOOTNOTE
}
Using this fact, we can note that
$y=\sin^{-1}x\implies \sin y=\sin(\sin^{-1}x)\iff \sin y=x,$
i.e.,
\begin{equation}y=\sin^{-1}x\implies \sin y=x.
\label{Y=ArcSineX=>X=SineY}\end{equation}
The graph of  $y=\sin^{-1}x$ is thus a subset of the graph
of $\sin y=x$.  This is shown in
Figure~\ref{FigureForX=SineY,Y=ArcsineX}.

\begin{figure}
\begin{center}

\begin{pspicture}(-2,-4)(2,4)
\psset{yunit=.5cm}
\psaxes[Dy=20]{<->}(0,0)(-2,-8)(2,8)
\parametricplot[linecolor=gray,%
plotpoints=2000]{-8}{8}{t 180 mul 3.14159265 div sin t}
\parametricplot[plotpoints=100,linewidth=2pt]%
{-1.5708}{1.5708}{t 180 mul 3.14159265 div sin t}
\psline(-.2,-3.1415)(.2,-3.1415)
\psline(-.2,3.1415)(.2,3.1415)
\rput[l](.3,-3.1415){$-\pi$}
\rput[l](.3,3.1415){$\pi$}

\psline(-.2,-6.28)(.2,-6.28)
\psline(-.2,6.28)(.2,6.28)
\rput[l](.3,-6.28){$-2\pi$}
\rput[l](.3,6.28){$2\pi$}
\pscircle[fillcolor=black,fillstyle=solid](1,1.5708){.07}
\pscircle[fillcolor=black,fillstyle=solid](-1,-1.5708){.07}
\end{pspicture}
\end{center}
\caption{Partial graph of $x=\sin y$ in gray, with the
graph of $y=\sin^{-1}x$, i.e., that of $\left\{(x,y)\ |\ x=\sin y, y\in
        \left[-\frac{\pi}2,\frac{\pi}2\right]\right\}$
in black.}
\label{FigureForX=SineY,Y=ArcsineX}\end{figure}

Using (\ref{Y=ArcSineX=>X=SineY}), we can now derive the
derivative of the arcsine function.  Eventually we will need
to refer to a variation of Figure~\ref{AnglesOutputByArcsineFigure},
but the initial computations are chain rules in nature:
\begin{alignat*}{2}
&&y&=\sin^{-1}x\\
&\implies&\qquad \sin y&=\sin(\sin^{-1}x)\\
&\implies&       \sin y&=x\\
&\implies& \frac{d}{dx}(\sin y)&=\frac{d}{dx}(x)\\
&\implies&\cos y\cdot\frac{dy}{dx}&=1\\
&\implies&\frac{dy}{dx}&=\frac1{\cos y}.
\end{alignat*}
At this point we need to rewrite this derivative in terms of $x$
using $y=\sin^{-1}x$:
\begin{equation}
y=\sin^{-1}x\implies \frac{dy}{dx}=\frac1{\cos (\sin^{-1}x)}.
\label{IntermediateStepToArcsineDerivative}
\end{equation}
Now recall that $\sin^{-1}x\in\left[-\frac{\pi}2,\frac{\pi}2\right]$,
and in fact $\sin^{-1}x$ is that angle $\theta\in
\left[-\frac{\pi}2,\frac{\pi}2\right]$ so that $\sin\theta=x$.
There are two basic cases for this $\theta$: that $\theta$ is in
Quadrant I or Quadrant IV. (If $\theta$ is axial then the analysis
of either case will still work.)
These cases are given in Figure~\ref{TrianglesForCosineArcsineX}.

It is important to construct angles $\theta$ with the
proper representative triangles: the sine of $\theta$
must is labeled $x$,  here representing the vertical
displacement, either positive or negative.
The hypotenuse is positive (since it is always a distance,
not a displacement), and the quadrants are correct.
The third side is constructed to be consistent with
both the Pythagorean Theorem
and the quadrant, the latter required to get the correct sign
for the displacement represented by that side.
In both cases, $x>0$ and $x<0$, we see that the third side
of the representative triangle is $\sqrt{1-x^2}$
since it is a positive---that is, rightward---displacement
in the horizontal direction.  From this we can
read off $\cos(\sin^{-1}x)=\cos\theta=\sqrt{1-x^2}$.

\begin{figure}
\begin{center}
\begin{pspicture}(-2.5,-3)(2.5,2.5)
\psaxes[Dx=2,Dy=2,labels=none]{<->}(0,0)(-2.5,-2.5)(2.5,2.5)
\psarc[linestyle=dashed](0,0){2}{90}{270}
\psarc(0,0){2}{-90}{90}
\psline{->}(0,0)(2,2.383507)
\psarc{->}(0,0){.4}{0}{50}
\rput(.6,.3){$\theta$}
\psline[linewidth=2pt]{->}(0,0)(1.285575,0)
\psline[linewidth=2pt]{->}(1.285575,0)(1.285575,1.532)
\rput(.61,1.1){1}

\rput[l](1.45,.75){$x$}
\rput(.65,-.3){$\sqrt{1-x^2}$}
\rput(0,-3){Case $x\ge0$}

\end{pspicture}
\qquad
\begin{pspicture}(-2.5,-3)(2.5,2.5)
\psaxes[Dx=2,Dy=2,labels=none]{<->}(0,0)(-2.5,-2.5)(2.5,2.5)
\psarc[linestyle=dashed](0,0){2}{90}{270}
\psarc(0,0){2}{-90}{90}
\psline{->}(0,0)(2,-2.383507)
\psarc{<-}(0,0){.4}{-50}{0}
\rput(.6,-.3){$\theta$}
\psline[linewidth=2pt]{->}(0,0)(1.285575,0)
\psline[linewidth=2pt]{->}(1.285575,0)(1.285575,-1.532)
\rput[l](1.45,-.75){$x$}
\rput(.61,-1.1){1}
\rput(.65,.3){$\sqrt{1-x^2}$}
\rput(0,-3){Case $x\le0$}
\end{pspicture}
\end{center}
\caption{Illustration of the two cases for representative triangles
for angles $\theta=\sin^{-1}x$.  With two sides of such a triangle}
\label{TrianglesForCosineArcsineX}
\end{figure}

Inserting this information into our derivative computation
(\ref{IntermediateStepToArcsineDerivative})
gives us
$y=\sin^{-1}x\implies\frac{dy}{dx}=1/\cos(\sin^{-1}x)=1/\sqrt{1-x^2}$.
We give this result in summary form, and then give the chain rule version:
\begin{align}
\frac{d}{dx}\sin^{-1}x&=\frac1{\sqrt{1-x^2}},\label{DerivOfArcSine}\\
\frac{d}{dx}\sin^{-1}u&=\frac1{\sqrt{1-u^2}}\cdot\frac{du}{dx}.
   \label{ChainRuleVersionArcsineDerivative}
\end{align}
As usual, the latter can be decomposed into
$$\frac{d}{dx}\sin^{-1}u=\frac{d}{du}\sin^{-1}u\cdot\frac{du}{dx}
                        =\frac1{\sqrt{1-u^2}}\cdot\frac{du}{dx}.$$

Note that (\ref{DerivOfArcSine}) only makes sense for
$x\in(-1,1)$, and that
$\frac{d}{dx}\sin^{-1}x=\frac1{\sqrt{1-x^2}}\longrightarrow\infty$
as $x\to1^-$
and as $x\to-1^+$.  This is borne out by the graph
of $y=\sin^{-1}x$ given in Figure~\ref{FigureForX=SineY,Y=ArcsineX},
page \pageref{FigureForX=SineY,Y=ArcsineX}. That graph also
reflects how $\frac{d}{dx}\sin^{-1}x=\frac1{\sqrt{1-x^2}}>0$
for all $x\in(-1,1)$, that is, how $\sin^{-1}x$ is increasing
in that interval (and in fact, in the whole domain $x\in[-1,1]$).

\subsection{The Arccosine and Its Derivative}
The development for the arccosine function mirrors that of the
arcsine, except that we will take the range of the arccosine
function to contain
angles in Quadrants I and II, specifically $\theta\in[0,\pi]$.
That is because such angles
form exactly the kind of set we need so that the cosine is
a one-to-one function with outputs covering the whole range
$[-1,1]$.
\begin{definition}
For every $x\in[-1,1]$, define
\begin{equation}\cos^{-1}x = \text{ ``that }\theta\in[0,\pi]
          \text{ such that }\cos\theta=x.\text{''}\label{EquationDefOfArcCosineX}
\end{equation}\label{DefOfArcCosineX}
\end{definition}

\begin{figure}
\begin{center}

\begin{pspicture}(-2,-4.1)(2,4.1)
\psset{yunit=.5cm}
\psaxes[Dy=20]{<->}(0,0)(-2,-8.2)(2,8.2)
\parametricplot[linecolor=gray,%
plotpoints=2000]{-8}{8}{t 180 mul 3.14159265 div cos t}
\parametricplot[plotpoints=100,linewidth=2pt]%
{0}{3.14159365}{t 180 mul 3.14159265 div cos t}
\psline(-.2,-3.1415)(.2,-3.1415)
\psline(-.2,3.1415)(.2,3.1415)
\rput[l](.3,-3.1415){$-\pi$}
\rput[l](.3,3.1415){$\pi$}

\psline(-.2,-6.28)(.2,-6.28)
\psline(-.2,6.28)(.2,6.28)
\rput[l](.3,-6.28){$-2\pi$}
\rput[l](.3,6.28){$2\pi$}
\pscircle[fillcolor=black,fillstyle=solid](1,0){.07}
\pscircle[fillcolor=black,fillstyle=solid](-1,3.1415927){.07}
\end{pspicture}
\end{center}
\caption{Partial graph of $x=\cos y$ in gray, with the
graph of $y=\cos^{-1}x$, i.e., that of $\left\{(x,y)\ |\ x=\cos y,\ \ y\in
        [0,\pi]\right\}$
in black.}
\label{FigureForX=CosineY,X=ArcsineY}\end{figure}

The arccosine function is given (in bold) in
Figure~\ref{FigureForX=CosineY,X=ArcsineY}.
The computation of the derivative of $\cos^{-1}x$ is
similar to that for the arcsine, eventually referring
to an illustration of two cases, namely
$\theta=\cos^{-1}x$ terminating
in Quadrant I and $\theta=\cos^{-1}x$ terminating in Quadrant II.
\begin{alignat*}{2}
&&y&=\cos^{-1}x\\
&\implies\qquad&\cos y&=x\\
&\implies&\frac{d}{dx}(\cos y)&=\frac{d}{dx}(x)\\
&\implies&-\sin y\,\frac{dy}{dx}&=1\\
&\implies&\frac{dy}{dx}&=\frac1{-\sin y}=\frac1{-\sin(\cos^{-1}x)}.
\end{alignat*}

\begin{figure}
\begin{center}
\begin{pspicture}(-2.5,-3)(2.5,2.5)
\psaxes[Dx=2,Dy=2,labels=none]{<->}(0,0)(-2.5,-2.5)(2.5,2.5)
\psarc[linestyle=dashed](0,0){2}{180}{360}
\psarc(0,0){2}{0}{180}
\psline{->}(0,0)(1.4434,2.5)
\psarc{->}(0,0){.4}{0}{50}
\rput(.6,.3){$\theta$}
\psline[linewidth=2pt]{->}(0,0)(1,1.7321)
\psline[linewidth=2pt]{->}(1,0)(1,1.7321)
\psline[linewidth=2pt]{->}(0,0)(1,0)
\rput(.4,1.1){1}

\rput[c]{270}(1.3,.75){$\sqrt{1-x^2}$}
\rput(.5,-.3){$x$}
\rput(0,-3){Case $x\ge0$}

\end{pspicture}
\qquad
\begin{pspicture}(-2.5,-3)(2.5,2.5)
\psaxes[Dx=2,Dy=2,labels=none]{<->}(0,0)(-2.5,-2.5)(2.5,2.5)
\psarc[linestyle=dashed](0,0){2}{180}{360}
\psarc(0,0){2}{0}{180}
\psline{->}(0,0)(-1.4434,2.5)
\psarc{->}(0,0){.4}{0}{120}
\rput(.6,.3){$\theta$}
\psline[linewidth=2pt]{->}(0,0)(-1,1.7321)
\psline[linewidth=2pt]{->}(-1,0)(-1,1.7321)
\psline[linewidth=2pt]{->}(0,0)(-1,0)
\rput(-.4,1.1){1}

\rput[c]{90}(-1.3,.65){$\sqrt{1-x^2}$}
\rput(-.5,-.3){$x$}
\rput(0,-3){Case $x\le0$}

\end{pspicture}
\end{center}
\caption{Illustration of the two cases for representative triangles
for angles $\theta=\cos^{-1}x\in[0,\pi]$.  In both cases, the
vertical side represents a positive displacement of
$\sqrt{1-x^2}$.}
\label{TrianglesForSineArcCosineX}
\end{figure}

>From Figure~\ref{TrianglesForSineArcCosineX} we see that the
sine of the angle $\theta=\cos^{-1}x$ is $\sqrt{1-x^2}$ regardless of
in which of the two quadrants $\theta$ terminates.  Continuing
our earlier computation, we have
$$y=\cos^{-1}x\implies \frac{dy}{dx}=\frac{-1}{\sin(\cos^{-1}x)}
=\frac{-1}{\sqrt{1-x^2}}.$$
Collecting this with its chain rule version, we have
\begin{align}
\frac{d}{dx}\cos^{-1}x&=\frac{-1}{\sqrt{1-x^2}},\label{DerivOfArcCosine}\\
\frac{d}{dx}\cos^{-1}u&=\frac{-1}{\sqrt{1-u^2}}\cdot\frac{du}{dx}.
   \label{ChainRuleVersionArcCosineDerivative}
\end{align}

The derivative of the arccosine function is negative
for $x\in(-1,1)$, and so the function itself is
decreasing.  Also, the derivative approaches $-\infty$
as $x\to1^-$ and as $x\to-1^+$.

Another derivation for the arccosine function relies upon the
fact that, with these definitions of $\sin^{-1}x$ and
$\cos^{-1}x$, we have an identity
\begin{equation}\sin^{-1}x+\cos^{-1}x=\frac{\pi}2.
\label{Arcsine+Arccosine=Pi/2}
\end{equation}
This is verified easily when $0<x<1$ because it reflects that
the acute angles of a right triangle sum to $\pi/2$.
Some checking (which we omit here) shows that
(\ref{Arcsine+Arccosine=Pi/2}) also holds for other cases in
which $x\in[-1,1]$.  With (\ref{Arcsine+Arccosine=Pi/2})
we can take derivatives of both sides and easily
get that $\frac{d}{dx}\cos^{-1}x
=-\frac{d}{dx}\sin^{-1}x$, which reflects why the derivatives
of $\cos^{-1}x$ and $\sin^{-1}x$ are the same except for the
sign.

\subsection{The Arctangent Function and Its Derivative}
\begin{definition} For every $x\in\Re$, define
\begin{equation}y=\tan^{-1}x=\text{ ``that }\theta\in\left(-\frac{\pi}2,
           \frac{\pi}2\right)\text{ such that }\tan\theta=x.\text{''}
       \label{EquationDefiningArctangent}
\end{equation}
\label{DefinitionOfArctangent}
\end{definition}

\noindent
Thus the range we will use for the arctangent function
is $\theta\in\left(-\frac{\pi}2,\frac{\pi}2\right)$.
The graph of $y=\tan^{-1}x$ is a subset of the graph of
$x=\tan y$, as illustrated in Figure~\ref{FigureForX=TangentY,X=ArcTangentY}.

\begin{figure}
\begin{center}

\begin{pspicture}(-6,-4.1)(6,4.1)
\psset{yunit=.5cm}
\psaxes[Dy=20]{<->}(0,0)(-6,-8.2)(6,8.2)
%\parametricplot[linecolor=gray,%
%plotpoints=2000]{-8}{8}{t 180 mul 3.14159265 div cos t}
%\parametricplot[plotpoints=100,linewidth=2pt]%
%{0}{3.14159365}{t 180 mul 3.14159265 div cos t}
\psline(-.2,-3.1415)(.2,-3.1415)
\psline(-.2,3.1415)(.2,3.1415)
\rput[l](.3,-3.1415){$-\pi$}
\rput[l](.3,3.1415){$\pi$}

\psline[linestyle=dashed](-6,7.85398)(6,7.85398)

\parametricplot[linecolor=gray,plotpoints=1000]%
{4.87754}{7.6888}%
{t 180 mul 3.14159265 div sin %
 t 180 mul 3.14159265 div cos div t}

\parametricplot[linecolor=gray,plotpoints=1000]%
{1.7359}{4.5472}%
{t 180 mul 3.14159265 div sin %
 t 180 mul 3.14159265 div cos div t}

\psline[linestyle=dashed](-6.,4.71239)(6,4.71239)
\psline[linestyle=dashed](-6,-1.570796)(6,-1.570796)
\parametricplot[plotpoints=1000,linewidth=2pt]{-1.4056}{1.4056}%
{t 180 mul 3.14159265 div sin %
 t 180 mul 3.14159265 div cos div t}
\psline[linestyle=dashed](-6,1.570796)(6,1.570796)
\parametricplot[linecolor=gray,plotpoints=1000]%
{-1.7359}{-4.54724}%
{t 180 mul 3.14159265 div sin %
 t 180 mul 3.14159265 div cos div t}
\psline[linestyle=dashed](-6.,-4.71239)(6,-4.71239)

\parametricplot[linecolor=gray,plotpoints=1000]%
{-4.87754}{-7.6888}%
{t 180 mul 3.14159265 div sin %
 t 180 mul 3.14159265 div cos div t}
\psline[linestyle=dashed](-6,-7.85398)(6,-7.85398)

\psline(-.2,-6.28)(.2,-6.28)
\psline(-.2,6.28)(.2,6.28)
\rput[l](.3,-6.28){$-2\pi$}
\rput[l](.3,6.28){$2\pi$}
%\pscircle[fillcolor=black,fillstyle=solid](1,0){.07}
%\pscircle[fillcolor=black,fillstyle=solid](-1,3.1415927){.07}

\end{pspicture}
\end{center}
\caption{Partial graph of $x=\tan y$ in gray, with that part of the
graph which represents
$y=\tan^{-1}x$, i.e., that of $\left\{(x,y)\ |\ x=\tan y, y\in
        \left(-\frac{\pi}2,\frac{\pi}2\right)]\right\}$
in black.}
\label{FigureForX=TangentY,X=ArcTangentY}\end{figure}

This function $y=\tan^{-1}x$ has some interesting features.
For instance, the domain
of $\tan^{-1}x$ is all of $\Re$.
so it makes sense to consider its behavior
``at infinity.'' From the graph we can see that
\begin{align}
x\longrightarrow\infty&\implies \tan^{-1}x\longrightarrow{\frac{\pi}2}^-,\\
x\longrightarrow-\infty&\implies \tan^{-1}x\longrightarrow
\left({\frac{-\pi}2}\right)^+.\end{align}
These become important in later sections, as we consider
more limits and discuss improper integrals.

In finding the derivative of the arctangent function, we
proceed as in the earlier derivations,
with Figure~\ref{TrianglesForArcTanX} giving the relevant
triangles.  Note how we construct the triangles, where
$\theta=\tan^{-1}x$.  In doing so we must ensure that
the quadrants and signs of the (vertical and horizontal)
displacements are consistent
with both the Pythagorean Theorem, and the quadrant of the
terminal side of $\theta=\tan^{-1}x$.
Now we proceed with the derivative computation:

\begin{figure}
\begin{center}
\begin{pspicture}(-2.5,-3)(2.5,2.5)
\psaxes[Dx=2,Dy=2,labels=none]{<->}(0,0)(-2.5,-2.5)(2.5,2.5)
\psarc[linestyle=dashed](0,0){2}{90}{270}
\psarc(0,0){2}{-90}{90}
\psline{->}(0,0)(2,2.383507)
\psarc{->}(0,0){.4}{0}{50}
\rput(.6,.3){$\theta$}
\psline[linewidth=2pt]{->}(0,0)(1.285575,0)
\psline[linewidth=2pt]{->}(1.285575,0)(1.285575,1.532)
\rput{50}(.55,1.){$\sqrt{x^2+1}$}

\rput[l](1.45,.75){$x$}
\rput(.65,-.3){$1$}
\rput(0,-3){Case $x\ge0$}

\pscircle[fillstyle=solid,fillcolor=white](0,2){.1}
\pscircle[fillstyle=solid,fillcolor=white](0,-2){.1}

\end{pspicture}
\qquad
\begin{pspicture}(-2.5,-3)(2.5,2.5)
\psaxes[Dx=2,Dy=2,labels=none]{<->}(0,0)(-2.5,-2.5)(2.5,2.5)
\psarc[linestyle=dashed](0,0){2}{90}{270}
\psarc(0,0){2}{-90}{90}
\psline{->}(0,0)(2,-2.383507)
\psarc{<-}(0,0){.4}{-50}{0}
\rput(.6,-.3){$\theta$}
\psline[linewidth=2pt]{->}(0,0)(1.285575,0)
\psline[linewidth=2pt]{->}(1.285575,0)(1.285575,-1.532)
\rput[l](1.45,-.75){$x$}
\rput{-50}(.57,-1.15){$\sqrt{x^2+1}$}
\rput(.65,.3){$1$}
\rput(0,-3){Case $x\le0$}

\pscircle[fillstyle=solid,fillcolor=white](0,2){.1}
\pscircle[fillstyle=solid,fillcolor=white](0,-2){.1}
\end{pspicture}
\end{center}
\caption{Illustration of the two cases for representative triangles
for angles $\theta=\tan^{-1}x$.  In constructing the triangles,
note that we want $\tan\theta=x$, the horizontal displacement to be
positive (we picked $1$), and the hypotenuse to be positive (as is
{\it always} the case, since it is a {\it distance}, unlike the
other two sides which represent horizontal or vertical
{\it displacements}).  Note also that these triangles reside within
circles of radius $\sqrt{x^2+1}$, which are therefore not generally
unit circles.}
\label{TrianglesForArcTanX}
\end{figure}

\begin{alignat*}{2}
&&y&=\tan^{-1}x\\
&\implies\qquad&\tan y&=x\\
&\implies&\frac{d}{dx}(\tan y)&=\frac{d}{dx}(x)\\
&\implies&\sec^2y\cdot\frac{dy}{dx}&=1\\
&\implies&\frac{dy}{dx}&=\cos^2y\\
&\implies&\frac{dy}{dx}&=(\cos y)^2=\left(\frac1{\sqrt{x^2+1}}\right)^2
 =\frac1{x^2+1}.\end{alignat*}
Summarizing this, and the chain rule version, we have
\begin{align}
\frac{d}{dx}\tan^{-1}x&=\frac1{x^2+1},\label{DerivOfArcTanX}\\
\frac{d}{dx}\tan^{-1}u&=\frac1{u^2+1}\cdot\frac{du}{dx}.
   \label{ChainRuleDerivOfArcTanX}
\end{align}
Note that $\frac{d}{dx}\tan^{-1}x=\frac1{x^2+1}>0$ for all $x\in\Re$,
and so the arctangent function is increasing everywhere
(see Figure~\ref{FigureForX=TangentY,X=ArcTangentY}).  Moreover,
the slope of the graph becomes gentler as $|x|$ grows:
\begin{alignat*}{4}&\lim_{x\to\infty}&&\left[\frac{d}{dx}\tan^{-1}x\right]&&=
         \lim_{x\to\infty}\frac1{x^2+1}&&=0,\\
&\lim_{x\to-\infty}&&\left[\frac{d}{dx}\tan^{-1}x\right]&&=
         \lim_{x\to-\infty}\frac1{x^2+1}&&=0.\end{alignat*}
This reflects
the behavior of the slope of $y=\tan^{-1}x$ as the graph approaches
its horizontal asymptotes.

\subsection{The Arcsecant Function and Its Derivative}
We define the arcsecant to be consistent with the arccosine.
We begin with the fact that
$$\sec\theta=x\iff\cos \theta=\frac1x.$$
Since the range of $\cos\theta$ is $|\cos\theta|\le1$,
it follows that the range of secant is
$|\sec\theta|=\left|\frac1{\cos\theta}\right|\ge1$.
We will define the arcsecant so that its domain (input) is
the same as the output of $\sec\theta$, and that its range is the
same as $\cos^{-1}\frac1x$ (almost that of arccosine, except
that $\frac1x\ne0$):
\begin{definition}
For $x\in(-\infty,-1]\cup[1,\infty)$, define
\begin{equation}\sec^{-1}x=\text{ ``that }\theta\in
   \left.\left[0,\frac{\pi}2\right.\right)\cup
   \left.\left(\frac{\pi}2,\pi\right.\right]
   \text{ such that }\sec\theta=x.\text{''} \label{EquationDefiningArcSecantX}
\end{equation}
\label{DefinitionOfArcSecantX}
\end{definition}

There are some complications which arise in the derivation
of the arcsecant function's derivative.  That the derivation is
not as straightforward as the others' is
not surprising when we consider that the arcsecant
function is not even continuous on its domain.
Indeed, when we pick enough
of $x=\sec y$ to cover all possible values for $x$ but
not so much that $y$ is no longer a function of $x$,
we are forced  to take two separate branches
of the graph $x=\sec y$.  In Figure~\ref{X=SecantYGraph},
that part of the graph of $x=\sec y$ which defines
$y=\sec^{-1}x$ is highlighted.

\begin{figure}
\begin{center}

\begin{pspicture}(-6,-4.1)(6,4.1)
\psset{yunit=.5cm}
\psaxes[Dy=20]{<->}(0,0)(-6,-8.2)(6,8.2)
%\parametricplot[linecolor=gray,%
%plotpoints=2000]{-8}{8}{t 180 mul 3.14159265 div cos t}
%\parametricplot[plotpoints=100,linewidth=2pt]%
%{0}{3.14159365}{t 180 mul 3.14159265 div cos t}
\psline(-.2,-3.1415)(.2,-3.1415)
\psline(-.2,3.1415)(.2,3.1415)
\rput[l](.3,-3.1415){$-\pi$}
\rput[l](.3,3.1415){$\pi$}

\psline[linestyle=dashed](-6,7.85398)(6,7.85398)

\parametricplot[linecolor=gray,plotpoints=1000]{4.879834}{7.6865336}%
{1 t 180 mul 3.14159265 div cos div t}

\parametricplot[linecolor=gray,plotpoints=1000]{1.738292}{4.54489}%
{1 t 180 mul 3.14159265 div cos div t}

\psline[linestyle=dashed](-6.,4.71239)(6,4.71239)
\parametricplot[linecolor=gray,plotpoints=1000]{-4.879834}{-7.6865336}%
{1 t 180 mul 3.14159265 div cos div t}
\parametricplot[linecolor=gray,plotpoints=1000]{-1.738292}{-4.54489}%
{1 t 180 mul 3.14159265 div cos div t}

\parametricplot[linecolor=gray,plotpoints=1000]{-1.4033}{1.4033}%
{1 t 180 mul 3.14159265 div cos div t}
\psline[linestyle=dashed](-6,-1.570796)(6,-1.570796)
\parametricplot[plotpoints=1000,linewidth=2pt]{1.7382444}{3.14159265}%
{1 t 180 mul 3.14159265 div cos div t}
\parametricplot[plotpoints=1000,linewidth=2pt]{0}{1.4033}%
{1 t 180 mul 3.14159265 div cos div t}
\psline[linestyle=dashed,linewidth=2pt](-6,1.570796)(6,1.570796)
\psline[linestyle=dashed](-6.,-4.71239)(6,-4.71239)
\psline[linestyle=dashed](-6,-7.85398)(6,-7.85398)

\psline(-.2,-6.28)(.2,-6.28)
\psline(-.2,6.28)(.2,6.28)
\rput[l](.3,-6.28){$-2\pi$}
\rput[l](.3,6.28){$2\pi$}
%\pscircle[fillcolor=black,fillstyle=solid](1,0){.07}
%\pscircle[fillcolor=black,fillstyle=solid](-1,3.1415927){.07}

\pscircle[fillstyle=solid,fillcolor=black](1,0){.08}
\pscircle[fillstyle=solid,fillcolor=black](-1,3.14159265){.08}
\rput(3,2.2){$y=\frac{\pi}2$}

\end{pspicture}
\end{center}
\caption{Partial graph of $x=\sec y$ in gray, with that part of the
graph which represents
$y=\sec^{-1}x$, i.e., that of $\left\{(x,y)\ |\ x=\sec y,\qquad y\in
        \left.\left[0,\frac{\pi}2\right.\right)
        \cup\left.\left(\frac{\pi}2,\pi\right.\right]\right\}$
in black.}
\label{X=SecantYGraph}
\end{figure}

Now we derive $\frac{d}{dx}\sec^{-1}x$.
\begin{alignat*}{2}
&&\qquad \sec y&=x\\
&\implies&\frac{d}{dx}(\sec y)&=\frac{d}{dx}(x)\\
&\implies&\qquad\sec y\tan y\frac{dy}{dx}&=1\\
&\implies&\frac{dy}{dx}&=\cos y\cot y=\cos\left(\sec^{-1}x\right)
                                       \cot\left(\sec^{-1}x\right).
\end{alignat*}

Referring to Figure~\ref{TrianglesForArcSecantX},
we see that the hypotenuse---which always must be positive---is
$x$ when $x$ is positive, and $-x$ when $x$ is negative.
In both cases, we can summarize the hypotenuse as
represented by the quantity $|x|$.  Thus we can continue the implications
above to get
$$y=\sec^{-1}x\implies\frac{dy}{dx}=\cos(\sec^{-1}x)\cot(\sec^{-1}x)
                                   =
\left\{\begin{aligned}\frac1{x}\cdot\frac{1}{\sqrt{x^2-1}},&\quad
               \text{ if }x\ge1,\\
            \frac{-1}{-x}\cdot\frac{-1}{\sqrt{x^2-1}},&\quad\text{ if }x\le-1.
            \end{aligned}\right.
$$
Now we summarize these, using the fact that $x=|x|$ in the expression
for $x\ge1$, while $-x=|x|$ as well in the expression for $x\le-1$.
We also include the chain rule version:
\begin{align}
 \frac{d}{dx}\sec^{-1}x&=\frac1{|x|\sqrt{x^2-1}},\label{ArcSecDeriv}\\
 \frac{d}{dx}\sec^{-1}u&=\frac1{|u|\sqrt{u^2-1}}\cdot\frac{du}{dx}.
     \label{ChainRuleForArcSecant}
\end{align}

\begin{figure}
\begin{center}
\begin{pspicture}(-2.5,-3)(2.5,2.5)
\psaxes[Dx=2,Dy=2,labels=none]{<->}(0,0)(-2.5,-2.5)(2.5,2.5)
\psarc[linestyle=dashed](0,0){2}{180}{360}
\psarc(0,0){2}{0}{180}
\psline{->}(0,0)(1.4434,2.5)
\psarc{->}(0,0){.4}{0}{60}
\rput(.6,.3){$\theta$}
\psline[linewidth=2pt]{->}(0,0)(1,1.7321)
\psline[linewidth=2pt]{->}(1,0)(1,1.7321)
\psline[linewidth=2pt]{->}(0,0)(1,0)
\rput{60}(.4,1.1){$x=|x|$}
\rput[c]{270}(1.3,.75){$\sqrt{x^2-1}$}
\rput(.5,-.3){$1$}
\rput(0,-3){Case $x\ge1>0$}
\pscircle[fillstyle=solid,fillcolor=white](0,2){.1}
\end{pspicture}
\qquad
\begin{pspicture}(-2.5,-3)(2.5,2.5)
\psaxes[Dx=2,Dy=2,labels=none]{<->}(0,0)(-2.5,-2.5)(2.5,2.5)
\psarc[linestyle=dashed](0,0){2}{180}{360}
\psarc(0,0){2}{0}{180}
\psline{->}(0,0)(-1.4434,2.5)
\psarc{->}(0,0){.4}{0}{120}
\rput(.6,.3){$\theta$}
\psline[linewidth=2pt]{->}(0,0)(-1,1.7321)
\psline[linewidth=2pt]{->}(-1,0)(-1,1.7321)
\psline[linewidth=2pt]{->}(0,0)(-1,0)
\rput{-60}(-.4,1.2){$-x=|x|$}

\rput[c]{90}(-1.3,.65){$\sqrt{x^2-1}$}
\rput(-.5,-.3){$-1$}
\rput(0,-3){Case $x\le-1<0$}

\pscircle[fillstyle=solid,fillcolor=white](0,2){.1}

\end{pspicture}
\end{center}
\caption{Illustration of the two cases for representative triangles
for angles $\theta=\sec^{-1}x\in[0,\pi]-\left\{\frac{\pi}2\right\}$.
We draw the triangles so that $\sec\theta=x$, i.e., $\cos\theta=\frac1x$.
In doing so, however, we must be sure that the hypotenuse is always
positive, and that the other two sides have appropriate signs.
In particular, we need the hypotenuse to be $x$ when $x\ge1$
and $-x$ when $x\le-1$.  In both cases the hypotenuse can
be written $|x|$.  Also,
in both cases the
vertical side represents a positive displacement of
$\sqrt{x^2-1}$.}
\label{TrianglesForArcSecantX}
\end{figure}

Notice that (\ref{ArcSecDeriv}) implies that $y=\sec^{-1}x$
is increasing wherever it is differentiable.
Notice also the limiting behavior as $x\to\infty$ and as $x\to-\infty$:
\begin{align}
x\to\infty&\implies \sec^{-1}x\to{\frac{\pi}{2}}^-,\label{ASecAsXToInfty}\\
x\to-\infty&\implies\sec^{-1}x\to{\frac{\pi}{2}}^+.\label{ASecAsXTo-Infty}
\end{align}
We can also see how the derivatives approach zero as $|x|\to\infty$,
as happened with the arctangent function.

A closely related derivative, which is left as an exercise, is
the following (with the chain rule form included):
\begin{align}
\frac{d}{dx}\sec^{-1}|x|&=\frac1{x\sqrt{x^2-1}},\label{DerivASec|X|}\\
\frac{d}{dx}\sec^{-1}|u|&=\frac1{u\sqrt{u^2-1}}\cdot\frac{du}{dx}.
\label{DerivASec|U|}
\end{align}
Equation (\ref{DerivASec|X|})
can be proved using the chain rule and the fact that
$|x|$ is the same as $x$ for $x>0$, and $-x$ for $x<0$.
Both cases, $x>0$ and $x<0$ (actually $x\ge1$, $x\le 1$ to be precise)
should be proved separately.  Equation (\ref{DerivASec|U|}) then
follows from the chain rule.  These
forms are preferred to (\ref{ArcSecDeriv}) and
(\ref{ChainRuleForArcSecant}) when we
compute antiderivatives in later sections.

\subsection{Reciprocal Functions and Their Arctrigonometric Counterparts}
There is another interesting method for computing the
derivative of $\sec^{-1}x$, by referring to the
derivative of the arccosine function.
Recall that we defined the arcsecant's range to be consistent
with that of the arccosine, so that
\begin{equation}\sec^{-1}x=\cos^{-1}\left(\frac1x\right).\end{equation}
We can use this then to compute $\frac{d}{dx}\sec^{-1}x$:
\begin{alignat*}{2}
\frac{d}{dx}\sec^{-1}x
   &=\frac{d}{dx}\cos^{-1}\left(\frac1x\right)
   &&=\frac{-1}{\sqrt{1-\left(\frac1x\right)^2}}\cdot\frac{d}{dx}\left(\frac1x
               \right)\\
   &=\frac{-1}{\sqrt{1-\frac1{x^2}}}\cdot\frac{-1}{x^2}
   &&=\frac{1}{x^2\sqrt{\frac1{x^2}\left(x^2-1\right)}}\\
   &=\frac1{x^2\cdot\frac1{|x|}\sqrt{x^2-1}}.
\end{alignat*}
Now we claim that this is the same as our earlier expression for the
derivative of $\sec^{-1}x$.  The key is to notice that $x^2=|x|^2$
(or just notice that $x^2\cdot\frac1{|x|}$ has to be positive), and
so with our calculation above we get
$$\frac{d}{dx}\sec^{-1}x=\frac{d}{dx}\cos^{-1}\left(\frac1x\right)
                =\cdots=\frac1{x^2\cdot\frac1{|x|}\sqrt{x^2-1}}
                   =\frac1{\frac{|x|^2}{|x|}\sqrt{x^2-1}}
                        =\frac1{|x|\sqrt{x^2-1}},$$
as before.
When we defined $\sin^{-1}x$, $\cos^{-1}x$ and $\tan^{-1}x$,
we chose ranges of angles for these to output.  We can then
{\it define}
\begin{align}
\sec^{-1}x&=\cos^{-1}\left(\frac1x\right),\label{Asec-WRT-Acos}\\
\csc^{-1}x&=\sin^{-1}\left(\frac1x\right),\label{Acsc-WRT-Asin}\\
\cot^{-1}x&=\tan^{-1}\left(\frac1x\right),\label{Acot-WRT-Atan}\end{align}
{\it where the right-hand sides are defined. }
In fact these will give exactly the ranges we use for
arcsecant, arccosecant and arccotangent.\footnotemark
%%% FOOTNOTE
\footnotetext{The only caveat is that one could define $\cot^{-1}0$
to be either $\frac{\pi}2$ or $-\frac{\pi}2$, both outside
the range of the arctangent. Here we will decline to define $\cot^{-1}0$.
The arccotangent function is rarely called upon in practice,
and if it were then the choice of defining $\cot^{-1}0=\pm\frac{\pi}2$
would likely be dictated by the context.}
%%% END FOOTNOTE

It is possible to make the definitions above because
we choose output ranges for the arctrigonometric functions
to be compatible.  In particular, we like the arctrigonometric
functions of reciprocal trigonometric functions
(sine$\leftrightarrow$cosecant, cosine$\leftrightarrow$ secant,
and tangent$\leftrightarrow$cotangent) to have compatible
outputs.

For example, $\sec^{-1}(-2)$ is some angle $\theta$ such that $\sec\theta=-2$.
It is convenient for that to be the same as the
angle $\theta=\cos^{-1}(-\frac12)$, which is
that $\theta\in[0,\pi]$ so that $\cos\theta=\frac{-1}2$,
so we chose a similar range for the arcsecant,
except that we have to avoid $\frac{\pi}2$, where the
secant is undefined.  Thus we chose
$\sec^{-1}(-2)$ to be that angle $\theta\in[0,\pi]-\{\frac{\pi}{2}\}$
such that $\sec\theta=-2$.  By choosing these similar ranges
we are guaranteed to output the same angles.

\subsection{Summary of Arctrigonometric Functions and Their Derivatives}
Table~\ref{TableOfArctrigonometricFunctions}
summarizes  the six arctrigonometric functions' domains,
ranges and derivatives.
It is useful to ``see'' the range
of angles each arctrigonometric function outputs, as so these
outputs are also graphed as angles in ``standard position,''
i.e., measured against the positive horizontal axis.
(It is best not to think of this axis as the ``$x$-axis,''
since here the variable $x$ is the input of the function.)

A couple of important patterns can be seen in the table.
First, the functions and cofunctions come in pairs, and
their derivatives only differ by a sign.  Second,
if we pair these arctrigonometric functions by
the related trigonometric functions which are reciprocal
functions (so pairing $\sin^{-1}x$ to $\csc^{-1}x$,
 $\cos^{-1}x$ to $\sec^{-1}x$, and $\tan^{-1}x$ to $\cot^{-1}x$),
we see the angles outputted by the functions are almost
exactly the same.  The only differences are that we have
to omit angles outside the domain of the related trigonometric
function.

Note that the angles graphed are understood to be between
$-\frac{\pi}2$ and $\pi$.

\begin{center}\underline{\Large{\bf Exercises}}\end{center}
\bigskip
\begin{multicols}{2}
\begin{enumerate}
\item Compute and simplify the following derivatives:
  \begin{enumerate}
  \item $\ds{\frac{d}{dx}\sin^{-1}x^2}$
  \item $\ds{\frac{d}{dx}\cos^{-1}x^2}$
  \item $\ds{\frac{d}{dx}\tan^{-1}x^2}$
  \item $\ds{\frac{d}{dx}\cot^{-1}x^2}$
  \item $\ds{\frac{d}{dx}\sec^{-1}x^2}$
  \item $\ds{\frac{d}{dx}\csc^{-1}x^2}$
  \end{enumerate}
\item Compute the following derivatives:
  \begin{enumerate}
  \item $\ds{\frac{d}{dx}\sqrt{\sin^{-1}x}}$
  \item $\ds{\frac{d}{dx}\sqrt{\cos^{-1}x}}$
  \item $\ds{\frac{d}{dx}\sqrt{\tan^{-1}x}}$
  \item $\ds{\frac{d}{dx}\sqrt{\cot^{-1}x}}$
  \item $\ds{\frac{d}{dx}\sqrt{\sec^{-1}x}}$
  \item $\ds{\frac{d}{dx}\sqrt{\csc^{-1}x}}$
  \end{enumerate}
\item Compute and simplify the following derivatives.  Note
      that necessarily $x,\sqrt{x}\ge 0$ for each of these.
  \begin{enumerate}
  \item $\ds{\frac{d}{dx}\sin^{-1}\sqrt{x}}$
  \item $\ds{\frac{d}{dx}\cos^{-1}\sqrt{x}}$
  \item $\ds{\frac{d}{dx}\tan^{-1}\sqrt{x}}$
  \item $\ds{\frac{d}{dx}\cot^{-1}\sqrt{x}}$
  \item $\ds{\frac{d}{dx}\sec^{-1}\sqrt{x}}$
  \item $\ds{\frac{d}{dx}\csc^{-1}\sqrt{x}}$
  \end{enumerate}
\item Compute the following derivatives:
  \begin{enumerate}
  \item $\ds{\frac{d}{dx}\left[{x\csc^{-1}x}\right]}$  (assume $x>0$)
  \item $\ds{\frac{d}{dx}\left[\frac{\tan^{-1}x}x\right]}$
  \item $\ds{\frac{d}{dx}\left[(x^2+1)\tan^{-1}x-x\right]}$ (simplify answer)
  \item $\ds{\frac{d}{dx}\left[\sin^{-1}\left(\frac{x}3\right)\right]}$
            (simplify answer)
  \item $\ds{\frac{d}{dx}\left[\frac13\tan\frac{x}3\right]}$ (simplify answer)
  \item $\ds{\frac{d}{dx}\left[\sin^{-1}\left(\frac{x}{\sqrt{x^2+1}}
                 \right)\right]}$
  \end{enumerate}
\item Compute $\frac{d}{dx}\left[\sin^{-1}x+\cos^{-1}x\right]$.
 Explain why we should have known the answer would be simple given
 the algebraic relationship between the arcsine and arccosine functions.
\item Compute $\ds{\frac{d}{dx}\sec^{-1}\left(\frac1x\right)}$ two ways:
 \begin{enumerate}
 \item Directly, using the chain rule, and
 \item Rewriting the function as an arccosine function.
 \item Show that the answers are in fact the same.  (You may need to
       consider two cases, $x$ positive and $x$ negative.)
 \end{enumerate}

\end{enumerate}
\end{multicols}

\qquad\newpage

\section{Exponential Functions}
In this section we look at a function $f(x)=e^x$, where
$e$ is a very important, irrational number,\footnotemark\  approximated by
$e\approx2.7182818$.
\footnotetext{%%%
%%% FOOTNOTE
In fact, $e$ is arguably at least equal in importance to $\pi$,
though its importance is not as easily accessible.
%%%
}
What makes this function interesting, among other reasons, is
that $\frac{d}{dx}(e^x)=e^x$. In fact, only functions which are constant
multiples of $e^x$ are their own derivatives.
Before arguing that such a function exists, we will look briefly
at exponential functions $a^x$ in general, after which we will
concentrate on $e^x$.

When we are finished with this section, we will then look at the
inverse functions of the exponential functions.  These inverses
are better known as {\it logarithms}, and their derivatives fill
an important gap in the theory.  Furthermore, these functions
have many useful algebraic properties which we can exploit before
we compute the derivatives.  In fact, in many  problems which do not
explicitly include logarithms, we can introduce them to exploit their
properties to make some derivative computations proceed much faster.

Much of what we do in this section relies upon the fact that
$a^x$ is an everywhere continuous, differentiable function for any $a>0$.
To actually prove this requires integral calculus (the second
part of this text), but this fact is believable through observations.
For our purposes here we will work from this assumption
($a^x$ continuous and differentiable for $a>0$, $x\in\Re$),
see how it is reasonable,
and defer the proof.\footnote{%
%%% FOOTNOTE
The proof that $a^x$ is continuous and differentiable on all of $\Re$
is interesting and worthwhile, but it will be offered
only as a last subsection in a later chapter and section.
It is included there mostly for completeness, as it could be a distraction
from the main thrust of the text.  The proof is  long, and follows a path
which is essentially backwards from how we most easily learn these functions.
It relies upon an alternative definition of logarithms, proves all their
properties still hold with that definition, and then considers
the exponentials as inverses of the logarithms.  It makes for
more mathematically cohesive theory, but is
counterintuitive in its path of discovery.
%%% END FOOTNOTE
}
\subsection{Exponential Functions}

Of course we will have use for the algebraic
rules of exponential functions, which we quickly re-list here.
Assuming $a,b>0$, $r,s\in\Re$,  $m\in\{1,2,3,\cdots\}$ we have
\begin{multicols}{2}
\begin{align*}
a^{r}a^s&=a^{r+s},\\
\frac{a^r}{a^s}&=a^{r-s},\\
a^0&=1,\\
(ab)^r&=a^rb^r,\\
\left(\frac{a}{b}\right)^r&=\frac{a^r}{b^r},\end{align*}\vfill
\begin{align*}
a^{-r}&=\frac1{a^r},\\
\frac1{a^{-r}}&=a^r,\\
a^{1/m}&=\sqrt[m]{a}\\
\left(a^r\right)^s&=a^{r\cdot s},
\\
\end{align*}\end{multicols}

In this subsection we look at functions $f(x)=a^x$.
In order for this function to have domain $x\in\Re$, we
restrict ourselves to $a>0$.  (Think of what
$(-2)^x$ would be for $x=\frac12,\frac14,\frac32,\pi$, etc.)
We will generally avoid the case $a=1$ as well, as the
function $1^x$ is rather trivial.

We will look at two cases separately, namely $a>1$ and $a\in(0,1)$.
For our prototypes, we will look at $a=2$ and $a=\frac12$ specifically,
and argue that the same trends hold for similar $a$'s in their
respective cases.

\begin{example}  Consider the function $f(x)=2^x$.  There are
two trends---which are in fact reflections of each other---that we will
observe with this function:  what happens as $x\to\infty$
and what happens as $x\to-\infty$.  We will do so by incrementing
by 1 in each direction to observe the trends.
\begin{alignat*}{3}
2^0&= 1\qquad\qquad&\qquad\qquad2^{-1} &=\frac12&&=0.5\\
2^1&= 2&2^{-2}&=\frac14&&=0.25\\
2^2&= 4&2^{-3}&=\frac18&&=0.125\\
2^3&= 8&2^{-4}&=\frac1{16}&&=0.0625\\
2^4&= 16&2^{-5}&=\frac1{32}&&=0.03125\\
2^5&= 32&2^{-6}&=\frac1{64}&&=0.015625\\
2^6&= 64&2^{-7}&=\frac1{128}&&=0.0078125\\
2^7&= 128&2^{-8}&=\frac1{256}&&=0.00390625\\
2^8&= 256&2^{-9}&=\frac1{512}&&=0.001953125\\
2^9&= 512&2^{-10}&=\frac1{1024}&&=0.0009465625\\
2^{10}&= 1024&&\text{etc.}
\end{alignat*}

These trends continue as $x\to\infty$ and $x\to-\infty$.
They are also predictable since
$$2^{x+1}=2^x2^1=2^x\cdot2,\qquad\qquad 2^{x-1}=2^x2^{-1}=2^x\cdot\frac12.$$
In other words, for every increment of one to the right, the height of
the function is multiplied by a factor of 2; a movement of one to the
left lowers the function's height by half.

To Compute $2^r$ for rational numbers $r=\frac{p}q$
where $q\in\mathbb{N}$
is to compute $2^{p/q}=\sqrt[q]{2^p}$.  For an irrational number
$s\in\mathbb{R}-\mathbb{Q}$, we simply take any sequence
of rational numbers $r_1,r_2,\cdots$ so that $r_n\longrightarrow s$
and define $2^s=\lim_{n\to\infty}2^{r_n}$.  In doing so we
can eventually define $2^x$ for any $x\in\Re$, thus achieving
the first graph in  Figure~\ref{2^X,2^-XGraphs},
page~\pageref{2^X,2^-XGraphs}.
\label{NeedPageForIrrationalPowersOfAExplained}
\end{example}
\begin{figure}
\begin{center}
\begin{pspicture}(-3,-1)(3,6)
\psset{xunit=.5cm,yunit=.5cm}
\psaxes[Dy=2]{<->}(0,0)(-6,-2)(6,10)
\psplot{-6}{3.321928095}{2 x exp}

\pscircle[fillstyle=solid,fillcolor=black](-3,.125){.07}
\pscircle[fillstyle=solid,fillcolor=black](-2,.25){.07}
\pscircle[fillstyle=solid,fillcolor=black](-1,.5){.07}
\pscircle[fillstyle=solid,fillcolor=black](0,1){.07}
\pscircle[fillstyle=solid,fillcolor=black](1,2){.07}
\pscircle[fillstyle=solid,fillcolor=black](2,4){.07}
\pscircle[fillstyle=solid,fillcolor=black](3,8){.07}

\rput(0,11.3){$\ds{y=2^x}$}
\end{pspicture}
\qquad\qquad
\begin{pspicture}(-3,-1)(3,6)
\psset{xunit=.5cm,yunit=.5cm}
\psaxes[Dy=2]{<->}(0,0)(-6,-2)(6,10)
\psplot{-3.321928095}{6}{.5 x exp}

\pscircle[fillstyle=solid,fillcolor=black](3,.125){.07}
\pscircle[fillstyle=solid,fillcolor=black](2,.25){.07}
\pscircle[fillstyle=solid,fillcolor=black](1,.5){.07}
\pscircle[fillstyle=solid,fillcolor=black](0,1){.07}
\pscircle[fillstyle=solid,fillcolor=black](-1,2){.07}
\pscircle[fillstyle=solid,fillcolor=black](-2,4){.07}
\pscircle[fillstyle=solid,fillcolor=black](-3,8){.07}

\rput(0,11.3){$\ds{y=\left(\frac12\right)^x=2^{-x}}$}

\end{pspicture}

\end{center}
\caption{Partial graphs of $y=2^x$ and $y=\left(\frac12\right)^x=2^{-x}$.
In both, a move to the right or left by one unit causes a
change in the height of the graph, by a factor of 2. Such functions
whose values
change by a (positive) constant factor with each increment are called
{\it exponential}.  Increasing exponential functions are said to
represent {\it exponential growth}, while decreasing
exponential functions represent {\it exponential decay}.}
\label{2^X,2^-XGraphs}
\end{figure}

To be sure, the argument above is not rigorous. With later techniques
we can eventually have a rigorous proof, but the
graph should be somewhat convincing, at least in its
behavior at the integers.  In fact, we can eventually
prove that
\begin{itemize}
\item $f(x)=2^x$ is continuous for all $x\in\Re$,
\item $f(x)=2^x$ is one-to-one as a function $f:\Re\longrightarrow(0,\infty)$.
\end{itemize}
Taking these facts and the
graph for granted, we also notice the following limiting
behavior:
\begin{alignat}{2}x&\longrightarrow\infty&&\implies 2^x
                \longrightarrow\infty,\label{2^XAsXToInfty}\\
               x&\longrightarrow-\infty&&\implies 2^x
                \longrightarrow 0^+.\label{2^XAsXTo-Infty}
\end{alignat}
We now contrast this behavior with that of
the related function $g(x)=\left(\frac12\right)^x$.

\bex Consider $g(x)=\left(\frac12\right)^x$. Some points
on the graph of this function are indicated below:
\begin{alignat*}{2}
2^0&= 1\qquad\qquad&\qquad\qquad2^{-1}
         &=\left(\frac12\right)^{-1}=2\\
2^1&= \frac12=0.5&2^{-2}
         &=\left(\frac12\right)^{-2}=4\\
2^2&= \frac14=0.25&2^{-3}
         &=\left(\frac12\right)^{-3}=8\\
2^3&= \frac18=0.125&2^{-4}
         &=\left(\frac12\right)^{-4}=16.
\end{alignat*}
Such a function shrinks in height by a factor of $1/2$
with each increment of one unit to the right in $x$, and
increases by a factor 2 with each increment of one unit to the left.
Thus the behavior of $g(x)=\left(\frac12\right)^x$ is thus just the
opposite of that of $f(x)=2^x$.  This is not surprising, when
we realize one is just the reflection of the other in the sense that
$g(x)=f(-x)$:
$$g(x)=\left(\frac12\right)^x=\frac1{2^x}=2^{-x}=f(-x).$$
This function $g(x)$ is illustrated by the second graph in
Figure~\ref{2^XAsXTo-Infty}.
\eex

Any function of the form
$f(x)=a^x$ where $a>1$ represents a function which increases
by the factor $a>1$ with every increment to the right.
Such behavior will ultimately imply $a^x\longrightarrow\infty$ as
$x\longrightarrow\infty$, and $a^x\longrightarrow0^+$ as
$x\longrightarrow-\infty$.
On the other hand, we get the opposite if $a\in(0,1)$, for
we can then write $a^x=\left(\frac1a\right)^{-x}$,
which is of the form $b^{-x}$ where $b=\frac1a>1$.  This
limiting behavior is summarized below:
\begin{align*}
a>1&\implies\left\{\begin{array}{ccccccc}a^x&\longrightarrow&\infty
                     &\text{ as }&x&\longrightarrow&\hphantom{-}\infty,\\
                     a^x&\longrightarrow&0^+
                     &\text{ as }&x&\longrightarrow
                          &-\infty,\end{array}\right.\\
a\in(0,1)&\implies\left\{\begin{array}{ccccccc}a^x&\longrightarrow&0^+
                     &\text{ as }&x&\longrightarrow&\hphantom{-}\infty,\\
                     a^x&\longrightarrow&\infty
                     &\text{ as }&x&\longrightarrow&-\infty.\end{array}\right.
\end{align*}
The rate at which this limiting behavior occurs depends upon
$a$.  For instance, $3^x$ increases faster than $2^x$ as $x$ increases,
and therefore decreases faster as $x$ decreases.  Since
$2^x$ and $3^x$ agree at $x=0$, and are positive everywhere, we thus have
\begin{align*}
 x>0&\implies 3^x>2^x>0,\\ x<0&\implies0\hphantom{{}^x}< 3^x<2^x.\end{align*}
Similarly $\left(\frac13\right)^x$ shrinks faster than
$\left(\frac12\right)^x$ as $x$ increases, with the opposite
occurring as $x$ decreases.  Next we see how dramatic this difference
in growth, of $2^x$ versus $3^x$, in two ways:

\bex Show that $3^x$ grows faster than $2^x$ as $x\longrightarrow\infty$.

\underline{Solution}: Note first that $3^x$ and $2^x$ are both
increasing as $x$ increases, and have the same value at $x=0$.  That is,
$y=3^x$ and $y=2^x$ both contain the point $(0,1)$.
Furthermore,
$$\lim_{x\to\infty}\left(3^x-2^x\right)
  =\lim_{x\to\infty}\left[2^x\left(\left(\frac32\right)^x-1\right)\right]
         \overset{\infty\cdot(\infty-1)}{\llongeq}\infty.$$
Thus $3^x$ is an increasing distance above
$2^x$, and in fact that distance increases without bound.
Alternatively,
we can  show $3^x$ grows significantly faster
than $2^x$ by noting that
$$\lim_{x\to\infty}\frac{3^x}{2^x}\underset{\text{ALG}}{
 \overset{\frac{\infty}{\infty}}{\longeq}}
      \lim_{x\to\infty}{\underbrace{\left(3/2\right)}_{>1}}^{\ x}=\infty,$$
so $3^x$ is a nonconstant multiple of $2^x$, and that multiple
(namely $\left(\frac32\right)^x$) is blowing up as $x\to\infty$.
\eex

\subsection{Derivative of a Special Exponential Function}

\begin{figure}
\begin{center}
\begin{pspicture}(-4,-2)(4,6.5)
\psset{xunit=2cm,yunit=2cm}
\psaxes{<->}(0,0)(-2,-1)(2,3.25)
\psplot[plotpoints=1000,linewidth=.25pt]{-2}{1.584962501}{2 x exp}
\psplot[plotpoints=1000,linewidth=1pt]{-2}{1.098612289}{2.718271828 x exp}
\psplot[plotpoints=1000,linewidth=.5pt]{-2}{1}{3 x exp}
\rput(.9,3.1){$3^x$}
\rput(1.2,3.1){$e^x$}
\rput(1.7,3.1){$2^x$}

\end{pspicture}

\end{center}
\caption{Graphs of $2^x$, $e^x$ and $3^x$.  Only $y=e^x$
has slope $1$ at $x=0$, which implies ultimately that
$\frac{d}{dx}(e^x)=e^x$. See the discussion leading
to (\ref{DerivativeOfEXP}) and (\ref{ChainRuleDerivativeOfEXP}).}
\label{ThreeExponentialsWithEXPBetween}
\end{figure}

If we look back at the (computer generated) graphs
in Figure~\ref{2^X,2^-XGraphs}, page~\pageref{2^X,2^-XGraphs}
it is not unreasonable to expect
that slope can be defined along these curves.
Indeed, that is the case, though again we must wait to have more
tools with which to prove it.  Still, if
we take for granted that $a>0\implies \frac{d}{dx}(a^x)$ exists, we can
perform the following computation.  Note
that $a^x$ is constant in the limit (which varies $\Delta x$,
and not $x$ itself).
\begin{alignat*}{2}
f(x)=a^x&\implies&f'(x)&=\lim_{\Delta x\to 0}\frac{f(x+\Delta x)-f(x)}
                            {\Delta x}\\
        &&&=\lim_{\Delta x\to0}\frac{a^{x+\Delta x}-a^x}{\Delta x}\\
        &&&=\lim_{\Delta x\to0}\frac{a^x(a^{\Delta x}-a^0)}{\Delta x}\\
        &&&=a^x\cdot\lim_{\Delta x\to0}\frac{a^{0+\Delta x}-a^0}{\Delta x}\\
        &&&=a^x\cdot\lim_{\Delta x\to0}\frac{f(0+\Delta x)-f(0)}{\Delta x}\\
        &&&=a^x\cdot f'(0).
\end{alignat*}
To get the last line from the one immediately prior
is just to recognize the definition of $f'(0)$.  In all cases $a>0$ we see that
\begin{equation}f(x)=a^x\implies f'(x)=a^x\cdot f'(0).\label{da^x/dxInTheory}
\end{equation}
So if $f(x)=a^x$, then $f'(x)$ is a constant multiple of the
original function $a^x$,
that constant---namely $f'(0)$---depending upon $a$.

Now, perhaps with the aid of a computer to approximate $f'(0)$
for various functions $f(x)=a^x$, it can be determined (for now without proof)
that
\begin{alignat*}{3}
f(x)&=2^x&&\implies&f'(0)&\approx0.69314718,\\
f(x)&=3^x&&\implies&f'(0)&\approx1.09861229.\end{alignat*}
Due to the nature of the functions, it is not hard to see that the
larger the base $a$, the greater the slope of the graph of $a^x$.
So for $b\in(2,3)$, we get the slope of $b^x$ at $x=0$ should
be between that of $2^x$ and $3^x$ at $x=0$.
It is then reasonable to believe that for some number
$e\in(2,3)$, we will get $f'(0)=1$, so that (\ref{da^x/dxInTheory})
becomes
\begin{equation}f(x)=e^x\implies f'(x)=e^x\cdot1=e^x.\end{equation}
In fact, that number $e$ does exist (and we will find other ways
to {\it derive} it much later), and $e^x$ is
graphed along with $2^x$ and $3^x$ in
Figure~\ref{ThreeExponentialsWithEXPBetween}.
Thus we  have a derivative
formula, with the chain rule version following as always:

\begin{equation}
\frac{d\,e^x}{dx}=e^x,\label{DerivativeOfEXP}\qquad\qquad
\frac{d\,e^u}{dx}=e^u\cdot\frac{du}{dx}.
\end{equation}
The number $e$ is irrational, but can be given approximately by\footnote{%
%%% FOOTNOTE
We list 50 places after the decimal point because many students get the
wrong impression when seeing the standard $e\approx2.718281828$, leading
them to leap to the conclusion that there is a pattern in the decimal
representation.  Of course, the number $2.7\overline{1828}$ is
a ``repeating decimal'' and therefore rational, unlike $e$ which is
irrational.  (An interesting algebra exercise is to show that
$2.7\overline{1828}=271,801/99,990$, an obviously rational number.)%%%
%%% END FOOTNOTE
}
\begin{equation}
e\approx2.71828\ 18284\ 59045\ 23536\ 02874\ 71352\ 66249\ 77572\ 47093\ 69996.
\label{EXP(1),Approximately}
\end{equation}
The function $e^x$, together with $2^x$ and $3^x$, is given
in Figure~\ref{ThreeExponentialsWithEXPBetween}.
Later we will show that only constant multiples of $e^x$
are their own derivative functions.  Now we can
include such functions in derivative problems.

\bex Compute $\ds{\frac{d}{dx}(e^x)^2}$ two different ways:
first by the chain rule in the obvious way, and then by
instead rewriting the function using properties of exponents.

\underline{Solution}:
\begin{enumerate}[(a)]
\item $\ds{\frac{d(e^x)^2}{dx}=2(e^x)\frac{d\,e^x}{dx}=2e^x\cdot e^x=2e^{2x}}$.
\item $\ds{\frac{d(e^x)^2}{dx}=\frac{d\,e^{2x}}{dx}
          =e^{2x}\cdot\frac{d\,2x}{dx}=e^{2x}\cdot2=2e^{2x}}$.
\end{enumerate}
\eex
Of course we expect to be able to rewrite a function algebraically
before computing a derivative, and perhaps save some work
in the derivative steps.
\bex Compute $\ds{\frac{d}{dx}\left[\frac{e^x}{e^{8x}}\right]}$.

\underline{Solution}:
$\ds{\frac{d}{dx}\left[\frac{e^x}{e^{8x}}\right]
 =\frac{d}{dx}e^{x-8x}=\frac{d}{dx}e^{-7x}
 =e^{-7x}\frac{d}{dx}(-7x)=-7e^{-7x}}$.
\eex
The above example could have been computed using the
quotient rule (an interesting exercise), but the
algebraic simplification made this easier.
Now we list several further examples, all of which should
be self-explanatory.
\begin{itemize}
\item $\ds{\frac{d}{dx}(5e^x)=5\cdot\frac{d}{dx}e^x=5e^x}$.
\item $\ds{\frac{d}{dx}e^{x^2}=e^{x^2}\cdot\frac{d\,x^2}{dx}
             =e^{x^2}\cdot2x=2xe^{x^2}}$.
\item $\ds{\frac{d}{dx}\sin e^x=\cos e^x\cdot\frac{d\,e^x}{dx}
             =\cos e^x\cdot e^x=e^x\cos e^x}$.
\item $\ds{\frac{d}{dx}\sin^{-1}e^x=\frac{1}{\sqrt{1-(e^x)^2}}
              \cdot\frac{d}{dx}(e^x)=\frac1{\sqrt{1-e^{2x}}}\cdot e^x
               =\frac{e^x}{\sqrt{1-e^{2x}}}}$.
\item $\ds{\frac{d}{dx}\left[\frac{e^x}{x^2}\right]
              =\frac{x^2\frac{d}{dx}\left(e^x\right)
                       -e^x\frac{d}{dx}\left(x^2\right)}{(x^2)^2}
              =\frac{x^2e^x-e^x\cdot2x}{x^4}
              =\frac{xe^x(x-2)}{x^4}=\frac{e^x(x-2)}{x^3}}$.
\item $\ds{\frac{d}{dx}(e^{\csc x})
              =e^{\csc x}\frac{d}{dx}(\csc x)
              =e^{\csc x}(-\csc x\cot x)
              =-e^x\csc x\cot x}$.
\item $\ds{\frac{d}{dx}(e^{2x}\sin3x)
              =e^{2x}\frac{d\,\sin3x}{dx}+\sin3x\frac{d\,e^{2x}}{dx}
              =e^{2x}\cos 3x\frac{d\,3x}{dx}+\sin3x\cdot e^{2x}\frac{d\,2x}{dx}
              }$

              \qquad\qquad
              $=3e^{2x}\cos3x+2e^{2x}\sin3x=e^{2x}(3\cos3x+2\sin3x).$
\item $\ds{\frac{d}{dx}\sec^{-1}e^x
         =\frac1{|e^x|\sqrt{(e^x)^2-1}}\cdot\frac{d}{dx}\left(e^x\right)
         =\frac1{{e^x}\sqrt{e^{2x}-1}}\cdot e^x
         =\frac1{\sqrt{e^{2x}-1}}.}$

Here we used the fact that $e^x>0$ for all $x$, so that $|e^x|=e^x$.
\item $\ds{\frac{d}{dx}\sqrt[3]{e^{5x}}
              =\frac{d}{dx}\left[(e^{5x})^{1/3}\right]
              =\frac{d}{dx}(e^{(5/3)x})
              =e^{(5/3)x}\cdot\frac{d[(5/3)x]}{dx}
              =\frac53e^{(5x/3)}}$.
\end{itemize}
These are all exercises involving the old differentiation rules,
combined with our newest derivative formula (\ref{DerivativeOfEXP}).
In the last problem above, we simplified first to avoid calling
an extra chain rule.

\subsection{Note on Differences Between Polynomials, Exponentials}
It should be well noted that these functions $a^x$ in general,
and $e^x$ in particular, are very different from
any of the other functions we had previously.  Even though
they involve powers, in the past the $x$-variable was
part of the {\bf base}, and {\bf not the exponent}.
Compare the behavior of $x^2$ and $2^x$, for instance,
as well as the natures of their derivatives.
For a more dramatic example, consider
\begin{align*}
\frac{d}{dx}x^{20}&=20x^{19},\\
\frac{d}{dx}20^x  &=20^x\cdot k,\qquad\qquad k=\left.\frac{d\,20^x}{dx}
         \right|_{x=0}.
\end{align*}
Not only are the power rule and exponential rule formulas not
the same, but the power rule in the polynomial
example decreases the power for the derivative, which does
not occur in the exponential problem.\footnote{%%%
%%% FOOTNOTE
A common mistake among novice calculus students
is treat exponential functions as if they are similar to polynomials
when, for instance, computing derivatives.
It is important to notice, for example, that
$$\frac{d}{dx}20^x\ne x\cdot 20^{x-1}.$$
The above derivative is not a power rule.  Power rules
assume the variable is in the base, not the exponent
(and that the exponent is a constant).
%%% END FOOTNOTE
}  The two functions share at most a vague resemblance in their
behaviors.  (Both increase without bound, but that is almost where
the similarities end.)
It is very different to raise the (variable) $x$ to a constant power, than to
take a constant raised to the (variable) $x$th power.
In fact we will be able to show later that any
exponential growth will trump any polynomial growth:
\begin{equation}\lim_{x\to\infty}\frac{a^x}{x^n}=\infty\qquad \text{for }a>1,
    \text{ and any fixed }n.\label{LimitA^X/X^NAsXToInfty}
\end{equation}
Thus, though the trend would not show itself until $x$ is
almost unimaginably large,
we have for example
$$\lim_{x\to\infty}\frac{(1.0000000000000000001)^x}{x^{1000}}=\infty.$$
It would require special programming, with a very large
number of significant digits allowed, to see this trend
with the help of a computer, though in a later chapter
we will be able to prove the limit above with ease.
\newpage
\begin{center}\underline{\Large{\bf Exercises}}\end{center}
\bigskip
\begin{multicols}{2}
\begin{enumerate}
\item Compute the following derivatives (in pairs):
\begin{enumerate}
  \item $\ds{\frac{d}{dx}e^{\sin x}}$,\qquad $\ds{\frac{d}{dx}\sin e^x}$
  \item $\ds{\frac{d}{dx}e^{\cos x}}$,\qquad $\ds{\frac{d}{dx}\cos e^x}$
  \item $\ds{\frac{d}{dx}e^{\tan x}}$,\qquad $\ds{\frac{d}{dx}\tan e^x}$
  \item $\ds{\frac{d}{dx}e^{\cot x}}$,\qquad $\ds{\frac{d}{dx}\cot e^x}$
  \item $\ds{\frac{d}{dx}e^{\sec x}}$,\qquad $\ds{\frac{d}{dx}\sec e^x}$
  \item $\ds{\frac{d}{dx}e^{\csc x}}$,\qquad $\ds{\frac{d}{dx}\csc e^x}$
\end{enumerate}
\item Compute the following derivatives (in pairs):
\begin{enumerate}
  \item $\ds{\frac{d}{dx}e^{\sin^{-1} x}}$,\qquad
                   $\ds{\frac{d}{dx}\sin^{-1} e^x}$
  \item $\ds{\frac{d}{dx}e^{\cos^{-1} x}}$,\qquad
                    $\ds{\frac{d}{dx}\cos^{-1} e^x}$
  \item $\ds{\frac{d}{dx}e^{\tan^{-1} x}}$,\qquad
                    $\ds{\frac{d}{dx}\tan^{-1} e^x}$
  \item $\ds{\frac{d}{dx}e^{\cot^{-1} x}}$,\qquad
                    $\ds{\frac{d}{dx}\cot^{-1} e^x}$
  \item $\ds{\frac{d}{dx}e^{\sec^{-1} x}}$,\qquad
                    $\ds{\frac{d}{dx}\sec^{-1} e^x}$
  \item $\ds{\frac{d}{dx}e^{\csc^{-1}x}}$, \qquad
                    $\ds{\frac{d}{dx}\csc^{-1} e^x}$
  \end{enumerate}
\item Compute the following derivatives by first
rewriting the original function using properties
of exponents. (These will still require chain rules.)
\begin{enumerate}
  \item $\ds{\frac{d}{dx}\sqrt{e^x}}$
  \item $\ds{\frac{d}{dx}\left[\frac1{e^x}\right]}$
  \item $\ds{\frac{d}{dx}(e^{2x})^{9}}$
  \item $\ds{\frac{d}{dx}\left(e^xe^{3x}\right)}$
  \item $\ds{\frac{d}{dx}\left[\frac{e^{5x}}{e^{3x}}\right]}$
\end{enumerate}
\item Compute the following derivatives:
\begin{enumerate}
  \item $\ds{\frac{d}{dx}\left(e^{x^2}\right)}$
  \item $\ds{\frac{d}{dx}\left(e^{-x}\right)}$
  \item $\ds{\frac{d}{dx}\left(e^{\sqrt{x}}\right)}$
  \item $\ds{\frac{d}{dx}\left(e^{-1/x^2}\right)}$
  \item $\ds{\frac{d}{dx}(2e^x+9)^4}$
  \item $\ds{\frac{d}{dx}\sin^2e^{x^3}}$
  \item $\ds{\frac{d}{dx}\left(x^3e^x\right)}$ (factor your answer)
  \item $\ds{\frac{d}{dx}\left[\frac{e^{2x}}{x^2+1}\right]}$
  \item $\ds{\frac{d}{dx}\left[\frac{e^x}5\right]}$
            (rewrite as a multiplication first)
  \item $\ds{\frac{d}{dx}\left[\frac{e^x-e^{-x}}{2}\right]}$
  \item $\ds{\frac{d}{dx}e^{e^x}}$
  \item $\ds{\frac{d}{dx}(xe^x-x)}$ (simplify your answer)

\end{enumerate}
\item For general $a>1$,  use the facts that $a^x>0$ for all $x$,
     and  that $x>0\implies a^x>1$
      to prove that $a^x$ is increasing, i.e.,
      $x_1<x_2\implies a^{x_1}<a^{x_2}$.
      (Hint: consider $a^{x_2}-a^{x_1}$, factor, and show this is
       positive.)
\end{enumerate}
\end{multicols}

\newpage
\section{The Natural Logarithm I}
In this section we introduce the function which is the inverse
to $e^x$, namely the {\it natural logarithm} of $x$,
denoted $\ln x$.  Its derivative, as in the case with
the arctrigonometric functions, is surprisingly
simple and algebraic, and has nothing algebraically to do with
logarithms, trigonometric, arctrigonometric or exponential
functions.

We will derive the derivative of the natural logarithm,
and look at several examples of derivatives involving
this function.
Before exploring the calculus of the natural logarithm, we
will review the algebra of general logarithm functions.
In doing so, we will see examples where what would be
difficult derivatives can be found more quickly when we
rewrite the function to a more convenient form for calculus,
using the algebraic properties of logarithms.

In the next section, we will use algebraic techniques to
extend the results here to
compute derivatives of more general logarithm and exponential
functions, such as $\log_ax$ and $a^x$.  We will also
develop a technique known as logarithmic differentiation
which will allow faster differentiation in many cases,
as well as differentiation of functions of the
form $f(x)^{g(x)}$ (where the base {\it and} the exponent
are both allowed to vary).

\subsection{Algebra of Logarithms}
For $a\in(0,1)\cup(1,\infty)$ we define below the logarithm---with base
$a$---of $x$, written $\log_ax$, as described below:
\begin{definition} For $x>0$,
$\log_ax$ is that number $y$ so that $a^y=x$.  In other words,
$\log_ax$ is that power of $a$ which yields $x$.
\end{definition}
\bex Consider the following logarithm computations:
\begin{alignat*}{3}
\log_28&=3\qquad&\qquad &\text{since}&\qquad\qquad2^3&=8,\\
\log_39&=2&&\text{since}&3^2&=9,\\
\log_{10}\frac1{100}&=-2&&\text{since}&10^{-2}&=\frac1{100},\\
\log_{16}2&=\frac14&&\text{since}&16^{1/4}&=2,\\
\log_{27}9&=\frac23&&\text{since}&27^{2/3}&=9,\\
\log_{4}\frac18&=-\frac32&&\text{since}&4^{-3/2}&=\frac18.
\end{alignat*}
\eex
An observation which follows very quickly from the definition
of the logarithms is the following:
\begin{equation}
\log_aa^x=x.\label{LogBaseAOfA^X=X...FirstTime}
\end{equation}
We will make repeated use of that observation.
For now we note that  with (\ref{LogBaseAOfA^X=X...FirstTime})
we can perform computations as above by instead rewriting
the argument of the logarithm as a power of $a$:
\bex We compute the following examples using
(\ref{LogBaseAOfA^X=X...FirstTime}).
\begin{alignat*}{2}
\log_28&=\log_22^3&&=3,\\
\log_{10}1000&=\log_{10}10^3&&=3,\\
\log_84&=\log_88^{2/3}&&=2/3,\\
\log_3\frac1{81}&=\log_33^{-4}&&=-4,\\
\log_aa&=\log_aa^1&&=1.
\end{alignat*}
\eex
Now we list some properties of logarithms based upon
the definition.  We also show how they mirror the related
properties of exponents.  In the table below, assume
$M=a^m$ and $N=a^n.$

\begin{center}
\begin{tabular}{lcl}
{Logarithmic Property}&\qquad\qquad&{Exponential Property}\\
\hline
&&\\
&&\\
1. $\ds{\log_a(MN)=\log_aM+\log_aN}$ &&1. $\ds{a^ma^n=a^{m+n}}$\\
&&\\
2. $\ds{\log_a\frac{M}N=\log_aM-\log_aN}$&&2. $\ds{\frac{a^m}{a^n}
                                                  =a^{m-n}}$\\
&&\\
3. $\ds{\log_a M^p=p\cdot\log_aM}$&&3. $\ds{(a^m)^p=a^{mp}}$\\
&&\\
4. $\ds{\log_a1=0}$&&4. $\ds{a^0=1}$\\
&&\\
5. $\ds{\log_a\frac1M=-\log_aM}$&&5. $\ds{a^{-m}=\frac1{a^m}}$

\end{tabular}
\end{center}

The first logarithmic property reflects the first exponential
property in the following way.  When we say $M=a^m$ and $N=a^n$,
we can think of these as stating
that while $M$ represents $m$ factors of $a$, and $N$ represents $n$
factors of $a$, it follows that  $MN$ represents $m+n$ factors of $a$:

\begin{align*}
\log_a(\underbrace{\underbrace{M}_{a^m}\underbrace{N}_{a^n}}_{a^{m+n}})
&=\log_a\underbrace{M}_{a^m}\ +\ \log_a\underbrace{N}_{a^n},\text{ i.e.,}\\
\log_{a}a^{m+n}&=\log_aa^m+\log_aa^n,\text{ i.e.,}\\
m+n&=\qquad m\quad+\qquad n.\end{align*}

This makes perfect sense if $m,n\in\{0,1,2,3,4,\cdots\}$,
but we can also  make sense of having a half-factor of $a$, which
is then $a^{1/2}$, i.e., the square root of $a$.  We
can also talk about having $-3$ factors of $a$, which is
like removing 3 factors, or dividing by $a^3$, which is
the same as having a factor of $a^{-3}$. Extending this
to all real powers of $a$, we can say that by a number
representing $m$ factors of $a$ means that number being $a^m$,
as we would have computed in the previous section.
(For that discussion, see page
\pageref{NeedPageForIrrationalPowersOfAExplained}.)

The second property says, roughly, that if we have $m$ factors
of $a$, and we divide by $n$ factors of $a$, then
we are left with $m-n$ factors of $a$.

The third says that if $M$ represents $m$ factors of $a$,
then $M^p$ represents $p\cdot m$ factors of $a$.

The fourth can be interpreted as meaning, in the context of
multiplication\footnote{%%%
%%% FOOTNOTE
In the context of addition, having ``nothing,'' i.e., subtracting
everything would mean being left with
only zero to add.  In multiplication, we can divide everything
leaving ``nothing,'' in a sense meaning being left with the
factor 1 only.  In addition, we can say we begin with zero;
in multiplication, the factor 1.
%%% END FOOTNOTE
} (which is arguably the context of exponents and therefore
ultimately logarithms), having no factors of $a$ is the same
as being left with the factor 1 only.  Of course it also
follows from our definition of logarithms, since 1 is the
zeroth power of $a$.

The fifth property can be achieved by the second (with help from
the fourth) or from the third:
\begin{alignat*}{3}
\log_a\frac1M&=\log_a1-\log_aM&&=0-\log_aM&&=-\log_aM,\\
\log_a\frac1M&=\log_a(M)^{-1}&&=-1\log_aM&&=-\log_aM.
\end{alignat*}

%NEED EXAMPLES!!!!!!

Note that the algebraic properties of logarithms follow because
logarithms are about
counting {\it factors} of the base $a$, and so products, quotients
and powers are more relevant to logarithms.  Thus there are
no simple, general rules for expanding $\log_a(M+N)$ or $\log_a(M-N)$,
for instance.

However there is one last, crucial property which requires mention,
since we may be interested in computing approximations to
numbers such as $\log_23$, though our calculating devices
generally do not come equipped with the function $\log_2x$.
Thus we need a ``change of base'' formula, which follows.
In what is below, we assume $a,b\in(0,1)\cup(1,\infty)$,
which (as explored in the exercises)
is what we require of ``proper bases'' for a logarithm.
In the next section we will prove the change of base formula:
\begin{equation}
\log_ax=\frac{\ds{\log_bx}}{\ds{\log_ba}}.\label{ChangeOfBase}
\end{equation}
If we let $b=10$ we can compute on a standard scientific calculator
$$\log_23=(\log_{10}3)/(\log_{10}2)\approx1.584962501.$$
This is reasonable, since $2^1=1$ and $2^2=4$, and $f(x)=2^x$
is continuous on all of $\Re$,
so for some $x\in(1,2)$ we have $2^x=3$.  (See
Figure~\ref{2^X,2^-XGraphs}, page \pageref{2^X,2^-XGraphs}.)

It should be pointed out that most scientific calculators have
two logarithmic keys:
$\log_{10}x$, labeled ``$\log x$'' and $\log_ex$
given by ``$\ln x$.''  Though many sciences use the
logarithm with base 10, for calculus it turns out that
$\ln x$ is much more useful, as we will see.\footnote{%%%
%%% FOOTNOTE
One has to be careful when reading formulas which contain
``$\log x$,'' because while most texts mean by this $\log_{10}x$,
there are some which will mean $\log_ex$, i.e., $\ln x$.
The problem is akin to knowing if $\sin x$ is a function of
$x$ in radians, or in degrees.  We will always write
$\ln x$ for $\log_{e}x$, and $\log x$ for $\log_{10}x$.
%%% END FOOTNOTE
}

One interesting aspect of (\ref{ChangeOfBase}) is that
every function $\log_ax$ is a constant multiple of every
other such function.  For instance, with $a=\in(0,1)\cup(1,\infty)$
and $b=e$ in (\ref{ChangeOfBase}), we have
\begin{equation}
\log_ax=\frac{\log_ex}{\log_ea}=\frac{\ln x}{\ln a}.
\label{ChangeLogBaseToE}\end{equation}
In this section we will develop the derivative of the natural
logarithm, and with (\ref{ChangeLogBaseToE}) we will therefore have
derivatives of all the other logarithms.

We will see that algebraically
the logarithm function in any base $a\in(0,1)\cup(1,\infty)$
is the inverse function of the exponential function with the same
base.  Thus the range of the exponential becomes the domain
of the logarithm, and the domain of the exponential becomes the
range of the logarithm.  The range and domain of the exponential
functions being $(0,\infty)$ and $\Re$, respectively, we have
the following for general $a\in(0,1)\cup(1,\infty)$:
\begin{align}
\log_a a^x&\ \ =x,\qquad x\in\Re,\\
a^{\log_ax}&\ \ =x,\qquad x>0,\\
y=\log_ax&\iff \qquad x=a^y.\label{Log<->Exponential}
\end{align}
\subsection{Graph of the  Natural Logarithm Function}

We will use (\ref{Log<->Exponential}), with the case
$a=e$,  to both graph, and eventually  differentiate $y=\ln x$.
The case $a=e$ is important enough that it bears
emphasis:
\begin{align}
             y=\ln x&\iff \qquad x=e^y.\\ \label{Ln<->Exp}
\ln e^x&\ \ =x,\qquad x\in\Re,\\
             e^{\ln x}&\ \ =x,\qquad x>0,\end{align}
According to (\ref{Ln<->Exp}), we see that graphing $y=\ln x$
is the same as graphing $x=e^y$.  Of course, graphing $x=e^y$ is
the same as graphing $y=e^x$, except that $x$ and $y$ have
changed roles, so $(0,1)$ being in the graph of $y=e^x$
means that $(1,0)$ is  in the graph of $x=e^y$, i.e., $y=\ln x$.
In Figure~\ref{Ln<->ExpFigure} we have both $y=e^x$ (in gray),
and $x=e^y$, i.e., $y=\ln x$, in thick black.
\begin{figure}
\begin{center}
\begin{pspicture}(-2,-2)(6,6)
\psset{xunit=.666666666cm,yunit=.666666666cm}
\psaxes{<->}(0,0)(-3,-3)(9,9)
\psplot[plotpoints=1000,linecolor=gray]%
               {-3}{2.197224577}{2.718281828 x exp}
\psplot[plotpoints=1000,linewidth=1.5pt]%
             {0.049787068}{9}{x log 2.718281828 log div}
\pscircle[fillstyle=solid,fillcolor=black](2.718281828,1){.09}
\pscircle[linecolor=gray,fillstyle=solid,fillcolor=gray](1,2.718281828){.09}
\rput(2,3){$(1,e)$}
\rput(3,1.7){$(e,1)$}

\pscircle[fillstyle=solid,fillcolor=black](7.389056099,2){.09}
\pscircle[linecolor=gray,fillstyle=solid,fillcolor=gray](2,7.389056099){.09}
\rput(7.4,2.5){$(e^2,2)$}
\rput(3,7.8){$(2,e^2)$}
\end{pspicture}
\end{center}
\caption{Partial graphs of $y=e^x$ in gray, and $y=\ln x$
(i.e., $x=e^y$) in black.}
\label{Ln<->ExpFigure}
\end{figure}

Referring to the graph in Figure~\ref{Ln<->ExpFigure}, we see
also the following limiting behavior:
\begin{align}
x\to 0^+&\iff \ln x\to-\infty,\label{LnTo-Infty}\\
x\to\infty&\iff \ln x\to\infty.\label{LnToInfty}
\end{align}
These follow from $x\to-\infty\iff e^x\to0^+$,
and $x\to\infty\iff e^x\to\infty$, respectively.
The growth in $\ln x$ shown in the graph is indeed
unbounded, but it is a very slow type of growth.
In fact, such slow growth is dubbed {\it logarithmic growth}.
We will show in a later chapter that this growth is slower
than any positive power of $x$, so for example
$$\lim_{x\to\infty}\frac{\ln x}{x^{0.00000000001}}=0.$$
We can replace $0.00000000001$ with any other positive
number and have the same limit.  More generally,
\begin{equation}\lim_{x\to\infty}\frac{\log_ax}{x^s}=0,
\qquad \text{ for } a>1,\text{ and } s>0.\label{LimitXToInftyLoga/X^s}
\end{equation}
This is the logarithmic version of
(\ref{LimitA^X/X^NAsXToInfty}), page
\pageref{LimitA^X/X^NAsXToInfty}.\footnote{%
%%% FOOTNOTE
It may not be so obvious that $x\to\infty\implies\ln x\to\infty$
from the graph.  Recall
$$\lim_{x\to\infty}f(x)=\infty \iff
(\forall N)(\exists M)[x>M\longrightarrow f(x)>N].$$
Thus we need to show that we, for any $N$, can force $\ln x>N$ by
taking $x>M$ for some $M$.  Later we will show that $\ln x$ is
an increasing function on its domain $(0,\infty)$, so
we can take $M=e^N$, so $x>M\implies \ln x>\ln M=\ln e^N=N$.
So for example if we want to show that eventually, as we move rightward
on the $x$-axis, we have $\ln x>10,000,000,000$, we just
take $x>e^{10,000,000,000}\ (=M)$, a very large number but certainly finite.
%%% END FOOTNOTE
}

\subsection{Derivative of Natural Logarithm}
We use (\ref{Ln<->Exp}), that is $y=\ln x\iff x=e^y$, to compute
$\frac{d}{dx}\ln x$ using implicit differentiation as follows:
\begin{alignat*}{3}
y=\ln x&\iff\qquad&e^y&=x\\
       &\implies      &\frac{d}{dx}(e^y)&=\frac{d}{dx}(x)\\
       &\implies      &e^y\cdot\frac{dy}{dx}&=1\\
       &\implies      &\frac{dy}{dx}&=\frac1{e^y}=\frac1x.
\end{alignat*}
We summarize this and the chain rule version:
\begin{align}
    \frac{d}{dx}(\ln x)&=\frac1x,\label{DerivativeLnX}\\
    \frac{d}{dx}(\ln u)&=\frac1u\cdot\frac{du}{dx}.\label{DerivativeLnU}
\end{align}
Thus the derivative of the natural logarithm is in fact
a simple power, albeit the $-1$ power.

As nice as (\ref{DerivativeLnX}) and (\ref{DerivativeLnU})
appear to be, they are incomplete.  The first clue is that
the derivative formulas seem to be defined as long as
$x$ (or $u$) is nonzero, while the logarithm required
positive $x$ (or $u$).  Thus we know what kind of function
gives derivative $\frac1x$ as long as $x>0$, but
$\frac1x$ exists for $x\ne 0$, so we should like to know
what function gives rise to derivative $\frac1x$ for
$x<0$ as well.  (For example, what kind of position gives
velocity $\frac1t$ even when $t<0$?)  The solution to this is
to consider the functions $\ln|x|$, and more generally $\ln|u|$,
which are defined as long as $|x|$ and $|u|$ are simply nonzero.
In fact, our more general derivative formulas are the following:
\begin{align}
\frac{d}{dx}\ln|x|&=\frac1x,\label{DerivativeLn|X|}\\
\frac{d}{dx}\ln|u|&=\frac1u\cdot\frac{du}{dx}.\label{DerivativeLn|U|}
\end{align}
If we know $x$ or $u$, respectively, is positive then the absolute
values above are redundant. In considering (\ref{DerivativeLn|X|}),
note that the graph of $y=\ln|x|$, given in Figure~\ref{GraphLn|X|Figure},
page~\pageref{GraphLn|X|Figure}, shows how
that the derivative $\frac1x$ gives reasonable slopes at several points.

\begin{figure}
\begin{center}
\begin{pspicture}(-6,-3)(6,4.5)
%\psset{xunit=.666666666cm,yunit=.666666666cm}
\psaxes{<->}(0,0)(-6,-3)(6,4)
\psplot[plotpoints=1000%,linewidth=1.5pt]%
            ] {0.049787068}{6}{x  log 2.718281828 log div}
\psplot[plotpoints=1000%,linewidth=1.5pt]%
           ] {-6}{-0.049787068}{0 x sub log 2.718281828 log div}
%\pscircle[fillstyle=solid,fillcolor=black](2.718281828,1){.09}
%\rput(2,3){$(1,e)$}
%\rput(3,1.7){$(e,1)$}

\pscircle[fillstyle=solid,fillcolor=black](2,.693147){.08}
  \rput{26.565}(2,1.15){$f'(2)=\frac12$}
\pscircle[fillstyle=solid,fillcolor=black](4,1.38629){.08}
  \rput{14.0362}(4,1.8){$f'(4)=\frac14$}
\pscircle[fillstyle=solid,fillcolor=black](-2,.693147){.08}
  \rput{-26.565}(-1.8,1.15){$f'(-2)=-\frac12$}
\pscircle[fillstyle=solid,fillcolor=black](-4,1.38629){.08}
  \rput{-14.0362}(-4.2,1.8){$f'(-4)=-\frac14$}

\rput(0,4.5){$f(x)=\ln|x|$}
\end{pspicture}
\end{center}
\caption{Partial graph of $f(x)=\ln|x|$ with slopes at some sample points.}
\label{GraphLn|X|Figure}.
\end{figure}

We now prove (\ref{DerivativeLn|X|}),
assuming  (\ref{DerivativeLnX}) and (\ref{DerivativeLnU}),
as follows.  For convenience we first assume \label{ProofOfDerivLn|X|Stuff}
$$f(x)=\ln|x|.$$
\begin{enumerate}
\item Case $x\in(0,\infty)$:  Here $f(x)=\ln|x|=\ln x$, so $f'(x)=\frac1x$
      as before (see (\ref{DerivativeLnX}) above).
\item Case $x\in(-\infty,0)$:  Here $f(x)=\ln|x|=\ln(-x)$, so
      we can let $u=-x>0$, and use (\ref{DerivativeLnU}) as follows:
     $$x<0\implies f(x)=\ln(-x)\implies f'(x)=\frac1{-x}\cdot\frac{d(-x)}{dx}
         =\frac{1}{-x}\cdot(-1)=\frac1x.$$
\item Thus in both cases we have $f'(x)=\frac1x$, q.e.d.
\end{enumerate}
Now we can put these derivative formulas to use.
\newpage
\bex We compute the following derivative:
\begin{itemize}
\item $\ds{\frac{d}{dx}x\ln x=x\cdot\frac{d}{dx}\ln x+(\ln x)\frac{d}{dx}(x)
                             =x\cdot\frac1x+\ln x\cdot1=1+\ln x.}$
\item $\ds{\frac{d}{dx}\ln|\cos x|=\frac1{\cos x}\cdot\frac{d}{dx}\cos x
                             =\frac1{\cos x}\cdot(-\sin x)=-\tan x}$.
\item $\ds{\frac{d}{dx}\sin(\ln|x|)=\cos(\ln|x|)\cdot\frac{d}{dx}(\ln|x|)
            =\cos(\ln|x|)\cdot\frac1x=\frac{\cos(\ln|x|)}{x}}$.
\item $\ds{\frac{d}{dx}\ln\sqrt{x}=\frac1{\sqrt{x}}\cdot\frac{d}{dx}\sqrt{x}
            =\frac1{\sqrt{x}}\cdot\frac{1}{2\sqrt{x}}=\frac1{2x}}$.
\end{itemize}
\eex
Notice in the latest example we get one-half the answer we would
have had if we had taken the derivative of $\ln x$.  In fact
that can be seen from one of the properties of logarithms:
$$\frac{d}{dx}\ln\sqrt{x}=\frac{d}{dx}\ln(x)^{1/2}
      =\frac{d}{dx}\left[\frac12\ln x\right]=\frac12\cdot\frac1x,$$
which agrees with what we derived before.  Thus we can at times use the
properties of logarithms to rewrite the function in such a way that
the derivative computation is simpler.  For review, and emphasis on
the natural logarithm, we revisit the properties of logarithms as
applied to the special case $a=e$.  In what is below, $M,N>0$ and $p\in\Re$.
\begin{align}
\ln(MN)&=\ln M+\ln N,\label{LnMN}\\
\ln\frac{M}{N}&=\ln M-\ln N,\label{LnM/N}\\
\ln(M^p)&=p\cdot\ln M,\label{LnM^P}\\
\ln 1&=0,\label{Ln1=0}\\
\ln\frac1M&=-\ln M,\label{Ln1/M}\\
\log_aM&=\frac{\ln M}{\ln a}.\label{ChangOfBaseWithLn}
\end{align}
The absolute value can be introduced easily into the arguments
of the natural logarithm.  For instance,\footnotemark
\begin{alignat*}{2}
\ln|MN|&=\ln(|M|\cdot|N|)&&=\ln|M|+\ln|N|,\\
\ln|M/N|&=\ln(|M|/|N|)&&=\ln|M|-\ln|N|,\\
\ln\left|M^p\right|&=\ln|M|^p&&=p\cdot\ln|M|\end{alignat*}
\footnotetext{
%%% FOOTNOTE
Note that $|M^p|\ne|M|^{|p|}$ if $p<0$, as for example
$$\left|2^{-3}\right|=\left|\frac18\right|=\frac18,
\qquad\qquad |2|^{|-3|}=2^3=8.$$
%%% END FOOTNOTE
}

\bex Find $f'(x)$ if $\ds{f(x)=\ln\left|x\sin x\right|}$.

\underline{Solution}: We will compute $f'(x)$ using two
methods:
\begin{enumerate}
\item $\ds{f'(x)=\frac1{x\sin x}\!\cdot\frac{d}{dx}(x\sin x)
                =\frac1{x\sin x}\left[x\cdot\frac{d\sin x}{dx}
                                       +\sin x\cdot\frac{dx}{dx}\right]\!
                =\frac{x\cos x+\sin x}{x\sin x}=\cot x+\frac1x}$.
\item Instead we first re-write $f(x)=\ln|x|+\ln|\sin x|$, from which

      $\ds{f'(x)=\frac1x+\frac{1}{\sin x}\cdot\frac{d}{dx}\sin x
                =\frac1x+\frac1{\sin x}\cdot\cos x
                =\frac1x+\cot x}$.
\end{enumerate}
The first method required a chain rule calling a product rule.
The second required logarithm identity and a simple chain rule.
As often occurs, algebraic re-writing of the function made
the calculus easier.
\label{ExampleOfLogDerivBefore/AfterRewriting}\eex

\bex Find $\ds{\frac{d}{dx}\ln\left|\sin^4x\cos^6(x^2)\right|}$.

\underline{Solution}: If we did not wish to use the algebraic
properties of logarithms first, we would need a chain rule,
calling a product rule, calling two chain rules,
one of those calling yet another chain rule.  It is certainly do-able, but
not desirable if it can be avoided.  Instead we will use
the algebraic properties to expand the function to make
for a simpler differentiation process.  Consider the following:
\begin{align*}
\frac{d}{dx}\ln\left|\sin^4x\cos^6(x^2)\right|
  &=\frac{d}{dx}
          \left[\,\ln\left|(\sin x)\right|^4
               +\ln\left|(\cos(x^2))\right|^6
                \,\right]\\
  &=\frac{d}{dx}\left[\vphantom{\frac11}4\ln|\sin x|+6\ln|\cos (x^2)|\right]\\
  &=4\cdot\frac1{\sin x}\cdot\frac{d\,\sin x}{dx}
      +6\cdot\frac1{\cos (x^2)}\cdot\frac{d\,\cos (x^2)}{dx}\\
  &=\frac{4\cos x}{\sin x}+\frac6{\cos(x^2)}\cdot\left(-\sin (x^2)\frac{d\,x^2}
                   {dx}\right)\\
  &=\frac{4\cos x}{\sin x}+\frac6{\cos(x^2)}\cdot(-\sin (x^2)\cdot2x)\\
  &=4\cot x-12x\tan( x^2).\end{align*}
Note that the first two lines are algebraic in  nature. (Note also
that $\cos(x^2)$ is not a product.)
\eex

The natural logarithm transforms products to sums, quotients to
differences, and powers to multiplying factors.
Each of these transformations leaves us with simpler derivative
rules.  With some practice, the expansion of the logarithm
becomes natural and quick (we will strive for
a single step!), after which the differentiation
steps are relatively easy.

\bex Compute $\ds{\frac{d}{dx}\ln\left|\frac{x^3\cos x}{\sqrt{1+x^2}}\right|}$.

\underline{Solution}: We will write all the steps in expanding the
function, but it should become clearer with practice that
the final rewriting of the function can be anticipated from
the original form (see previous paragraph).
The first three steps below show the algebraic
expansion, from which the calculus carries us to our final answer.
\begin{align*}
\frac{d}{dx}\ln\left|\frac{x^3\cos x}{\sqrt{1+x^2}}\right|
  &=\frac{d}{dx}\left[\ln|x^3\cos x|-\ln\sqrt{1+x^2}\right]\\
  &=\frac{d}{dx}\left[\ln|x|^3+\ln|\cos x|-\ln(1+x^2)^{1/2}\right]\\
  &=\frac{d}{dx}\left[3\ln|x|+\ln|\cos x|-\frac12\ln(1+x^2)\right]\\
  &=3\cdot\frac1x+\frac1{\cos x}\cdot\frac{d\,\cos x}{dx}
                 -\frac12\cdot\frac1{1+x^2}\cdot\frac{d}{dx}(x^2+1)\\
  &=\frac3x-\frac{\sin x}{\cos x}-\frac1{2(1+x^2)}\cdot(2x)\\
  &=\frac3x-\tan x-\frac{x}{1+x^2}.
\end{align*}
Note how we did not use absolute values in the $\ln\sqrt{x^2+1}$
term, since $x^2+1\ge1>0$.
\eex

It is interesting to note how the absolute values inside
of the logarithms``disappear''
in the derivative step.  For that reason some texts
will skip them altogether, instead assuming that the quantity
inside a logarithm is positive.  But to be careful, even if the
argument of the $\ln$ in the original did not have absolute
values, they still belong everywhere they appear on the right sides
in the above example, since it is possible that $x^3\cos x>0$
while the two factors are negative, making the subsequent logarithms
undefined.  Note how the following are all correct uses of the
absolute values:
\begin{itemize}
\item $\ds{\frac{d}{dx}\left[\ln x^2\right]=\frac{d}{dx}[2\ln|x|]=\frac2x}$.
 Note $x^2\ge0$, and $\ln x^2$ is defined for all $x\ne0$.  Also,
 $x^2=|x|^2$.
\item $\ds{\frac{d}{dx}\left[\ln x^3\right]=\frac{d}{dx}[3\ln x]=\frac3x}$,
 but is undefined if $x<0$.
\item $\ds{\frac{d}{dx}\left[\ln|x|^3\right]=\frac{d}{dx}[3\ln|x|]=\frac3x}$,
 defined for all $x\ne0$.
\end{itemize}

\begin{center}\underline{\Large{\bf Exercises}}\end{center}
\bigskip
\begin{multicols}{2}
\begin{enumerate}
\item For each of the following, compute the derivative
two ways:
\begin{enumerate}[(i)]
 \item by using
       the derivative rules called by the original
       form (see Example~\ref{ExampleOfLogDerivBefore/AfterRewriting} on
                   page \pageref{ExampleOfLogDerivBefore/AfterRewriting});
 \item by using properties of the natural logarithm to rewrite
       the function and then compute the derivative.
\end{enumerate}
   \begin{enumerate}
   \item $\ds{\frac{d}{dx}\ln x^4}$
   \item $\ds{\frac{d}{dx}\ln x^5}$
   \item $\ds{\frac{d}{dx}\ln\left|x^5\right|}$
   \item $\ds{\frac{d}{dx}\ln\left|\frac1x\right|}$
   \item $\ds{\frac{d}{dx}\ln\left|\sqrt[3]{x}\right|}$
   \item $\ds{\frac{d}{dx}\ln e^x}$
   \item $\ds{\frac{d}{dx}\ln e^{x^2}}$
   \end{enumerate}
\item Consider $\ds{f(x)=e^{\ln x}}$.
      Note that $f(x)=x$ (though its domain is restricted to $x>0$).
      Find $f'(x)$ using the original (unsimplified)
      form, and show that the form of the derivative
      can be simplified to $f'(x)=1$ (as we should
      expect).
\item Compute and simplify
      the following derivatives (using (\ref{DerivativeLn|U|}),
      page \pageref{DerivativeLn|U|}):
   \begin{enumerate}
   \item $\ds{\frac{d}{dx}\ln|\sin x|}$
   \item $\ds{\frac{d}{dx}\ln|\cos x|}$
   \item $\ds{\frac{d}{dx}\ln|\tan x|}$ (do not re-write first)
   \item $\ds{\frac{d}{dx}\ln|\cot x|}$ (do not re-write first)
   \item $\ds{\frac{d}{dx}\ln|\sec x|}$ (it is interesting to both
                                         use this form, and alternatively to
                                         rewrite the function first)
   \item $\ds{\frac{d}{dx}\ln|\csc x|}$ (see previous comment)
   \end{enumerate}
\item Compute the following derivatives:
  \begin{enumerate}
  \item $\ds{\frac{d}{dx}(\ln x)^2}$
  \item $\ds{\frac{d}{dx}\sqrt{\ln x}}$
  \item $\ds{\frac{d}{dx}\sin(\ln x)}$
  \item $\ds{\frac{d}{dx}\tan(\ln x)}$
  \item $\ds{\frac{d}{dx}\sec(\ln|x|)}$
  \item $\ds{\frac{d}{dx}\sin^{-1}(\ln x)}$
  \item $\ds{\frac{d}{dx}\tan^{-1}(\ln x)}$
  \item $\ds{\frac{d}{dx}\sec^{-1}(\ln x)}$
  \item $\ds{\frac{d}{dx}\ln|\ln x|}$
  \item $\ds{\frac{d}{dx}\ln(\ln(\ln x))}$
  \end{enumerate}
\item Compute $f'(x)$ for each of the following by first rewriting $f(x)$
       by expanding the logarithms.
  \begin{enumerate}
  \item $\ds{f(x)=\ln\left|x^3(x^2+3x)^{20}\right|}$
  \item $\ds{f(x)=}$

         $\ds{\ln\left|(2x+9)^3(3x^2+5x)^9(2-7x)^{10}
             \right|}$
  \item $\ds{f(x)=\ln\left|\frac{9x-1}{2x+4}\right|}$
  \item $\ds{f(x)=\ln\left|\frac{(3x+5)^7}{(7x^2+2)^5}\right|}$
  \item $\ds{f(x)=\ln\left|\frac{x^2\sin^3x}{\cos^42x\sqrt[3]{x^2-9}}\right|}$
  \end{enumerate}
\item Compute and simplify the following derivatives (which cannot take
      advantage of the properties of logarithms).
    \begin{enumerate}
    \item $\ds{\frac{d}{dx}(x\ln x-x)}$
    \item $\ds{\frac{d}{dx}\sin(\ln|\cos x|)}$
    \item $\ds{\frac{d}{dx}\ln(x^2+1)}$. Why is $\ln|x^2+1|$ the
                                         same as $\ln(x^2+1)$?

    \end{enumerate}
\item Show that $\frac{d}{dx}\ln|\sec x+\tan x|=\sec x$.
        (Use the simplest derivative strategy.  The key
         is in the simplification of the derivative.)
\item Compute the following two derivatives, show that
        they are the same, and
        explain why we should have expected that result:
        \begin{align*}
        &\frac{d}{dx}\ln|\sec x|,\\
        &\frac{d}{dx}[-\ln|\cos x|\,].\end{align*}
\item For $f(x)=(g(x))^{h(x)}$, where $g(x)>0$ derive the
       following formula for $f'(x)$:
       \begin{multline}
          f'(x)=h(x)(g(x))^{h(x)-1}g'(x)\\
           \ +(g(x))^{h(x)}h'(x)\ln(g(x)).\label{AGenPower/ExpRule}
       \end{multline}
       To do so, follow the following steps:
      \begin{enumerate}
      \item Use the idea that  $a=e^{\ln a}$ (so what is $a^x$?)
            to show  $$f(x)=e^{[\ln(g(x))\cdot h(x)]}.$$
      \item Find $f'(x)$ using this form.
      \item Simplify $f'(x)$ from the step above to achieve
              (\ref{AGenPower/ExpRule}).
      \end{enumerate}
\item Assume $h(x)=n$ is constant.  Then rewrite $f(x)=(g(x))^{h(x)}$
     and use (\ref{AGenPower/ExpRule})
     to compute $f'(x)$  for this case.
\item Repeat the previous problem supposing
       instead that $g(x)=a$ is a constant, and $h(x)$ is
     allowed to vary.
\item Now we consider the rationale for not allowing $a=1$ to
       be the base of a logarithm.  To do so, we consider
       how we would attempt to develop a function $\log_ax$.
    \begin{enumerate}
    \item First, recall how we found the graph of $y=\ln x=\log_ex$
          based upon the graph of $y=e^x$.  Show what would
          happen if we attempted to do this for $1$ instead of $e$
          as the base.
    \item Separately, consider the definition of the logarithm
          function, and decide what would be the domain of $\log_1x$.
    \item Separately still, explain why (\ref{ChangOfBaseWithLn})
          would preclude $a=1$.

    \end{enumerate}

\end{enumerate}
\end{multicols}
\newpage
\section{The Natural Logarithm II: Further Results}
In this section we use the properties of the natural logarithm,
and its relationship to exponential functions and other
logarithms, to pursue further differentiation problems.
The first technique we will develop is called
{\it logarithmic differentiation}, in which we
actually introduce the natural logarithm into
problems which can benefit from its presence.  In later
subsections, we use change of base-type techniques to
rewrite problems into forms for which we have formulas.
In doing so, some new and more general differentiation
rules will emerge.

\subsection{Logarithmic Differentiation}
Because the natural logarithm takes products to sums, quotients to
differences, and powers to multiplying factors, we have seen
how many derivative problems involving natural logarithms can
be much reduced in complexity.  By properly {\it introducing} the natural
logarithm into differentiation problems, we can
sometimes take difficult calculations and make them much
simpler.  The process has its own complications to add to the
mix, but these are relatively minor compared to
former methods for most of these problems.
We begin with an example to illustrate the method.

\bex Find $f'(x)$ if $\ds{f(x)=\frac{x\sin^3 x}{\sqrt{x^2+1}}}$.

\underline{Solution}: The technique below is similar
to our implicit differentiation, except that first we
apply the function $\ln|\cdot|$ to both sides in the following sense:
\begin{align*}
f(x)&=\frac{x\sin^3 x}{\sqrt{x^2+1}}\\
\implies\qquad\qquad \ln|f(x)|&=\ln\left|\frac{x\sin^3 x}{\sqrt{x^2+1}}\right|.
\end{align*}
The whole point of doing so is to be able to take advantage
of the algebraic properties of logarithms (so that
the differentiation steps will be easier).
\begin{alignat*}{2}
&\iff&\ln|f(x)|&=\ln|x|+\ln\left|\sin^3x\right|-\ln\left|(x^2+1)^{1/2}
               \right|\\
&\iff\qquad\qquad&
        \ln|f(x)|&=\ln|x|+3\ln|\sin x|-\frac12\ln|x^2+1|.
\end{alignat*}
Now we differentiate, i.e., apply $\frac{d}{dx}$ to both
sides.  Note where we use $\frac{d}{dx}\ln|u|=\frac1u\cdot\frac{du}{dx}$.
\begin{align*}
&\implies\qquad\qquad&\frac{d}{dx}\ln|f(x)|&=
                       \frac{d}{dx}\left[\ln|x|+\ln|\sin x|^3
                       -\frac12\ln|x^2+1|\right]\\
&\implies&\frac1{f(x)}\cdot\frac{d\,f(x)}{dx}&=
                   \frac1x+3\cdot\frac1{\sin x}\cdot\frac{d\,\sin x}{dx}
                   -\frac12\cdot\frac1{x^2+1}\cdot\frac{d\,(x^2+1)}{dx}\\
&\implies&\frac{f'(x)}{f(x)}&=\frac1x+\frac{3\cos x}{\sin x}
                   -\frac{2x}{2(x^2+1)}\\
&\implies&\frac{f'(x)}{f(x)}&=\frac1x+3\cot x-\frac{x}{x^2+1}
\end{align*}
We wanted $f'(x)$, so we next multiply both sides by
$f(x)$, which gives $f'(x)$ in terms of both $x$ and $f(x)$.
We then finish by substituting the original form for $f(x)$.
$$f'(x)=f(x)\left[\frac1x+3\cot x-\frac{x}{x^2+1}\right]
=\frac{x\sin^3 x}{\sqrt{x^2+1}}\left[\frac1x+3\cot x-\frac{x}{x^2+1}\right].$$
\eex

While the process above did require several steps, those steps
were arguably simpler than those in our earlier methods,
which would have called for  a quotient rule calling
one product rule and two chain rules.  Furthermore
with practice the process of logarithmic differentiation
can be streamlined to be much faster.  For instance, if we
can anticipate the final logarithmic expansion, and also use
the shortcut
\begin{equation}
\frac{d\,\ln|u(x)|}{dx}=\frac{u'(x)}{u(x)},\label{ShortcutForLogDiff}
\end{equation}
particularly when  $u'(x)$ is simple to compute,
then we can consolidate steps from the previous example.
(For clarity, in fact the last step from before becomes
two steps below.)
\begin{alignat*}{2}
&&f(x)&=\frac{x\sin^3 x}{\sqrt{x^2+1}}\\
&\implies\qquad\qquad&\ln|f(x)|&=\ln|x|+3\ln|\sin x|-\frac12\ln|x^2+1|\\
&\implies&\frac{f'(x)}{f(x)}&=\frac1x+3\cdot\frac{\cos x}{\sin x}
                              -\frac12\cdot\frac{2x}{x^2+1}\\
&\implies&f'(x)&=f(x)\left[\frac1x+3\cot x-\frac{x}{x^2+1}\right]\\
&\iff          &f'(x)&=\frac{x\sin^3 x}{\sqrt{x^2+1}}\left[
                           \frac1x+3\cot x-\frac{x}{x^2+1}\right].
\end{alignat*}
To be sure, more steps can and arguably should be written when the
technique is first learned, but it should appear true that
the abbreviated process above is much preferable to our earlier
techniques, and that such eventual efficiency is an achievable
goal.

The process of logarithmic differentiation does not
replace our earlier methods entirely.  Indeed, it is
only immediately useful for finding $f'(x)$ if $f(x)$
is the type of function whose natural log (of its
absolute value to be more precise) can
be expanded in a useful way.  For instance,
the function above yielded nicely to the process because
it consisted of powers of functions, combined through multiplication
and division.  However, it would not be advantageous, for instance,
to attempt logarithmic differentiation on a function such as
$f(x)=\sec x+\tan x+9x^2-\frac1x$, since this is a sum,
and there is no algebraic expansion for the natural log of a
sum.\footnote{%%
%%% FOOTNOTE
One could rewrite $f(x)=y_1+y_2+y_3+y_4$, for instance, and perform
logarithmic differentiation on each $y_i$ separately to find each
$y_i'$, and thus have $f'(x)=y_1'+y_2'+y_3'+y_4'$, and
indeed sometimes this is necessary.  For the example
this note refers to, that would certainly not decrease the
work required to find $f'(x)$.}
%%% END FOOTNOTE
\hphantom{. }

The logarithmic differentiation process for finding $f'(x)$
for a given $f(x)$ is as follows:
\begin{enumerate}
\item Beginning with the equation which defines $f(x)$,
      apply $\ln|\cdot|$ to both sides.
\item Expand the logarithm on the right-hand side (may be
      consolidated into Step 1).
\item Apply $\frac{d}{dx}$ to both sides.  the left-hand side
      will be $\frac{f'(x)}{f(x)}$.
\item Multiply the resulting equation by $f(x)$, thus
      solving for $f'(x)$ in terms of $x$ and $f(x)$.
\item Substitute the original formula for $f(x)$ on the
      right-hand side (may be consolidated into Step 4).
\end{enumerate}

We will see that there are other times where
applying $\ln|\cdot|$ to both sides before differentiation
is advantageous besides just for finding certain
derivatives $f'(x)$, but for now another example of this
first type is called for.

\bex Find $f'(x)$ if $\ds{f(x)=\frac{5\sin2x\cos^34x}{\sqrt[3]{1+\tan6x}}}$.

\underline{Solution}: We proceed as before, this time being
more verbose in our chain rule computations.
\begin{alignat*}{2}
&&f(x)&=\frac{5\sin2x\cos^34x}{\sqrt[3]{1+\tan6x}}\\
&\implies\qquad\qquad
  &\ln|f(x)|&=\ln\left|\frac{5\sin2x\cos^34x}{(1+\tan6x)^{1/3}}\right|\\
&\implies
  &\ln|f(x)|&=\ln|5|+\ln|\sin2x|+3\ln|\cos 4x|-\frac13\ln|1+\tan6x|\\
&\implies&\frac{d}{dx}\ln|f(x)|&=\frac{d}{dx}\left[
            \ln|5|+\ln|\sin2x|+3\ln|\cos 4x|-\frac13\ln|1+\tan6x|\right]\\
&\implies&\frac{f'(x)}{f(x)}&=0+\frac1{\sin2x}\cdot\frac{d\,\sin2x}{dx}
            +3\cdot\frac{1}{\cos4x}\cdot\frac{d\,\cos4x}{dx}\\
            &&&\qquad-\frac13\cdot\frac1{1+\tan6x}\cdot\frac{d(1+\tan6x)}{dx}\\
&\implies&\frac{f'(x)}{f(x)}&=\frac1{\sin2x}\cdot\cos2x\cdot
          \frac{d\,2x}{dx}+
            3\cdot\frac1{\cos 4x}\cdot(-\sin4x)\cdot\frac{d\,4x}{dx}\\
       &&&\qquad    -\frac13\cdot\frac1{1+\tan6x}\cdot
            \left(0+\sec^26x\cdot\frac{d\,6x}{dx}\right)\\
&\implies&\frac{f'(x)}{f(x)}&=2\cot2x+3\tan4x\cdot(-4)
                  -\frac{6\sec^26x}{3(1+\tan6x)}\\
&\implies&f'(x)&=f(x)\left[2\cot2x-12\tan4x-\frac{2\sec^26x}{1+\tan6x}\right]\\
&\implies&f'(x)&=\frac{5\sin2x\cos^34x}{\sqrt[3]{1+\tan6x}}
      \left[2\cot2x-12\tan4x-\frac{2\sec^26x}{1+\tan6x}\right].
\end{alignat*}

\eex

A few more notes about the process are in order.
\begin{enumerate}[(i)]
\item The absolute values introduced with the natural
      logarithm vanish in the derivative step.  For this
      reason some textbooks do not include them, but
      technically they should be included.  One nice
      feature of the process is that the correct answer
      can be found even when absolute values are (naively?) omitted.
\item The answer this process delivers is of a different
      form than our earlier methods, but they are algebraically
      the same, {\bf except} that the answer here may need to
      be expanded and simplified to be, technically, completely
      correct.  For instance, if $\cos4x=0$
      this answer appears undefined because of the $\tan4x$
      term, though $\cos4x=0$ does not necessarily
      break the differentiability.  When we distribute
      the $f(x)$ factor across the brackets in our final answer,
      a factor of $\cos4x$ will cancel the denominator
      in the $\tan4x$ term.  Algebraically that is not
      correct if $\cos4x=0$, but in fact the naively
      simplified form---with the $\cos4x$ term (as well
      as the $\sin 2x$ in the $f(x)$ and $\cot2x$ terms)
      canceled---ultimately
      gives the correct derivative $f'(x)$.
\item Related to the previous item, note that we cannot technically
      compute $\ln|f(x)|$ wherever $f(x)=0$ (such as when
      $\sin2x=0$ or $\cos4x=0$), but this too
      gets glossed over in the differentiation process,
      especially in the final answer if $f(x)$ is distributed
      across the brackets, and the offending terms canceled.
\end{enumerate}
Thus in some ways logarithmic differentiation is better than
expected, in that even when certain things technically
should be going wrong in the process (such as being outside
the domain of the natural logarithm), in the end---at least
in the simplified answer---we get the correct result.

Logarithmic differentiation gives a nice proof of
the generalized product rule:\footnote{%%%
%%%% FOOTNOTE
See notes on the roles of the various factors in the
product rule, page \pageref{NotesOnProductRule}.
Comments there generalize to more general products.
%%%% END FOOTNOTE
}
\begin{theorem}For $f(x)=g_1(x)g_2(x)g_3(x)\cdots g_n(x)$, we have
\begin{multline}
f'(x)=[g_1'(x)g_2(x)g_3(x)\cdots g_n(x)] \ + \
         [g_1(x)g_2'(x)g_3(x)\cdots g_n(x)]\  +\
        \\ +\ [g_1(x)g_2(x)g_3'(x)\cdots g_n(x)] \ + \cdots
        \ + \ [g_1 (x)g_2(x)g_3(x)\cdots g_n'(x)].\end{multline}
\end{theorem}
A proof in the case $f(x)=g_1(x)g_2(x)g_3(x)$ shows the
pattern of argument for the general case.
\begin{alignat*}{2}
&&f(x)&=g_1(x)g_2(x)g_3(x)\\
&\implies\qquad\qquad&\ln|f(x)|&=\ln|g_1(x)g_2(x)g_3(x)|\\
&\iff\qquad\qquad&\ln|f(x)|&=\ln|g_1(x)|+\ln|g_2(x)|+\ln|g_3(x)|\\
&\implies&\frac{d}{dx}[\ln|f(x)|]&=\frac{d}{dx}\left[
              \ln|g_1(x)|+\ln|g_2(x)|+\ln|g_3(x)|\right]\\
&\implies&\frac{f'(x)}{f(x)}&=\frac{g_1'(x)}{g_1(x)}+
                               \frac{g_2'(x)}{g_2(x)}+
                               \frac{g_3'(x)}{g_3(x)}\\
&\implies&f'(x)&=f(x)\left[\frac{g_1'(x)}{g_1(x)}+\frac{g_2'(x)}{g_2(x)}+
                             \frac{g_3'(x)}{g_3(x)}\right]\\
&\implies&f'(x)&=g_1(x)g_2(x)g_3(x)
                    \left[\frac{g_1'(x)}{g_1(x)}+\frac{g_2'(x)}{g_2(x)}+
                             \frac{g_3'(x)}{g_3(x)}\right]\\
&\implies&f'(x)&=g_1'(x)g_2(x)g_3(x)+g_1(x)g_2'(x)g_3(x)
                   +g_1(x)g_2(x)g_3'(x),\text{ q.e.d.}
\end{alignat*}
\bex Thus we can perform the following quickly, this time in primed notation.
\begin{align*}
\frac{d}{dx}(x^3e^x\sin x)
    &=(x^3)'e^x\sin x+x^3(e^x)'\sin x+x^3e^x(\sin x)'\\
    &=3x^2e^x\sin x+x^3e^x\sin x+x^3e^x\cos x.\\
    &=x^2e^x(3\sin x+x\sin x+x\cos x)\end{align*}
\eex
If such a product is more complicated, we should revert to
Leibniz notation:
$$\frac{d}{dx}(f(x)g(x)h(x))
=f(x)g(x)\cdot\frac{d\,h(x)}{dx}
  +f(x)h(x)\cdot\frac{d\,g(x)}{dx}
  +g(x)h(x)\cdot\frac{d\,f(x)}{dx}$$
With more complicated $f$, $g$ or $h$, this has the advantage
that the derivative computations are the rightmost factors
in each term, so keeping them separate from the other terms,
and expanding as we call up the various rules, is more
convenient.  To take full advantage of the Leibniz style, we
therefore have to write the terms of a generalized
product rule in a different order than given in the theorem
above.

\bex
Later in the text we will often be computing derivatives with
respect to time $t$, though that variable might not explicitly
appear in the problem.  Still it will make sense to apply
$\frac{d}{dt}$ to quantities which do, in fact, depend upon
time $t$.  So for instance there is the formula from
chemistry that $PV=k\cdot T$, where $k$ is a constant,
and we have an {\it ideal gas} with some fixed number of
particles.  In a mathematically sophisticated advanced
chemistry text or article, it is not unusual to see
a computation like
$$PV=k\cdot T\implies
\frac1P\cdot\frac{dP}{dt}+\frac1V\cdot\frac{dV}{dt}
=\frac{1}T\cdot\frac{dT}{dt}.$$
Without logarithmic differentiation this might seem rather
mysterious.  However, one well versed in the technique would
likely see the truth of this implication quickly, being
practiced in the middle steps:
\begin{alignat*}{2}
PV=k\cdot T&\implies
&\ln(PV)&=\ln(kT)\\
&\implies&\ln P+\ln V&=\ln k+\ln T\\
&\implies&\frac{d}{dt}\left[\ln P+\ln V\right]&=\frac{d}{dt}
                      \left[\ln k+\ln T\right]\\
&\implies&\frac1P\cdot\frac{dP}{dt}+
          \frac1V\cdot\frac{dV}{dt}&=0+\frac1T\cdot\frac{dT}{dt},
\qquad\text{ q.e.d.}
\end{alignat*}
\label{FirstAppearanceOfPV=kT}
We would have a different equation involving these functions
(of $t$) $P,V,T$ if we simply applied $\frac{d}{dt}$ to both sides
rather than first applying the natural logarithm function.  If we
chose that strategy we would require the product rule on the left
side.  In fact the equations we get with either method are
equivalent under the original assumption, that $PV=k\cdot T$.
To show the two equations involving the derivatives  in fact say
the same thing is an exercise in algebra.

Note also that we normally apply $\ln|\cdot|$ to both sides
when intending to perform logarithmic differentiation, but here we
could just apply $\ln(\cdot)$ because the quantities involved are never
negative.
\eex

Recalling that powers become multiplying factors, another quick
example, this time from basic electricity, would be
\begin{alignat*}{2}
P=\frac{E^2}{R}&\implies&\ln P&=2\ln E-\ln R\\
&\implies&\frac1P\cdot\frac{dP}{dt}
=\frac2{E}\cdot\frac{dE}{dt}-\frac1R\cdot\frac{dR}{dt}.\end{alignat*}
With practice one is quite likely to be confident enough to
skip the middle step.

\subsection{Bases Other Than $e$: Logarithms}
In this subsection we look at derivatives of
functions $\log_ax$ for more general $a$.
This is a simple application of our
change of base formula (\ref{ChangeOfBase}),
page \pageref{ChangeOfBase} (note that
$\frac1{\ln a}$ is a constant):
$$\frac{d}{dx}\log_ax=\frac{d}{dx}\left[\frac{\ln x}{\ln a}
  \right] =\frac{d}{dx}\left[\frac1{\ln a}\cdot\ln x\right]
=\frac1{\ln a}\cdot\frac1x=\frac1{x\ln a}.$$
We can also perform the computation above with $|x|$
replacing $x$, and the same argument which worked
with $\frac{d}{dx}\ln |x|=\frac1x$ will work here.
In fact, since this function $\log_ax$ is just a constant
multiple of $\ln x$, all the rules we had for $\ln x$
work here, with the constant carrying through.
Thus the absolute value and chain rule versions are just
\begin{align}
\frac{d}{dx}\log_a|x|&=\frac{d}{dx}\left[\frac1{\ln a}
             \ln|x|\right]=\frac1{x\ln a},\label{DerivLog_a}\\
\frac{d}{dx}\log_a|u|&=\frac{d}{dx}\left[\frac1{\ln a}
             \ln|u|\right]=\frac1{u\ln a}\cdot\frac{du}{dx}.
              \label{DerivLog_aU}
\end{align}
\bex Consider the following derivative computations:
\begin{itemize}
\item $\ds{\frac{d}{dx}\log_{10}x=\frac1{x\ln10}}$.
\item $\ds{\frac{d}{dx}\log_2\left|x\sqrt{x^2+1}\right|
           =\frac{d}{dx}\left[\log_2|x|
         +\frac12\log_2(x^2+1)\right]
         =\frac1{x\ln2}+\frac1{(x^2+1)\ln2}
           \cdot\frac{d}{dx}(x^2+1)}$

      $\ds{=\frac1{x\ln2}+\frac{2x}{(x^2+1)\ln2}}$.
\item $\ds{\frac{d}{dx}\log_3\left|\frac{\sin x}{2x+5}\right|
        =\frac{d}{dx}\left[\log_3|\sin x|
          -\log_3|2x+5|\vphantom{X_X^X}\right]}$

       $\ds{    =\frac1{\sin x\ln3}\cdot\frac{d\,\sin x}{dx}
     -\frac1{(2x+5)\ln3}\cdot\frac{d(2x+5)}{dx}
     =\frac{\cos x}{\sin x\ln3}-\frac{2}{(2x+5)\ln3}}.$
\item $\ds{\frac{d}{dx}\log_3(\log_5x)
     =\frac{1}{\log_5x\ln3}\cdot\frac{d\log_5x}{dx}
     =\frac1{\log_5x\ln3}\cdot\frac1{x\ln5}
     =\frac1{\frac{\ln x}{\ln 5}\ln 3\cdot x\ln 5}
     =\frac1{x\ln x\ln3}}$

\end{itemize}
In fact, we can cut short the {\rm calculus} steps using algebraic
properties of logarithms first:
$$\frac{d}{dx}\log_3(\log_5x)
 =\frac{d}{dx}\log_3\left[\frac{\ln x}{\ln 5}\right]
 =\frac{d}{dx}\left[\log_3(\ln x)-\log_3(\ln 5)\right]
 =\frac1{\ln x\ln3}\frac{d\ln x}{dx}-0
 =\frac1{\ln x\ln 3\cdot x}.$$

\eex

\subsection{Bases other than $e$: Exponential Functions}
Here we look at derivatives of exponential functions $a^x$ ($a>0$) and
functions involving these.
Two computations of the derivative of $a^x$ are offered.
Both illustrate useful techniques which are worth remembering.
The first technique is logarithmic differentiation.  We find $\frac{dy}{dx}$
under the assumption $y=a^x$. Note that $y>0$ so no absolute values are
needed.
\begin{alignat*}{2}
&&y&=a^x\\
&\implies& \ln y&=\ln a^x\\
&\iff &\ln y&=x\ln a\\
&\implies& \frac{d\,\ln y}{dx}&=\frac{d\,[(\ln a)x]}{dx}\\
&\implies&\frac1y\cdot\frac{dy}{dx}&=\ln a\\
&\implies&\frac{dy}{dx}&=y\ln a\\
&\iff &\frac{dy}{dx}&=a^x\ln a.\end{alignat*}
Next we instead use the fact that $a=e^{\ln a}$, and compute
$\frac{d}{dx}\left[a^x\right]$ using the chain rule.  Note that
$a^x=\left[e^{\ln a}\right]^x=e^{(\ln a)x}$.
$$\frac{d}{dx}a^x=\frac{d}{dx}\left[e^{\ln a}\right]^x
               =\frac{d}{dx}e^{(\ln a)x}
               =e^{(\ln a)x}\cdot\frac{d[(\ln a)x]}{dx}
               =\left[e^{\ln a}\right]^x\cdot\ln a
               =a^x\ln a.$$
From either method, we get the derivative of $a^x$, and
its chain rule version:
\begin{align}
\frac{d\,a^x}{dx}&=a^x\ln a,\label{DerivOfA^X}\\
\frac{d\,a^u}{dx}&=a^u\ln a\cdot\frac{du}{dx}.\label{DerivOfA^U}
\end{align}
Note that if $a=e$, we have $\ln a=\ln e=1$, giving us
$\frac{d}{dx}e^x=e^x\ln e=e^x\cdot1=e^x$ as before.

We proved (\ref{DerivOfA^X}), from which (\ref{DerivOfA^U}) follows.
While the first technique was the (now) familiar logarithmic differentiation,
the second was to change the base, rewriting
$a^x=(e^{\ln a})^x=e^{(\ln a)x}$.  This can be exploited in other
venues, but in particular it allows one to use the simpler and
ubiquitous derivative formula for $e^x$ by an {\it algebraic}
rewriting, rather than relying upon the more obscure (but not
unimportant) formula (\ref{DerivOfA^X}).

\bex We can now compute the following derivatives using (\ref{DerivOfA^X})
and (\ref{DerivOfA^U}):
\begin{itemize}
\item $\ds{\frac{d\,2^x}{dx}=2^x\ln2}$.
\item $\ds{\frac{d}{dx}3^{5x}=3^{5x}\ln 3\cdot\frac{d}{dx}\left[5x\right]
           =3^{5x}\ln3\cdot 5=5(\ln 3)3^{5x}}$.
\item $\ds{\frac{d}{dx}\left[\sin10^x\right]=\cos10^x\cdot\frac{d}{dx}
           \left[10^x\right]=\cos10^x\cdot 10^x\ln10=10^x\ln10\cos10^x}$.
\item $\ds{\frac{d}{dx}\left[x^210^x\right]=x^2\cdot\frac{d}{dx}
           \left[10^x\right]+10^x\cdot\frac{d}{dx}\left[x^2\right]
           =x^2\cdot10^x\ln10+10^x\cdot2x}$.

          \qquad\qquad\quad\ $\ds{=x\cdot10^x\left[x\ln10+2\right]}$.
\item $\ds{\frac{d}{dx}\left[2^{3^x}\right]
  =2^{3^x}\ln2\cdot\frac{d}{dx}\left[3^x\right]
  =2^{3^x}\ln2\cdot3^x\ln3=2^{3^x}3^x\ln2\ln3}$.
\item $\ds{\frac{d}{dx}\left[\tan^{-1}2^x\right]
          =\frac1{\left(2^x\right)^2+1}\cdot\frac{d}{dx}\left[2^x\right]
          =\frac1{4^x+1}\cdot2^x\ln2=\frac{2^x\ln2}{4^x+1}}$.
\item $\ds{\frac{d}{dx}\left[2^{\tan^{-1}x}\right]
          =2^{\tan^{-1}x}\ln2\cdot\frac{d}{dx}\left[\tan^{-1}x\right]
          =2^{\tan^{-1}x}\ln2\cdot\frac1{x^2+1}
          =\frac{2^{\tan^{-1}x}\ln2}{x^2+1}}$.
\item $\ds{\frac{d}{dx}\left[\ln10^x\right]=\frac{1}{10^x}\cdot
          \frac{d}{dx}\left[10^x\right]
          =\frac1{10^x}\cdot10^x\ln10=\ln10}$.

Note that an alternative, arguably superior strategy would be to first
re-write the function:

$\ds{\frac{d}{dx}\left[\ln 10^x\right]=\frac{d}{dx}\left[x\ln10\right]=\ln10}$,
following from the usual power rule with a constant multiple $\ln10$
carrying through the computation.
\end{itemize}

\eex
While the last derivative above allowed us to first use the
rules of logarithms and exponents, it should be pointed out that
there are not useful rewritings for every possible case.  In fact that last
derivative computation was the only one above for which there
was a useful way to algebraically rewrite the problem.
Now it happens that most
of those above would be fine candidates for logarithmic differentiation
if we wanted to avoid the formulas for derivatives of
exponential functions in bases other than $e$, namely
(\ref{DerivOfA^X}) and (\ref{DerivOfA^U}).  Indeed
only the arctangent example
above could not be computed directly with logarithmic differentiation.
However, using our formulas for $\frac{d\,a^x}{dx}$ and $\frac{d\,a^u}{du}$
will get us our results much more expeditiously.

\subsection{Derivative of $(f(x))^{g(x)}$}

So far we have two derivative rules for functions which can loosely
be defined as powers:
\begin{alignat*}{2}
\frac{d}{dx}\left[x^n\right]&=n\cdot x^{n-1},&\qquad n&\in\Re,\\
\frac{d}{dx}\left[a^x\right]&=a^x\ln a,&\qquad a&\ge0.\end{alignat*}
Crucially, in each of those cases either the base or the exponent is fixed,
i.e., constant.
Furthermore, we should expect very different
derivative formulas for these since
the functions behave very differently.
For instance, if $n\in\{1,2,3,\cdots\}$, that function $x^n$
has {\it polynomial growth}, while if $a>1$ the function $a^x$ has
{\it exponential growth}, which is eventually
much faster.  There were other cases,
but for the moment let us consider these.  So for instance
$x^2$ grows without bound,
but $2^x$ grows even faster, though we will have to wait for
another chapter to actually prove this fact.  Consider then
a function like $x^x$ in which the base grows without bound, and so
does the exponent.  Here these two growth conspire
in such a way that this new function will grow much faster than
either $x^2$ or $2^x$.  This is not difficult to believe, for suppose
$x=100$.  Then
$$\underbrace{100^2}_{=10,000}
<<\underbrace{2^{100}}_{\approx1.26\times10^{30}}
<<\underbrace{100^{100}}_{=10^{1000}}.$$
Here the notation ``$<<$'' means ``much less than,'' and as such is
usually used subjectively, in much the same way that ``$\approx$''
is also subjective.  It is used here for emphasis.  The numerical
results above give just a small glimpse of the relative growth rates of these
three functions, $x^2$, $2^x$ and $x^x$.\footnote{%
%%% FOOTNOTE
Note that $x^x$ is only continuous for $x>0$.  That is because, while
it is defined for many negative numbers, it is undefined for many more.
For instance, $(-3)^{-3}$ and $(-1)^{-1}$ make sense, but $(-1/2)^{-1/2}$
and $(-\pi)^{-\pi}$ do not.  Nor does $0^0$, unless we care to {\it define}
it to be some number.  In fact many algebra books do define it to be $1$,
but we will see in the next chapter that there are other choices which
make equal sense, so we will decline to define $0^0$.

One way to define $x^x$ and see that it is continuous for
$x>9$ is to rewrite this function
as $x^x=\left(e^{\ln x}\right)^x=e^{(\ln x)x}$.  In this last form
we see that the only thing that can ``break'' the continuity
is for $x$ to be nonpositive.  We will use that
kind of technique for rewriting such a function
on occasion in what follows, and indeed used it
before in one computation of $\frac{d\,a^x}{dx}$.
%%% END FOOTNOTE
}

Now we are interested in computing derivatives of functions in which
there is a base and an exponent, but both are allowed to vary.
The usual method is logarithmic differentiation, but a formula
is possible, and it carries some interesting intuition.  In fact
types of problems are often taught only as logarithmic differentiation
problems, so the reader should be both aware of that and able to
compute these through logarithmic differentiation, but the formula
we will derive is also worth knowing.\footnote{%%
%%% FOOTNOTE
One could in fact use logarithmic differentiation to
derive the power rule, product rule, or quotient rule,
as we will see in the exercises.  However, we do not abandon
these rules since they are convenient, efficient, and
can be easily implemented when called by other rules, while
logarithmic differentiation requires whole sides of equations
to be products, quotients, or powers, not for instance sums,
differences, or other combinations which can not have their
logarithms expanded.  Consider attempting, for instance,
logarithmic differentiation on the problem of finding $\frac{dy}{dx}$
if
$$y=\sin\left(x^2+1\right)+\tan^{-1}x-\cos e^x+\sec x\tan x.$$
This would be a somewhat long but
fairly simple problem using the older rules, but
logarithmic differentiation would be useless here, except
possibly for computing the derivative of the last,
$\sec x\tan x$ term as a separate
problem.  Even for that term, while we {\it could} use logarithmic
differentiation, a more efficient method would be to simply use
the product rule.
%%% END FOOTNOTE
}

\bex  Find $\frac{d}{dx}\left[x^{\sin x}\right]$.

\underline{Solution}:  For convenience we
(equivalently) find $\frac{dy}{dx}$ where $y=x^{\sin x}$.
\begin{alignat*}{2}
y=x^{\sin x}&\iff &\ln y&=\ln\left[x^{\sin x}\right]\\
           &\iff& \ln y&=\sin x\cdot\ln x\\
           &\implies&\frac{d\,\ln x}{dx}&
                  =\frac{d}{dx}\left[\sin x\cdot\ln x\right]\\
           &\implies&\frac1y\cdot\frac{dy}{dx}&
                  =\sin x\cdot\frac{d\,\ln x}{dx}
               +\ln x\cdot\frac{d\,\sin x}{dx}\\
           &\implies&\frac1y\cdot\frac{dy}{dx}
             &=\frac{\sin x}x+\ln x\cos x\\
           &\iff&\frac{dy}{dx}&=
            y\left[\frac{\sin x}x+\ln x\cos x\right]
            =x^{\sin x}\left[\frac{\sin x}x+\ln x\cos x\right].
\end{alignat*}

\eex
It is very interesting to note here that the derivative simplifies
to
\begin{align*}
\frac{dy}{dx}&=\frac{\sin x\cdot x^{\sin x}}{x}+x^{\sin x}\ln x\cdot\cos x\\
             &=(\sin x)x^{\sin x-1}+x^{\sin x}\ln x\cdot\frac{d\sin x}{dx}.
\end{align*}
In the sum above, the first term is what we would have if we
assumed naively that the $\sin x$ exponent were a constant and
we used the power rule $\frac{d}{dx}\left[x^n\right]=n\cdot x^{n-1}$
with $n=sin x$.  The second term is what we would have if
we assumed naively that instead the base $x$ were a constant,
and we used the formula for the derivative of an exponential
function $\frac{d}{dx}\left[a^u\right]=a^u\ln a\cdot\frac{du}{dx}$.
So it appears that the change we measure by applying $\frac{d}{dx}$
has two components, the first assuming that the exponent is constant
and measuring that part of the change we get from the base changing,
and the second assuming the base is constant and measuring the change
we get from the exponent changing.  This is very much akin
to our earlier interpretation of the product rule
(See again the notes on the roles of the various factors in the
product rule, page \pageref{NotesOnProductRule}.)  This gives us
a general formula, which is slightly more complicated than one might
anticipate from the above example because of a chain rule involved
in computing the component from the change in the base:
\begin{equation}
\frac{d}{dx}\left[(f(x))^{g(x)}\right]
   =g(x)\cdot[f(x)]^{g(x)-1}\cdot\frac{d}{dx}[f(x)]
    \ +\ (f(x))^{g(x)}\ln f(x)\cdot\frac{d}{dx}[g(x)].
\label{FuctionRaisedToAFunction}\end{equation}
Again, the first term is computed as though the exponent were
constant and the power rule employed, while the second term
is computed as though the base were constant and the exponential
rule used.  In both cases, chain rule versions were necessary
to be most general.

Two possible proofs come to mind.  One is to rewrite the original
function with a constant base, so that
$$(f(x))^{g(x)}=\left[e^{\ln f(x)}\right]^{g(x)}
   =e^{(\ln f(x))(g(x))},$$
and use the chain rule, with a product rule inside, finally rewriting
the result with the original base.

More in the spirit of how these problems are usually presented is a
proof using logarithmic differentiation.  Below we consolidate
some of the steps.  Note that we assume $f(x)>0$ for continuity's sake.
\begin{alignat*}{2}
y=(f(x))^{g(x)}&\implies&\ln y&=g(x)\ln f(x)\\
 &\implies&\frac{1}{y}\cdot\frac{dy}{dx}
  &=g(x)\cdot\frac{d\,\ln f(x)}{dx}+\ln f(x)\cdot\frac{d\,g(x)}{dx}\\
 &\implies&\frac{1}{y}\cdot\frac{dy}{dx}
  &=g(x)\cdot\frac{1}{f(x)}\cdot\frac{d\,f(x)}{dx}
     +\ln f(x)\cdot\frac{d\,g(x)}{dx}\\
 &\implies&\frac{dy}{dx}&=y\left[g(x)\cdot\frac{1}{f(x)}\cdot\frac{d\,f(x)}{dx}
     +\ln f(x)\cdot\frac{d\,g(x)}{dx}\right]\\
 &\implies&\frac{dy}{dx}&=(f(x))^{g(x)}
 \left[g(x)\cdot\frac{1}{f(x)}\cdot\frac{d\,f(x)}{dx}
     +\ln f(x)\cdot\frac{d\,g(x)}{dx}\right]\\
 &\implies&\frac{dy}{dx}&=
  g(x)\cdot[f(x)]^{g(x)-1}\cdot\frac{d}{dx}[f(x)]
    \ +\ (f(x))^{g(x)}\ln f(x)\cdot\frac{d}{dx}[g(x)],
\end{alignat*}
q.e.d.  While the formula above is rather long, it is easy enough
to memorize if it is remembered in spirit:  again, the
first term treats $g(x)$ as a constant, and the second treats
$f(x)$ as a constant.  Still, it is predictable that many
students would feel more comfortable either using logarithmic
differentiation, or the change of base (to $e$) strategy.

It is interesting to note that this new derivative formula
in fact generalizes the power and exponential rules.
\begin{enumerate}
\item If $g(x)$ is constant, so $\frac{d}{dx}[g(x)]=0$, then
we get the power rule, in its chain rule version.
\item If $f(x)$ is constant, so $\frac{d}{dx}[f(x)]=0$, then
we get the exponential rule, in its chain rule version.
\end{enumerate}

But for now we need to consider more examples.

\bex Find $\ds{\frac{d}{dx}\left[(\ln x)^x\right]}$.

\underline{Solution}: While we can use logarithmic differentiation
here, we will use our general formula, first treating the
exponent $x$ as constant, and then the base $\ln x$ as constant.
\begin{align*}
\frac{d}{dx}\left[(\ln x)^x\right]
 &=x(\ln x)^{x-1}\frac{d}{dx}\ln x+(\ln x)^x(\ln(\ln x))\cdot\frac{d}{dx}[x]\\
 &=x(\ln x)^{x-1}\cdot\frac1x+(\ln x)^x(\ln(\ln x))\cdot1\\
 &=(\ln x)^{x-1}+(\ln x)^x\ln(\ln x).\footnotemark
\end{align*}
\eex
\footnotetext{%
%%% FOOTNOTE
In most mathematical literature, the short-hand for
$\ln(\ln x)$ is simply $\ln\ln x$.  It is not uncommon to see
such things as $\ln\ln\ln x\ln \ln x$, meaning
$[\ln(\ln(\ln x))][\ln(\ln x)]$, for instance.
%%% END FOOTNOTE
}
\bex Compute $\ds{\frac{d}{dx}\left[x^{e^x}\right]}$.

\underline{Solution}:
\begin{align*}
\frac{d}{dx}\left[x^{e^x}\right]
&=e^x[x]^{e^x-1}\frac{dx}{dx}+x^{e^x}\ln x\frac{d\,e^x}{dx}\\
&=e^x[x]^{e^x-1}\cdot1+x^{e^x}\ln x\cdot e^x\\
&=e^x[x]^{e^{x}-1}+e^xx^{e^x}\ln x.
\end{align*}

\eex
\newpage
\begin{center}\underline{\Large{\bf Exercises}}\end{center}
\bigskip
\begin{multicols}{2}
\begin{enumerate}
\item Compute the following derivatives.
  \begin{enumerate}
  \item $\ds{\frac{d}{dx}\left[4^{\sin x}\right]}$
  \item $\ds{\frac{d}{dx}\left[\sin4^x\right]}$
  \item $\ds{\frac{d}{dx}\log_2|\tan x|}$
  \item $\ds{\frac{d}{dx}\tan\left(\log_2x\right)}$
  \item $\ds{\frac{d}{dx}\log_43^x}$
  \item $\ds{\frac{d}{dx}\log_2\left|\frac{x}{x^2+1}\right|}$
  \item $\ds{\frac{d}{dx}\log_2\left[\sin^2x\cos^4x\right]}$
  \item $\ds{\frac{d}{dx}\left[3^{2^x}\right]}$
  \end{enumerate}
\item Use logarithmic differentiation
  to prove the following,  previous differentiation rules.
  \begin{enumerate}
  \item  $\ds{\frac{d\,a^x}{dx}=a^x\ln a}$,
      assuming $a>0$.
  \item $\ds{\frac{d[uv]}{dx}=u\cdot\frac{dv}{dx}
                                  +v\cdot\frac{du}{dx}}$.
  \item $\ds{\frac{d}{dx}\left[\frac{u}v\right]
           =\frac{v\cdot\frac{du}{dx}-u\cdot\frac{dv}{dx}}{v^2}}$.
  \item $\ds{\frac{d\,x^n}{dx}=n\cdot x^{n-1}}$.
  \item $\ds{\frac{d\,\sec x}{dx}=\sec x\tan x}$, using the derivative
        formula for $\cos x$ and the fact that $\sec x=1/\cos x$.
  \item $\ds{\frac{d\,e^x}{dx}=e^x}$
  \end{enumerate}
\item Use logarithmic differentiation to compute the following.
  \begin{enumerate}
  \item $\ds{\frac{d}{dx}\sqrt{\frac{1+x}{1-x}}}$
  \item $\ds{\frac{d}{dx}\left[\left(10x^2+9\right)\right]}$
  \item $\ds{\frac{d}{dx}
             \left[\left(x^2+4\right)^3\left(x^3+5\right)^6\right]}$
  \item $\ds{\frac{d}{dx}\left[\frac{x^5}{\left(x^4+8x-\right)^3}\right]}$
  \item $\ds{\frac{d}{dx}\left[e^{2x}\sin5x\cos9x\right]}$
  \item $\ds{\frac{d}{dx}
        \left[\frac{\sin^5x\sqrt[3]{x^2-2}}{2(6x-7)^4(2x+5)^3}\right]}$
  \end{enumerate}
\item Compute $\frac{dy}{dx}$ for each of the following.  You may use
      either logarithmic differentiation,
      or (\ref{FuctionRaisedToAFunction}).  (It would be useful
      to use both and examine how the results are in fact the same.)
  \begin{enumerate}
  \item $\ds{y=x^x}$
  \item $\ds{y=x^{1/x}}$
  \item $\ds{y=x^{x^x}=(x)^{\left(x^x\right)}}$
  \item $\ds{y=\left(\frac{\sin x}x\right)^x}$
  \end{enumerate}

\end{enumerate}
\end{multicols}

\newpage

\newpage