\chapter{Indefinite Integrals}

By an {\bf antiderivative} of a function $f(x)$ we mean a function
$F(x)$ whose derivative is $f(x)$.  The reason for the term is that
we're going in the opposite direction from
taking the derivative.  For example, an \index{antiderivative} antiderivative of the function
$f(x)=x^2$ is $F(x)=\frac{1}{ 3}x^3$, since the function $F(x)=\frac{1}{ 3}x^3$
has derivative $F'(x)=x^2$.  But note that $\frac{1}{ 3}x^3+5$ is also an
antiderivative of $x^2$, and in fact so is $\frac{1}{ 3}x^3+C$ for any
constant $C$.  This is because a constant has derivative zero, and so we
can add it to our function $F(x)$ without affecting the derivative $F'(x)$.


Notice that a constant $C$ is the {\em only} thing that can be added to
$F(x)$ without affecting the derivative.  If it were possible to add some
other function $G(x)$, then we would have to have $F'(x)+G'(x)=F'(x)$, i.e.,
$G'(x)=0$.  But any function that is not constant must either increase
or decrease for certain values of $x$, and at such $x$ it has
a nonzero derivative.  To put this another way, the {\em only} function
$G(x)$ whose graph is always pointing horizontally is a constant function.
{\bf (There is a subtle point involved here.
If you consider any interval contained in the domain of the function
$f(x)$, then $G'(x)$ exists and is zero on such an interval, so we
can argue that $G(x)$ is a constant. However, if the domain of $f(x)$ 
is split into disjoint intervals, then the function $G(x)$ can take on
distinct constant values on them. Thus it becomes a step function
rather than a constant. 
Usually, we have a single interval in mind and this point is not
stressed at all.
)}

Thus, if we find one antiderivative $F(x)$ for $f(x)$, then we can write the
most general antiderivative as $F(x)+C$, where $C$ is an arbitrary constant.
(As explained above, this is valid on some interval in the domain of $f(x)$.)

The notation for the \index{general antiderivative} general antiderivative of $f(x)$ is 
$\int f(x)\,dx$, where
the {\it integral sign} $\int$ says ``take the antiderivative,'' and the
``$dx$'' indicates what the variable is.  Thus, we write
\[
         \int x^2\,dx=\frac{1}{ 3}x^3+C.
\]

The expression $\int f(x)\,dx$ is said to be an {\bf indefinite integral}
of the function $f(x)$.\index{indefinite integral}
The term ``indefinite'' is used because of the constant $C$ that
always appears in the answer to an antiderivative problem.  $C$ is called
the ``constant of integration.'' index{constant of integration} The function $f(x)$ that is being integrated
is called the ``integrand.'' \index{integrand} 

\smallskip

Another way to state an antiderivative problem is to say that we want to
find a function $y=F(x)$ that satisfies the equation $y'=\frac{dy}{
dx}=f(x)$.  Such an equation $y'=f(x)$, in which $y$ stands for an {\it
unknown function}, is called a {\bf differential equation.} In general,
{\it a \index{differential equation} differential equation is an equation for an unknown function in
which the derivative (and maybe the second or higher derivatives) occur}.
Differential equations will be treated at greater length in higher courses.

\smallskip

