Category Archives: Calculus

The Proof of the Chain Rule

In this note, we introduce two versions of the proof of the Chain Rule. The first one comes from [1]. Let $y=f(u)$ and $u=g(x)$ be differentiable functions. We claim that
$$\frac{dy}{dx}=f'(u)g'(x)$$
The finite difference $\frac{f(g(x+h))-f(g(x))}{h}$ can be written as $\frac{f(u+k)-f(u)}{h}$ where $k=g(x+h)-g(x)$. Define $\varphi(t)=\frac{f(u+t)-f(u)}{t}-f'(u)$ if $t\ne 0$. Multiplying by $t$ and rearranging terms, we obtain
\begin{equation}
\label{eq:chainpf}
f(u+t)-f(u)=t[\varphi(t)+f'(u)]
\end{equation}
$\lim_{t\to 0}\varphi(t)=0$ so we define $\varphi(0)=0$. Then \eqref{eq:chainpf} is defined for all $t$. Now replace $t$ in \eqref{eq:chainpf} by $k$.
\begin{equation}
\label{eq:chainpf2}
\frac{f(u+k)-f(u)}{h}=\frac{k}{h}[\varphi(k)+f'(u)]
\end{equation}
\eqref{eq:chainpf2} is valid even if $k=0$. When $h\to 0$, $\frac{k}{h}\to g'(x)$ and $\varphi(k)\to 0$. Hence the RHS of \eqref{eq:chainpf2} approaches $f'(u)g'(x)$. This completes the proof.

Another version of the proof of the Chain Rule is from [2] as a guided exercise (# 99 on page p. 559). Here we suppose that $y=f(u)$ is differentiable at $u_0=g(x_0)$ and $u=g(x)$ is differentiable at $x_0$. Then we claim that $y=f(g(x))$ is differentiable at $x=x_0$ and $$\left[\frac{dy}{dx}\right]_{x=x_0}=f'(u_0)g'(x_0)$$
Since $g'(x_0)$ exists, $\Delta u$ can be written as
$$\Delta u=g'(x_0)\Delta x+\rho(x)$$
where $\lim_{\Delta x\to 0}\frac{\rho(x)}{\Delta x}=0$. Similarly, if $\Delta u\ne 0$ (it could be 0), then $\Delta y$ can be written as
\begin{equation}
\label{eq:chainpf3}
\Delta y=f'(u_0)\Delta u+\sigma(u)
\end{equation}
where $\lim_{\Delta u\to 0}\frac{\sigma(u)}{\Delta u}=0$.
\begin{align*}
\Delta y&=f'(u_0)[g'(x_0)\Delta x+\rho(x)]+\sigma(g(x))\\
&=f'(u_0)g'(x_0)\Delta x+f'(u_0)\rho(x)+\sigma(x)
\end{align*}
As $\Delta u\to 0$, $\Delta y\to 0$ and accordingly $\sigma(u)\to 0$. So one can define $\sigma(U)=0$ if $\Delta u=0$ (that is one can define $\sigma(u_0)=\sigma(g(x_0))=0$). Then \eqref{eq:chainpf3} is still valid if $\Delta u=0$.
$$\frac{\sigma(g(x))}{\Delta x}=\left\{\begin{array}{ccc}
\frac{\sigma(g(x))}{\Delta u}\cdot\frac{\Delta u}{\Delta x} & \mbox{if} & \Delta u\ne 0\\
0 & \mbox{if} & \Delta u=0\end{array}\right.\to 0$$
as $\Delta x\to 0$. Therefore,
$$\frac{\Delta y}{\Delta x}=f'(u_0)g'(x_0)+f'(u_0)\frac{\rho(x)}{\Delta x}+\frac{\sigma(g(x))}{\Delta x}$$
approaches
$$\frac{dy}{dx}=f'(u_0)g'(x_0)$$
as $\Delta x\to 0$.

References:

[1] Tom M. Apostol, Calculus, Volume I One-Variable Calculus with an Introduction to Linear Algebra, 2nd Edition, John Wiley & Sons, Inc., 1967

[2] Jerrold Marsden and Alan Weinstein, Calculus II, Springer-Verlag, 1985

Trigonometric Integrals

Let us attempt to calculate $\int\cos^n xdx$ where $n$ is a positive integer. In the following table, the first column represents $\cos^{n-1}x$ and its derivative, and the second column represents $\cos x$ and its integral.
$$\begin{array}{ccc}
\cos^{n-1}x & & \cos x\\
&\stackrel{+}{\searrow}&\\
-(n-1)\cos^{n-2}x\sin x & \stackrel{-}{\longrightarrow} & \sin x\\
\end{array}$$
By integration by parts, we have
\begin{align*}
\int\cos^n xdx&=\cos^{n-1}x\sin x+(n-1)\int\cos^{n-2}x\sin^2xdx\\
&=\cos^{n-1}x\sin x+(n-1)\int\cos^{n-2}xdx-(n-1)\int\cos^{n-1}xdx+C’
\end{align*}
where $C’$ is a constant. Solving this for $\int\cos^nxdx$, we obtain
\begin{equation}
\label{eq:cosred}
\int\cos^n xdx=\frac{1}{n}\cos^{n-1}x\sin x+\frac{n-1}{n}\int\cos^{n-2}xdx+C
\end{equation}
where $C=\frac{C’}{n}$. The formula such as \eqref{eq:cosred} is called a reduction formula. Similarly we obtain the following reduction formulae.
\begin{align}
\int\sin^n xdx&=-\frac{1}{n}\sin^{n-1}x\cos x+\frac{n-1}{n}\int\sin^{n-2}dx\\
\int\tan^nxdx&=\frac{1}{n-1}\tan^{n-1}x-\int\tan^{n-2}dx,\ n\ne 1\\
\int\sec^nxdx&=\frac{1}{n-1}\sec^{n-2}x\tan x+\frac{n-2}{n-1}\int\sec^{n-2}xdx,\ n\ne 1
\end{align}
Example. Use the reduction formula \eqref{eq:cosred} to evaluate $\int\cos^3xdx$.

Solution.
\begin{align*}
\int\cos^3xdx&=\frac{1}{3}\cos^2x\sin x+\frac{2}{3}\int\cos xdx\\
&=\frac{1}{3}\cos^2x\sin x+\frac{2}{3}\sin x+C,
\end{align*}
where $C$ is a constant.

Integral like the following example is rather tricky.

Example. Evaluate $\int\sec xdx$.

Solution.
\begin{align*}
\int\sec xdx&=\int\sec x\frac{\sec x+\tan x}{\sec x+\tan x}dx\\
&=\int\frac{\sec^2x+\sec x\tan x}{\sec x+\tan x}dx\\
&=\frac{du}{u}\ (\mbox{substitution}\ u=\sec+\tan x)\\
&=\ln|u|+C\\
&=\ln|\sec x+\tan x|+C,
\end{align*}
where $C$ is a constant.

Example. Evaluate $\int\csc xdx$.

Solution. It can be done similarly to the previous example.
\begin{align*}
\int\csc xdx&=\int\csc x\frac{\csc x+\cot x}{\csc x+\cot x}dx\\
&=-\ln|\csc x+\cot x|+C,
\end{align*}
where $C$ is a constant. Note \begin{align*}-\ln|\csc x+\cot x|&=\ln\left|\frac{1}{\csc x+\cot x}\right|\\&=\ln\left|\frac{\csc x-\cot x}{\csc^2x-\cot^2}\right|\\&=\ln|\csc x-\cot x|\end{align*} since $\csc^2\theta+1=\cot^2\theta$. Thus, $\int\csc xdx$ can be also written as $$\int\csc xdx=\ln|\csc x-\cot x|+C$$

Evaluating Integrals of the Type $\int\sin^mx\cos^nxdx$ Where $m,n$ Are Positive Integers

Case 1. One of the integer powers, say $m$, is odd.

$m=2k+1$ for some integer $k$. So,
\begin{align*}
\sin^mx&=\sin^{2k+1}x\\
&=(\sin^2x)^k\sin x\\
&=(1-\cos^2x)^k\sin x.
\end{align*}
Use the substitution $u=\cos x$ in this case.

Example. Evaluate $\int\sin^3x\cos^2xdx$.

Solution.
\begin{align*}
\int\sin^3x\cos^2xdx&=\int \sin^2x\sin x\cos^2xdx\\
&=\int(1-\cos^2x)\cos^2x\sin xdx\\
&=-\int(1-u^2)u^2du\ (\mbox{substition}\ u=\cos x)\\
&=\frac{u^5}{4}-\frac{u^3}{3}+C\\
&=\frac{\cos^5x}{5}-\frac{\cos^3x}{3}+C,
\end{align*}
where $C$ is a constant.

Example. Evaluate $\int\cos^3xdx$.

Solution.
\begin{align*}
\int\cos^3xdx&=\int\cos^2x\cos xdx\\
&=\int(1-\sin^2x)\cos xdx\\
&=\int(1-u^2)du\ (\mbox{substitution}\ u=\sin x)\\
&=u-\frac{u^3}{3}+C\\
&=\sin x-\frac{\sin^3x}{3}+C,
\end{align*}
where $C$ is a constant.

Case 2. If both $m$ and $n$ are even.

In this case, use the trigonometric identities
$$\sin^2x=\frac{1-\cos 2x}{2},\ \cos^2x=\frac{1+\cos 2x}{2}.$$

Example. Evaluate $\int\sin^2x\cos^4xdx$.

Solution. $$\cos^4x=(\cos^2x)^2=\left(\frac{1+\cos 2x}{2}\right)^2\\=\frac{1}{4}(1+\cos 2x)^2$$ so \begin{align*}\int\sin^2x\cos^4xdx&=\frac{1}{8}\int(1-\cos 2x)(1+\cos 2x)^2dx\\&=\frac{1}{8}\int(1-\cos^2 2x)(1+\cos 2x)dx\\&=\frac{1}{8}\int(1+\cos 2x-\cos^22x-\cos^32x)dx\end{align*}\begin{align*}\int\cos^32xdx&=\int\cos^22x\cos 2xdx\\&=\int(1-\sin^22x)\cos 2xdx\\&=\int (1-u^2)du\ (\mbox{substitution}\ u=\sin 2x)\\&=u-\frac{u^3}{3}\\&=\sin 2x-\frac{\sin^32x}{3}\end{align*} \begin{align*}\int\cos^22xdx&=\int\frac{1+\cos 4x}{2}dx\\&=\frac{x}{2}+\frac{1}{8}\sin 4x\end{align*} (For these integrals the constant of integration has been neglected.) Therefore, $$\int\sin^2x\cos^4xdx=\frac{1}{16}\left(x-\frac{1}{4}\sin 4x+\frac{1}{3}\sin^32x\right)+C$$
where $C$ is a constant.

Update: I realized that the calculation above is more complicated than it should. Here is a simpler version. \begin{align*}\int\sin^2x\cos^4xdx&=\frac{1}{8}\int(1-\cos 2x)(1+\cos 2x)^2dx\\&=\frac{1}{8}\int(1-\cos^2 2x)(1+\cos 2x)dx\\&=\frac{1}{8}\int\sin^22x(1+\cos 2x)dx\\&=\frac{1}{8}\left[\int\sin^22xdx+\int\sin^22x\cos 2xdx\right]\\&=\frac{1}{8}\left[\frac{1}{2}\int(1-\cos 4x)dx+\frac{1}{2}\int u^2du\right]\ (\mbox{For the second integral substitution}\ u=\sin 2x\ \mbox{is used})\\&=\frac{1}{16}\left[x-\frac{1}{4}\sin 4x+\frac{u^3}{3}\right]+C\\&=\frac{1}{16}\left[x-\frac{1}{4}\sin 4x+\frac{1}{3}\sin^32x\right]+C\end{align*}

Integrals of Powers of $\tan x$ and $\sec x$

This type of integrals can be mostly done by using the trigonometric identity
$$1+\tan^2x=\sec^2x.$$

Example. Evaluate $\int\tan^4xdx$.

Solution.
\begin{align*}
\int\tan^4xdx&=\int\tan^2x\tan^2xdx\\
&=\int\tan^2x(\sec^2x-1)dx\\
&=\int\tan^2x\sec^2xdx-\int\tan^2xdx\\
&=\int u^2du-\int(\sec^2x-1)dx\ (\mbox{substition}\ u=\tan x)\\
&=\frac{\tan^3x}{3}-\tan x+x+C,
\end{align*}
where $C$ is a constant.

Example. Evaluate $\int\sec^3xdx$.

Solution.
\begin{align*}
\int\sec^3xdx&=\int\sec x\sec^2xdx\\
&=\sec x\tan x-\int\tan^2x\sec xdx\ (\mbox{integration by parts})\\
&=\sec x\tan x-\int(\sec^2x-1)\sec xdx\\
&=\sec x\tan x-\int\sec^3xdx+\int\sec xdx+C’\\
&=\sec x\tan x-\int\sec^3xdx+\ln|\sec x+\tan x|+C’,
\end{align*}
where $C’$ is a constant. Hence,
$$\int\sec^3xdx=\frac{1}{2}\sec x\tan x+\frac{1}{2}\ln|\sec x+\tan x|+C,$$
where $C=\frac{C’}{2}$.

Update: Alternatively, \begin{align*}
\int\sec^3xdx&=\int\sec x\sec^2xdx\\&=\int\sec x(1+\tan^2x)dx\\&=\int\sec xdx+\int\tan x(\sec x\tan xdx)\\
&=\ln|\sec x+\tan x|+\sec x\tan x-\int\sec^3xdx+C’\ (\mbox{integration by parts})
\end{align*}
where $C’$ is a constant. Hence,
$$\int\sec^3xdx=\frac{1}{2}\sec x\tan x+\frac{1}{2}\ln|\sec x+\tan x|+C,$$
where $C=\frac{C’}{2}$.

Products of Sines and Cosines

This type of integrals include $\int\sin mx\cos nxdx$, $\int\sin mx\cos nxdx$, and $\int\cos mx\cos nxdx$. In this case use the identities
\begin{align*}
\sin mx\sin nx&=\frac{1}{2}[\cos(m-n)x-\cos(m+n)x]\\
\sin mx\cos nx&=\frac{1}{2}[\sin(m-n)x+\sin(m+n)x]\\
\cos mx\cos nx&=\frac{1}{2}[\cos(m-n)x+\cos(m+n)x]
\end{align*}
Example. Evaluate $\int\sin 3x\cos5xdx$.

Solution.
\begin{align*}
\int\sin 3x\cos5xdx&=-\frac{1}{2}\int\sin 2x+\frac{1}{2}\int\sin 8xdx\\
&=\frac{1}{4}\cos 2x-\frac{1}{16}\cos 8x+C,
\end{align*}
where $C$ is a constant.

Example. Evaluate $\int_0^1\sin m\pi x\sin n\pi xdx$ and $\int_0^1\cos m\pi x\cos n\pi xdx$ where $m$ and $n$ are positive integers.

Solution. If $m=n$, then
\begin{align*}
\int_0^1\sin m\pi x\sin n\pi xdx&=\int_0^1\sin^2m\pi xdx\\
&=\int_0^1\frac{1-\cos 4m\pi x}{2}dx\\
&=\frac{1}{2}\int_0^1dx-\frac{1}{2}\int_0^1\cos 4m\pi xdx\\
&=\frac{1}{2}-\frac{1}{8m\pi}[\sin 4m\pi x]_0^1\\
&=\frac{1}{2}.
\end{align*}
Now we assume that $m\ne n$. Then
\begin{align*}
\int_0^1\sin m\pi x\sin n\pi xdx&=\frac{1}{2}\int_0^1\cos(m-n)\pi xdx-\frac{1}{2}\int_0^1\cos(m+n)\pi xdx\\
&=0.
\end{align*}
So, we can simply write the integral as
\begin{equation}
\label{eq:orthofunct}
\int_0^1\sin m\pi x\sin n\pi xdx=\frac{1}{2}\delta_{mn},
\end{equation}
where
$$\delta_{mn}=\left\{\begin{array}{ccc}
1 & \mbox{if} & m=n,\\
0 & \mbox{if} & m\ne 0.
\end{array}\right.$$
$\delta_{mn}$ is called the Kronecker’s delta.
Similarly, we also have
\begin{equation}
\label{eq:orthofunct2}
\int_0^1\cos m\pi x\cos n\pi xdx=\frac{1}{2}\delta_{mn}.
\end{equation}
The integrals \eqref{eq:orthofunct} and \eqref{eq:orthofunct2} play an important role in studying the boundary value problems with heat equation and wave equation. They also appear in the study of different branches of mathematics and physics such as functional analysis, Fourier analysis, electromagnetism, and quantum mechanics, etc. In mathematics and physics, often functions like $\sin n\pi x$ and $\cos n\pi x$ are treated as vectors and integrals like \eqref{eq:orthofunct}  and \eqref{eq:orthofunct2} can be considered as inner products $\langle\sin m\pi x,\sin n\pi x\rangle$ and $\langle\cos m\pi x,\cos n\pi x\rangle$, respectively. In this sense, we can say that $\sin m\pi x$ and $\sin n\pi x$ are orthogonal if $m\ne n$. For this reason, functions $\sin n\pi x$ and $\cos n\pi x$, $n=1,2,\cdots$ are called orthogonal functions.

Integration by Parts

Let $f(x)$ and $g(x)$ be differentiable functions. Then the product rule
$$(f(x)g(x))’=f'(x)g(x)+f(x)g'(x)$$
leads to the integration
\begin{equation}
\label{eq:intpart}
\int f(x)g'(x)dx=f(x)g(x)-\int f'(x)g(x)dx.
\end{equation}
The formula \eqref{eq:intpart} is called integration by parts. If we set $u=f(x)$ and $v=g(x)$, then \eqref{eq:intpart} can be also written as
\begin{equation}
\label{eq:intpart2}
\int udv=uv-\int vdu.
\end{equation}

Example. Evaluate $\int x\cos xdx$.

Solution. Let $u=x$ and $dv=\cos xdx$. Then $du=dx$ and $v=\sin x$. So,
\begin{align*}
\int x\cos xdx&=x\sin x-\int\sin xdx\\
&=x\sin x+\cos x+C,
\end{align*}
where $C$ is a constant.

Example. Evaluate $\int\ln xdx$.

Solution. Let $u=\ln x$ and $dv=dx$. Then $du=\frac{1}{x}dx$ and $v=x$. So,
\begin{align*}
\int\ln xdx&=x\ln x-\int x\cdot\frac{1}{x}dx\\
&=x\ln x-x+C,
\end{align*}
where $C$ is a constant.

Often it is required to apply integration by parts more than once to evaluate a given integral. In that case, it is convenient to use tabular integral (which is equivalent to integration by parts) as shown in the following example.

Example. Evaluate $\int x^2e^xdx$

Solution. In the following table, the first column represents $x^2$ and its derivatives, and the second column represents $e^x$ and its integrals.
$$\begin{array}{ccc}
x^2 & & e^x\\
&\stackrel{+}{\searrow}&\\
2x & & e^x\\
&\stackrel{-}{\searrow}&\\
2 & & e^x\\
&\stackrel{+}{\searrow}&\\
0 & & e^x.
\end{array}$$
This table shows the repeated application of integration by parts. Following the table, the final answer is given by
$$\int x^2e^xdx=x^2e^x-2xe^x+2e^x+C,$$
where $C$ is a constant.

In order to understand why this works and why this is equivalent to integration by parts, assume that we are to evaluate the integral $\int fgdx$. Let $u=f$ and $dv=gdx$. Then by \eqref{eq:intpart2} $$\int fgdx=f\int gdx-\int f’\left(\int gdx\right)dx$$ If $\int f’\left(\int gdx\right)dx$ requires integration by parts, we would have $$\int fgdx=f\int gdx-f’\int\left(\int gdx\right)dx+\int f^{\prime\prime}\left(\int\left(\int gdx\right)dx\right)dx$$ If $\int f^{\prime\prime}\left(\int\left(\int gdx\right)dx\right)dx$ still requires integration by parts, we would have \begin{align*}\int fgdx&=f\int gdx-f’\int\left(\int gdx\right)dx+f^{\prime\prime}\int\left(\int\left(\int gdx\right)dx\right)dx\\&-\int f^{\prime\prime\prime}\left(\int\left(\int\left(\int gdx\right)dx\right)\right)dx\end{align*} This illustrates tabular integral and the process continues until the last integral no longer requires integration by parts. Sometimes the last integral becomes the same type of integral as the one in the LHS up to a constant. When that happens the last integral can be combined with the one in the LHS.

Example. Evaluate $\int x^3\sin xdx$.

Solution. In the following table, the first column represents $x^3$ and its derivatives, and the second column represents $\sin x$ and its integrals.
$$\begin{array}{ccc}
x^3 & & \sin x\\
&\stackrel{+}{\searrow}&\\
3x^2 & & -\cos x\\
&\stackrel{-}{\searrow}&\\
6x & & -\sin x\\
&\stackrel{+}{\searrow}&\\
6 & & \cos x\\
&\stackrel{-}{\searrow}&\\
0 & & \sin x.
\end{array}$$
Following the table, the final answer is given by
$$\int x^3\sin xdx=-x^3\cos x+3x^2\sin x+6x\cos x-6\sin x+C,$$
where $C$ is a constant.

Example. Evaluate $\int e^x\cos xdx$.

Solution. In the following table, the first column represents $e^x$ and its derivatives, and the second column represents $\cos x$ and its integrals.
$$\begin{array}{ccc}
e^x & & \cos x\\
&\stackrel{+}{\searrow}&\\
e^x & & \sin x\\
&\stackrel{-}{\searrow}&\\
e^x & & -\cos x.
\end{array}$$
Now, this is different from the previous two examples. While the first column repeats the same function $e^x$, the functions second column changes from $\cos x$ to $\sin x$ and to $\cos x$ again up to sign. In this case, we stop there and write the answer as we have done in the previous two examples and add to it $\int e^x(-\cos x)dx$. Notice that the integrand is the product of functions in the last row and this is the last integral we obtain from a multiple applications of integration by parts, which becomes the same type of integral as the one you began with. Hence,
$$\int e^x\cos xdx=e^x\sin x+e^x\cos x-\int e^x\cos xdx.$$
For now we do not worry about the constant of integration. Solving this for $\int e^x\cos xdx$, we obtain the final answer
$$\int e^x\cos xdx=\frac{1}{2}e^x\sin x+\frac{1}{2}e^x\cos x+C,$$
where $C$ is a constant.

Example. Evaluate $\int e^x\sin xdx$.

Solution. In the following table, the first column represents $e^x$ and its derivatives, and the second column represents $\sin x$ and its integrals.
$$\begin{array}{ccc}
e^x & & \sin x\\
&\stackrel{+}{\searrow}&\\
e^x & & -\cos x\\
&\stackrel{-}{\searrow}&\\
e^x & & -\sin x.
\end{array}$$
This is similar to the above example. The first columns repeats the same function $e^x$, and the functions in the second column changes from $\sin x$ to $\cos x$ and to $\sin x$ again up to sign. So we stop there and write
$$\int e^x\sin xdx=-e^x\cos x+e^x\sin x-\int e^x\sin xdx.$$
Solving this for $\int e^x\sin xdx$, we obtain
$$\int e^x\sin xdx=-\frac{1}{2}e^x\cos x+\frac{1}{2}e^x\sin x+C,$$
where $C$ is a constant.

Example. Evaluate $\int e^{5x}\cos 8xdx$.

Solution. In the following table, the first column represents $e^{5x}$ and its derivatives, and the second column represents $\cos 8x$ and its integrals.
$$\begin{array}{ccc}
e^{5x} & & \cos 8x\\
&\stackrel{+}{\searrow}&\\
5e^{5x} & & \frac{1}{8}\sin 8x\\
&\stackrel{-}{\searrow}&\\
25e^{5x} & & -\frac{1}{64}\cos 8x.
\end{array}$$
The first columns repeats the same function $e^{5x}$ up to constant multiple, and the functions in the second column changes from $\cos 8x$ to $\sin 8x$ and to $\cos 8x$ again to constant multiple. This case also we do the same.
$$\int e^{5x}\cos 8xdx=\frac{1}{8}e^{5x}\sin 8x+\frac{5}{64}e^{5x}\cos 8x-\frac{25}{64}\int e^{5x}\cos 8xdx.$$
Solving this for $\int e^{5x}\cos 8xdx$, we obtain
$$\int e^{5x}\cos 8xdx=\frac{8}{89}e^{5x}\sin 8x+\frac{5}{89}e^{5x}\cos 8x+C,$$
where $C$ is a constant.

The evaluation of a definite integral by parts can be done as
\begin{equation}
\label{eq:intpart3}
\int_a^b f(x)g'(x)dx=[f(x)g(x)]_a^b-\int_a^b f'(x)g(x)dx.
\end{equation}

Example. Find the area of the region bounded by $y=xe^{-x}$ and the x-axis from $x=0$ to $x=4$.

The graph of y=xexp(-x), x=0..4

The graph of y=xexp(-x), x=0..4

Solution. Let $u=x$ and $dv=e^{-x}dx$. Then $du=dx$ and $v=-e^{-x}$. Hence,
\begin{align*}
A&=\int_0^4 xe^{-x}dx\\
&=[-xe^{-x}]0^4+\int_0^4 e^{-x}dx\\
&=-4e^{-4}+[-e^{-x}]_0^4\\
&=1-5e^{-4}.
\end{align*}

The First and Second Derivative Tests

The First Derivative Test

The derivative $f'(x)$ can tell us a lot about the function $y=f(x)$. It can tell us where critical points are i.e. points at which $f'(x)=0$ and the critical points are likely places at which $y=f(x)$ assumes a local maximum or a local minimum values. By further examining the properties of $f'(x)$ we can also determine at which critical point, $f(x)$ assumes a local maximum, or a local minimum, or neither. But first we see that $f'(x)$ can tell us where $y=f(x)$ is increasing or decreasing.

Theorem. Increasing/Decreasing Test

  1. If $f'(x)>0$ on an open interval, $f$ is increasing on that interval.
  2. If $f'(x)<0$ on an open interval, $f$ is decreasing on that interval.

Example. Find where $f(x)=3x^4-4x^3-12x^2+5$ is increasing and where it is decreasing.

Solution.
\begin{align*}
f'(x)&=12x^3-12x^2-24x\\
&=12x(x^2-x-2)\\
&=12x(x-2)(x+1).
\end{align*}
The critical points are $x=-1,0,2$. Using, for instance, the test point method (which is the easiest method of solving an inequality), we obtain the following table.
$$
\begin{array}{|c|c|c|c|c|c|c|c|}
\hline
x & x<-1 & -1 & -1<x<0 & 0 & 0<x<2 & 2 & x>2\\
\hline
f'(x) & – & 0 & + & 0 & – & 0 & +\\
\hline
f(x) & \searrow & f(-1) & \nearrow & f(0) & \searrow & f(2) &\nearrow\\
\hline
\end{array}
$$
So we find that $f$ is increasing on $(-1,0)\cup(2,\infty)$ and $f$ is decreasing on $(-\infty,-1)\cup(0,2)$.

Now, local maximum values and local minimum values can be identified by observing the change of sign of $f'(x)$ at each critical point.

Theorem. [The First Derivative Test] Suppose that $c$ is a critical point of a differentiable function $f(x)$.

  1. If the sign of $f'(x)$ changes from $+$ to $-$ at $c$, $f(c)$ is a local maximum.
  2. If the sign of $f'(x)$ changes from $-$ to $+$ at $c$, $f(c)$ is a local minimum.
  3. If the sign $f'(x)$ does not change at $c$, $f$ has neither a local maximum nor a local minimum at $c$.

Example. In the previous example, the sign of $f'(x)$ changes from $+$ to $-$ at $0$, so $f(0)=5$ is a local maximum. The sign of $f'(x)$ changes from $-$ to $+$ at $-1$ and at $2$, so $f(-1)=0$ and $f(2)=-27$ are local minimum values.

The following figure confirms our findings from the above two examples.

The graph of f(x)=3x^4-4x^3-12x^2+5

The graph of f(x)=3x^4-4x^3-12x^2+5

The Second Derivative Test

The second order derivative $f^{\prime\prime}(x)$ can provide us an additional piece of information on $y=f(x)$, namely the concavity of the graph of $y=f(x)$.

Definition. If the graph of $f$ lies above all of its tangents on an open interval $I$, it is called concave upward on $I$. If the graph of $f$ lies below all of its tangents on $I$, it is called concave downward on $I$.

From here on, $\smile$ denotes “concave up” and $\frown$ denotes “concave down”.

Definition. A point $(d,f(d))$ on the graph of $y=f(x)$ is called a point of inflection if the concavity of the graph of $f$ changes from $\smile$ to $\frown$ or from $\frown$ to $\smile$ at $(d,f(d))$. The candidates for the points of inflection may be found by solving the equation $f^{\prime\prime}(x)=0$ as shown in the example below.

Theorem. [Concavity Test]

  1. If $f^{\prime\prime}(x)>0$ for all x in an open interval $I$, the graph of $f$ is concave up on $I$.
  2. If $f^{\prime\prime}(x)<0$ for all x in an open interval $I$, the graph of $f$ is concave down on $I$.

Theorem. [The Second Derivative Test] Suppose that $f'(c)=0$ i.e. $c$ is a critical point of $f$. Suppose that $f^{\prime\prime}$ is continuous near $c$.

  1. If $f^{\prime\prime}(c)>0$ then $f(c)$ is a local minimum.
  2. If $f^{\prime\prime}(c)<0$ then $f(c)$ is a local maximum.

Example. Let $f(x)=-x^4+2x^2+2$.

  1. Find and identify all local maximum and local minimum values of $f(x)$ using the Second Derivative Test.
  2. Find the intervals on which the graph of $f(x)$ is concave up or concave down. Find all points of inflection.

Solution. 1. First we find the critical points of $f(x)$ by solving the equation $f'(x)=0$:
$$f'(x)=-4x^3+4x=-4x(x^2-1)=-4x(x+1)(x-1)=0.$$ So $x=-1,0,1$ are critical points of $f(x)$ Next, $f^{\prime\prime}(x)=-12x^2+4$. Since $f^{\prime\prime}(0)=4>0$ and $f^{\prime\prime}(-1)=f^{\prime\prime}(1)=-8<0$, by the Second Derivative Test, $f(0)=2$ is a local minimum value and $f(-1)=f(1)=3$ is a local maximum value.

2. First we need to solve the equation $f”(x)=0$:
$$f^{\prime\prime}(x)=-12x^2+4=-12\left(x^2-\frac{1}{3}\right)=-12\left(x+\frac{1}{\sqrt{3}}\right)\left(x-\frac{1}{\sqrt{3}}\right)=0.$$ So $f^{\prime\prime}(x)=0$ at $x=\pm\displaystyle\frac{1}{\sqrt{3}}$. By using the test-point method we find the following table:
$$
\begin{array}{|c||c|c|c|c|c|}
\hline
x & x<-\frac{1}{\sqrt{3}} & -\frac{1}{\sqrt{3}} & -\frac{1}{\sqrt{3}}<x<\frac{1}{\sqrt{3}} & \frac{1}{\sqrt{3}} & x>\frac{1}{\sqrt{3}}\\
\hline
f^{\prime\prime}(x) & – & 0 & + & 0 & -\\
\hline
f(x) & \frown & f\left(-\frac{1}{\sqrt{3}}\right)=\frac{23}{9} & \smile & f\left(\frac{1}{\sqrt{3}}\right)=\frac{23}{9} & \frown\\
\hline
\end{array}
$$
The graph of $f(x)$ is concave down on the intervals $\left(-\infty,-\frac{1}{\sqrt{3}}\right)\cup\left(\frac{1}{\sqrt{3}},\infty\right)$ and is concave up on the interval $\left(-\frac{1}{\sqrt{3}},\frac{1}{\sqrt{3}}\right)$. The points of inflection are $\left(-\frac{1}{\sqrt{3}},\frac{23}{9}\right)$ and $\left(\frac{1}{\sqrt{3}},\frac{23}{9}\right)$.

The following figure confirms our findings from the above example.

The graph of f(x)=-x^4+2x^2+2 with points of inflection (in blue)

The graph of f(x)=-x^4+2x^2+2 with points of inflection (in blue)

The Substitution Rule

If given integration takes the form $\int f(g(x))g'(x)dx$ then it can be converted to a simpler integration that we may be able to evaluate by the substitution $u=g(x)$. In fact, the integration is given in terms of the new variable $u$ as
$$\int f(g(x))g'(x)dx=\int f(u)du.$$

Example. Evaluate $\int x\sqrt{1+x^2}dx$.

Solution. Let $u=1+x^2$. Then $du=2xdx$. So,
\begin{align*}
\int x\sqrt{1+x^2}dx&=\frac{1}{2}\int\sqrt{u}du\\
&=\frac{1}{3}u^{\frac{3}{2}}+C\\
&=\frac{1}{3}(1+x^2)^{\frac{3}{2}}+C,
\end{align*}
where $C$ is an arbitrary constant.

Example. Evaluate $\int\cos (7\theta+5)d\theta$.

Solution. Let $u=7\theta+5$. Then $du=7d\theta$. So,
\begin{align*}
\int\cos (7\theta+5)d\theta&=\frac{1}{7}\int\cos udu\\
&=\frac{1}{7}\sin u+C\\
&=\frac{1}{7}\sin(7\theta+5)+C,
\end{align*}
where $C$ is an arbitrary constant.

Example. Evaluate $\int x^2\sin(x^3)dx$.

Solution. Let $u=x^3$. Then $du=3x^2dx$. So,
\begin{align*}
\int x^2\sin(x^3)dx&=\frac{1}{3}\int \sin udu\\
&=-\frac{1}{3}\cos u+C\\
&=-\frac{1}{3}\cos(x^3)+C,
\end{align*}
where $C$ is an arbitrary constant.

Example. Integrals of $\sin^2x$ and $\cos^2x$.

  1. \begin{align*}\int\sin^2xdx&=\int\frac{1-\cos 2x}{2}dx\\&=\frac{x}{2}-\frac{\sin 2x}{4}+C\end{align*}
  2. \begin{align*}\int\cos^2xdx&=\int\frac{1+\cos 2x}{2}dx\\&=\frac{x}{2}+\frac{\sin 2x}{4}+C\end{align*}

How do we evaluate a definite integral of the form $\int_a^b f(g(x))g'(x)dx$? The following example shows you how.

Example. Evaluate $\int_{-1}^1 3x^2\sqrt{x^3+1}dx$.

Solution. First let us calculate the indefinite integral $\int 3x^2\sqrt{x^3+1}dx$. Let $u=x^3+1$. Then $du=3x^2dx$. So,
\begin{align*}
\int 3x^2\sqrt{x^3+1}dx&=\int\sqrt{u}du\\
&=\frac{2}{3}u^{\frac{3}{2}}+C\\
&=2(x^3+1)^{\frac{3}{2}}+C,
\end{align*}
where $C$ is an arbitrary constant. Now by Fundamental Theorem of Calculus,
\begin{align*}
\int_{-1}^1 3x^2\sqrt{x^3+1}dx&=\frac{2}{3}[(x^3+1)^{\frac{3}{2}}]_{-1}^1\\
&=\frac{4\sqrt{2}}{3}.
\end{align*}

But there is a better way to do this as shown in the following theorem. Its proof is straightforward.

Theorem. If $u’$ is continuous on $[a,b]$ and $f$ is continuous on the range of $u$, then
$$\int_a^bf(u(x))u'(x)dx=\int_{u(a)}^{u(b)}f(u)du.$$

Example. Let us replay the previous example using this theorem. Again let $u=x^3+1$. Then $du=3x^2dx$ and $u(-1)=0$, $u(1)=2$. Now, by the above theorem,
\begin{align*}
\int_{-1}^1 3x^2\sqrt{x^3+1}dx&=\int_0^2\sqrt{u}du\\
&=\frac{2}{3}[u^{\frac{3}{2}}]_0^2\\
&=\frac{4\sqrt{2}}{3}.
\end{align*}
I believe you will find this more simple than previous method.

Example. Evaluate $\int_{\frac{\pi}{4}}^{\frac{\pi}{2}}\cot\theta\csc^2\theta d\theta$.

Solution. Let $u=\cot\theta$. Then $u\left(\frac{\pi}{4}\right)=1$, $u\left(\frac{\pi}{2}\right)=0$, and $du=-\csc^2\theta d\theta$. Hence, \begin{align*}\int_{\frac{\pi}{4}}^{\frac{\pi}{2}}\cot\theta\csc^2\theta d\theta&=-\int_1^0 udu\\&=\frac{1}{2}\end{align*}

I will finish this lecture with the following nice properties.

Theorem. Let $f$ be a continuous function on $[-a,a]$.

(a) If $f$ is an even function, then $\int_{-a}^a f(x)dx=2\int_0^a f(x)dx$.

(b) If $f$ is an odd function, then $\int_{-a}^a f(x)dx=0$.

This can be easily understood from pictures using the symmetries of even and odd functions. But the theorem can be proved using substitution. I will leave it to you.

Example.  \begin{align*}\int_{-2}^2(x^4-4x^2+6)dx&=2\int_0^2(x^4-4x^2+6)dx\\&=2\left[\frac{x^5}{5}-\frac{4}{3}x^3+6x\right]_0^2\\&=\frac{232}{15}\end{align*}

The graph of y=x^4-4x^2+6 on [-2,2].