The above example $f(x)=x^2$ suggests how we can take the
antiderivative of any power function $x^n$.  Just increase the power
by 1, and divide by $n+1$ in order to cancel the factor of $n+1$ that
arises when taking the derivative of $x^{n+1}$.  In other words,
\[
  \int x^ndx=\frac{1}{ n+1}x^{n+1}+C,\qquad\text{for~any~}n\text{~except~}-1
\]
(the formula makes no sense if $n=-1$; the antiderivative of the
function $x^{-1}$ is a special case, and it will be dealt with 
in the exercises below.
%%%% To update! ln(x) should probably be done earlier anyway!
  This formula can be regarded as the reverse of the $nx^{n-1}$
rule for taking derivatives.  As in that rule, $n$ is allowed to be negative or
fractional.

\smallskip

The same formula can be used with other names for the $x$-variable, for
example,
\[
  \int t^n\,dt=\frac{1}{ n+1}t^{n+1}+C;\qquad\qquad
  \int u^n\,du=\frac{1}{ n+1}u^{n+1}+C;\qquad\text{etc.}
\]

\smallskip

antiderivatives, like derivatives, are {\bf linear}.  This means that
if we know the antiderivatives of a bunch of functions, then we can compute
the antiderivative of any linear combination of those functions.  For
example, using the above formula for $\int x^ndx$, we can find the
antiderivative of any polynomial.



%Example 1.
\begin{example}\
\label{eg:16.1}

(a) $\int x^3-6x^2+3x+4\,dx=\frac{1}{ 4}x^4-6\cdot
\frac{1}{ 3}x^3+3\cdot\frac{1}{ 2}x^2+4x+C=\frac{1}{ 4}x^4-2x^3+1.5x^2+4x+C$.

\smallskip

(b) $\int \left(\sqrt{x}-\frac{1}{ x^2}\right)dx=\int\left(x^{1/2}-x^{-2}\right)
dx=\frac{1}{ 3/2}x^{3/2}-\frac{1}{ -1}x^{-1}+C=\frac{2}{ 3}x^{3/2}+\frac{1}{ x}+C$.

\end{example}


In practical problems, often the time $t$ is playing the role of the
$x$-variable, and the function $f(t)$ to be integrated is the rate of
change of something.  Just as the derivative procedure takes us from the
distance function $s(t)$ to the velocity function $v(t)$ and from the
velocity to the acceleration $a(t)$, the antiderivative procedure takes us
from $a(t)$ to $v(t)$ and then to $s(t)$.  Below we will give examples of
this.

\smallskip

Being able to find antiderivatives is at least as important as being able
to find derivatives, for the following reason.  Very often in the real
world we do not start out knowing a formula for something, but rather we
know some information about how it is changing, i.e., about its derivative.
For example, in physics we have Newton's law of motion that says that
Force$=$Mass$\times$Acceleration.  Usually the basic thing we know about is
the forces.  This immediately gives us the acceleration function $a(t)$.
From that we want to ``go backwards'' (i.e., find antiderivatives) to get
the velocity function $v(t)$, and then finally what we are really
interested in, which is the location $s(t)$ of the object.  A basic example
of this is a \index{falling body problem} falling body problem.



\section{From Acceleration to Velocity to Distance; Falling Bodies}
\index{Acceleration to Velocity to Distance}
Earlier in the course, we encountered the falling body formula
$s(t)=-\frac{1}{ 2}gt^2+ v_0t+s_0$ for the height of an object above the
ground after $t$ seconds.  However, we did not give any explanation of how
that formula arises --- in fact, at first the whole formula (especially the
$\frac{1}{ 2}$ at the beginning) looks ``pulled out of a hat.''  Now we are
ready to derive the formula starting from a basic principle of physics:
{\it near the surface of the earth gravity causes a constant force of
acceleration}.  That ``gravitational acceleration'' $g$ is $9.806194$
m/sec${}^2$ (we'll use simply $9.8$ m/sec${}^2$ or $32$ ft/sec${}^2$).
More precisely, the \index{gravitational acceleration} gravitational acceleration is $-g$ if we take upward to
be the positive direction; it is $g$ if downward is taken to be the positive
direction.  We shall usually take upward to be the positive direction.
If we are near the surface of some other planet, the same
principle applies, but with a different value of $g$.

\smallskip

The basic principle can be restated as follows: if no force other than
gravity is affecting the object's motion (in particular, we neglect air
resistance), then the acceleration function $a(t)$ is the constant $-g$:
$a(t)=-g$.  Our object is to derive the formula for the height function
$s(t)$.  We do this in two steps:

\smallskip

{\bf Finding} $v(t)$.  Since $dv/dt=a(t)$, it follows that $v(t)$ is an
antiderivative of $a(t)=-g$.  But the antiderivative of the constant $-g$ is
$-\int g\,dt=-gt+C$.  Thus, $v(t)=\int a(t)\,dt=-\int g\,dt=-gt+C$.  How do we
find $C$?  Here we have to suppose that we know ``initial information,''
i.e. the value of $v(t)$ when $t=t_0$, which we call $v_0$.  (Often, but
not always, the initial time $t_0$ will be $0$.) In order for
$v(t_0)$ to equal $v_0$, we must have $v_0=-g\cdot t_0+C$, i.e., our constant
of integration is $v_0+gt_0$.  In general, {\it you solve for the constant of
integration using initial information}.  Thus, $v(t)=-gt+v_0+gt_0=
-g(t-t_0)+v_0$.  (In this
simple situation, we could have obtained the same result by common sense:
if something starts at value $v_0$ and decreases at {\it constant} rate
$g$, then after $t-t_0$ seconds its value is $v_0-g(t-t_0)$.)  If the
initial time is $t=0$, as is often the case, then $v=-gt+v_0$.

\smallskip

{\bf Finding} $s(t)$.  Let us suppose that $t_0=0$, i.e., the starting
time for the falling body is taken to be $t=0$.  Since $ds/dt=v(t)$, it
follows that $s(t)$ is an antiderivative of $v(t)=-gt+v_0$, i.e.,
\[
  s(t)=\int v(t)\,dt=
     \int -gt+v_0\>dt=-g\frac{1}{ 2}t^2+v_0t+C_1=-\frac{1}{ 2}gt^2+v_0t+C_1.
\]   
(We used $C_1$ rather than $C$ for the constant of integration because it
has no relation to the $C$ in the last paragraph.)  To find the constant of
integration $C_1$ we must again have initial information.  Suppose we know
the height at time 0: $s(0)=s_0$.  Substituting this value for $s(t)$ when
$t=0$ gives $s_0=s(0)=-\frac{1}{ 2}g\cdot 0^2+v_0\cdot 0+C_1 =C_1$, i.e.,
$C_1=s_0$.  We obtain our final formula: $s(t)=-\frac{1}{ 2}gt^2+v_0t+s_0$.
This completes the derivation of the falling body formula.

\smallskip

Having the derivative relations $ds/dt=v(t)$ and $dv/dt=a(t)$, together
with a formula for $a(t)$, we can work back to find $s(t)$, provided we
also have two pieces of initial information that allow us to find the two
constants of integration that arise.  We assumed that the two known values
are the initial velocity and the initial height.



% Example 2
\begin{example}\
\label{eg:16.2}

Suppose that, starting at $t=1$, your \index{acceleration problem} acceleration is given by the formula
$a(t)=1/t^3$.  Your velocity is 2 units/min at that instant, and your
location is 0.  Find the distance function $s(t)$.

\smallskip

The first step is to find $v(t)=\int a(t)\,dt=\int t^{-3}dt=\frac{1}{
-2}t^{-2}+ C=-\frac{1}{ 2t^2}+C$.  The initial information is that $v(1)=2$.
Hence, substituting $t=1$ gives: $2=v(1)=-1/2+C$, and so $C=2.5$.  Thus
$v(t)=-\frac{1}{ 2t^2}+2.5$.  The second step is to find
\[
s(t)=\int v(t)\,dt
  =\int (-\frac{1}{ 2}\cdot t^{-2}+2.5)dt
  =-\frac{1}{ 2}\cdot\frac{1}{-1}t^{-1}+2.5t+C_1=\frac{1}{ 2t}+2.5t+C_1.
\] Now we use the initial
information that $s(1)=0$: $0=s(1)=\frac{1}{ 2}+2.5\cdot 1+C_1$.  Solving for
$C_1$, we obtain $C_1=-3$.  Thus, $s(t)=\frac{1}{ 2t}+2.5t-3$.

\smallskip

We can check this answer by verifying three things: (i) it has the right
second derivative $\ddot{s}=1/t^3$; (ii) its value when $t=1$ is 0;
and (iii) the value of its derivative when $t=1$ is 2.  These computations
are easy to do, and they give us the assurance that we did not make any
careless errors in the last paragraph.

\end{example}


\section{antiderivative of $\mbox{sin} x$ and $\mbox{cos} x$}
  
From the derivative formulas $\frac{d}{ dx}\sin x=\cos x$ and $\frac{d}{
dx}\cos x=-\sin x$ we obtain the corresponding antiderivative formulas:
\[
    \int\cos x\,dx=\sin x+C,\qquad\qquad\int\sin x\,dx=-\cos x+C.
\]
Notice that the derivative of $\sin$ is $\cos$, but its antiderivative is
{\it minus} $\cos$.

\smallskip

\section{Substitution} 

In practical applications we rarely encounter the pure sine or cosine
function.  As we have seen, it is useful to be able to work with the more
general sinusoidal function
\[
    f(t)=A\sin\left(\frac{2\pi}{ B}(t-C)\right)+D, 
\]
where $A$, $B$, $C$, and $D$ stand for various constants, called the
amplitude, period, phase shift, and vertical shift, respectively.  In order
to find antiderivatives of functions of this type and many other
functions, we describe a basic method for finding antiderivatives called
the {\bf method of substitution.}\index{method of substitution} 

\smallskip

In the method of substitution we choose a new variable, which will usually
be denoted $u$, and set $u$ equal to an ``inside function'' (as in the
chain rule), so that the function we are integrating takes on a simpler
appearance.  Then {\bf EVERYTHING} must be converted to the new variable
$u$.  Here ``everything'' includes the ``$dx$'' (or ``$dt$'').  We convert
$dx$ to $du$ by taking the derivative $du/dx$.  We illustrate by some
examples.  In each case the reason for having to use $du/dx$ to convert
$dx$ to $du$ will become apparent when we check our answer.  {\bf(Recall that
the answer to an antiderivative problem can always be checked by taking
the derivative and verifying that we get our original function back again.
It is also strongly recommended that you do this whenever possible.)}



%Example 3.
\begin{example}
\label{eg:16.3}

If $a$ and $b$ are constants, find formulas for:
\[
\text{ (a)} \int(ax+b)^n\,dx\text{ (for any $n\ne-1$);}\quad
\text{ (b)} \int\sin(ax+b)dx;\quad
\text{ (c)} \int\cos(ax+b)dx.
\]

\smallskip

(a) We substitute $u=ax+b$.  We also find $du/dx$, which in this case is
simply the constant $a$.  We then treat $du$ and $dx$ as if they were
algebraic quantities, writing $\frac{du}{ dx}=a\Longrightarrow du=a\,dx$, and
so $dx=\frac{1}{ a}\,du$.  Thus, in our integral we change $ax+b$ to $u$ and
we change $dx$ to $\frac{1}{ a}\,du$, thereby obtaining an integral purely in
terms of the new variable $u$:
\[
\int(ax+b)^ndx=\int u^n\frac{1}{ a}\,du=\frac{1}{ a}\cdot\frac{1}{ n+1}
u^{n+1}+C=\frac{1}{ a(n+1)}(ax+b)^{n+1}+C.
\]
(Your final answer should be written in terms of $x$, not $u$.)

{\bf Explanation:} This might be a good place to explain what the substitution means and why it works. To begin with, we have an expression $f(x)\,dx$ inside
the integral sign and when we get through with the substitution we convert this to
an expression $g(u)\,du$. Where should two such expressions be the same? 
The answer is that $f(x)$ must be equal to $g(u(x))\frac{du(x)}{dx}$. 

First suppose
that this is true and we find an antiderivative $G(u)$ for the function
$g(u)$. Then we can see that $G(u(x))$ is an antiderivative for $f(x)$, since
$\frac{d}{dx}(G(u(x)) = G'(u(x))u'(x) = g(u(x))\frac{du(x)}{dx} = f(x)$, so
$G(u(x))$ is an antiderivative of $f(x)$ as needed. Clearly, the
answer $G(u)$ that we want, is given by the symbol $\int G(u)\,du$ and this
solves the problem $\int f(x)\,dx$. So we convert the equation
$$f(x)=g(u(x))\frac{du(x)}{dx} \mbox{~to~the~equation~} f(x)dx = g(u(x))d(u(x))
\mbox{~or~}g(u)du. $$

It is possible to give completely rigorous meaning to the symbols $dx$ and $du$
as abstract (universal) derivatives (called differentials) 
and make precise sense out of the equation
$du = \frac{du}{dx} dx$, but we will not attempt to go into the details here.
We are only stating that the symbol $dx$ in  $f(x)dx$, is more than just 
a whimsical notation!

\smallskip

It is instructive to check this answer by taking its derivative.  We find
ourselves using the chain rule --- as always happens when checking an
antiderivative that was found by a $u$-substitution:
\[
\frac{d}{ dx}\left(\frac{1}{ a(n+1)}(ax+b)^{n+1}\right)=
\frac{1}{ a(n+1)}(n+1)(ax+b)^n\cdot a=(ax+b)^n.
\]
Thus, the $\frac{1}{ a}$ term that we obtained when converting $dx$ to $du$
is needed to cancel the factor of $a=du/dx$ that comes out from the chain
rule.

\smallskip

This also explains the importance of the $dx$ (or $dt$ or $du$, depending
on what the variable of integration is) inside the integral.  Keeping track
of that part of the integral in the course of a $u$-substitution will give
you the right antiderivative.  Do not get into the careless habit of
omitting the $dx$ (or $dt$ or $du$) in an integral.

\smallskip

(b) Again we take $u=ax+b$, so that $dx=\frac{1}{ a}du$, and our integral
becomes
\[
 \int\sin(ax+b)\,dx=\int\sin u\,\frac{1}{ a}du=\frac{1}{ a}(-\cos u)+C=
    -\frac{1}{ a}\cos(ax+b)+C.
\]
You should check this formula by taking the derivative of $-\frac{1}{ a}
\cos(ax+b)$.

\smallskip

(c) This works just like part (b).  The result is $\int\cos(ax+b)dx=
\frac{1}{ a}\sin(ax+b)+C$.

\end{example}


% Example 4
\begin{example}
\label{eg:16.4}

Find: 
\[
\text{(a)}~\int x\cos(x^2)\,dx;\qquad\qquad
\text{(b)}~\int\frac{\cos(\pi t)dt}{\sin^2(\pi t)};\qquad\qquad
\text{(c)}~\int \frac{\sin\frac{\pi t}{ 10}\>dt}{\sqrt{1+\cos\frac{\pi t}{ 10}}}.
\]

\smallskip

(Note that in parts (b)--(c) we have brought the $dt$ into the numerator,
instead of putting it at the far right of the integral.)

\smallskip

(a) Here we take $u$ equal to the expression inside the cosine, namely,
$u=x^2$.  Then $du/dx=2x$, and so $du=2x\,dx$.  Fortunately, the integral
contains $x$ as well as $dx$, and so, bringing the $x$ and $dx$ together,
we can replace the product $x\,dx$ by $\frac{1}{ 2}du$:
\[
\int x\cos(x^2)\,dx=\int(\cos u)\,\frac{1}{ 2}du=\frac{1}{ 2}\int\cos u\,du
=\frac{1}{ 2}\sin u +C=\frac{1}{ 2}\sin(x^2)+C.
\]
Notice how, when we check by taking $\frac{d}{ dx}\left(\frac{1}{ 2}
\sin(x^2)\right)$, we get $x\cos(x^2)$ because of the chain rule.

\smallskip

(b) Here we can greatly simplify the denominator if we take $u=\sin(\pi
t)$.  Then $\frac{du}{ dt}=\pi\,\cos(\pi t)$, and so $du=\pi\,\cos(\pi t)dt$,
which --- fortunately for us --- happens to be what is in the numerator
(except for the constant $\pi$, which does not cause us any problems).
That is, we can replace $\cos(\pi t)dt$ by $\frac{1}{\pi}du$:
\[
  \int\frac{\cos(\pi t)\,dt}{\sin^2(\pi t)}=\int \frac{\frac{1}{\pi}du}{ u^2}=
  \int\frac{1}{\pi}u^{-2}du=\frac{1}{\pi}\frac{1}{-1}u^{-1}+C=
   -\frac{1}{\pi u}+C=-\frac{1}{\pi\sin(\pi t)}+C.
\]

\smallskip

(c) Here we can obtain a much simpler integrand by substituting $u$ in
place of the expression in the radical: $u=1+\cos\frac{\pi t}{ 10}$.  Then
$\frac{du}{ dt}=0-(\sin\frac{\pi t}{ 10})(\frac{\pi}{ 10})$, and so
$du=-\frac{\pi}{ 10}\sin\frac{\pi t}{ 10}\,dt$.  So the numerator in the
integral is $-\frac{10}{\pi}du$, and we obtain
\[
  \int\frac{-10/\pi}{\sqrt{u}}du=\int-\frac{10}{\pi}u^{-1/2}du=
-\frac{10}{\pi}\frac{1}{ 1/2}u^{1/2}+C=-\frac{20}{\pi}\sqrt{1+\cos\frac{\pi t}{ 10}}
+C.
\] 
\end{example}

