Submitted to HEJ
Manuscript no.: ANM-010201-A
Articles Frontpage previous next

Integration in closed form

Let us recall the so-called fundamental theorem of calculus.

Theorem 1.
Let $f$ be a continuous function on the interval $[a,b]$. For any $c\in [a,b]$ define $g(c)=\int_{a}^{c}f(x)\,dx$. Then $c\rightarrow g(c)$ is a differentiable function on $[a,b]$ and $g'(c)=f(c)$ for all $c \in [a,b]$.
This theorem is extremely useful. Because if we have to compute the value $\int_a^b f(x)\,dx$ and we are so fortunate to find a function $g$ such that $g'=f$, then

\begin{displaymath}\int_{a}^{b} f(x)\,dx=g(b)-g(a).\end{displaymath}

Such a function $g$ is called a primitive of $f$ (or anti-derivative of $f$, indefinite integral of $f$). $g$ is determined up to an additive constant. The usual notation for $g(x)$ is $\int f(x)\,dx$. Now we can compute immediately lots of integrals:

EXAMPLE 3.1.

$\scriptstyle>$ Int(3*x^2-5*x^7,x=3..5);


\begin{displaymath}
{\displaystyle \int _{3}^{5}} 3\,x^{2} - 5\,x^{7}\,dx
\end{displaymath}

In order to compute this integral we must find a function $g$ such that

$\scriptstyle>$ diff(g(x),x)=3*x^2-5*x^7;


\begin{displaymath}
{\frac {\partial }{\partial x}}\,{\rm g}(x)=3\,x^{2} - 5\,x^{7}
\end{displaymath}

One sees immediately that

$\scriptstyle>$ g:=x->x^3-5/8*x^8;


\begin{displaymath}
g := x\rightarrow x^{3} - {\displaystyle \frac {5}{8}} \,x^{8}
\end{displaymath}

is such a function. And so

$\scriptstyle>$ Int(3*x^2-5*x^7,x=3..5)=g(5)-g(3); g:='g':


\begin{displaymath}
{\displaystyle \int _{3}^{5}} 3\,x^{2} - 5\,x^{7}\,dx=-239942
\end{displaymath}

EXAMPLE 3.2.

$\scriptstyle>$ Int(2*x*exp(x^2),x=1..2);


\begin{displaymath}
{\displaystyle \int _{1}^{2}} 2\,x\,e^{(x^{2})}\,dx
\end{displaymath}

We must find a function $g$ such that

$\scriptstyle>$ diff(g(x),x)=2*x*exp(x^2);


\begin{displaymath}
{\frac {\partial }{\partial x}}\,{\rm g}(x)=2\,x\,e^{(x^{2})}
\end{displaymath}

Here we are ``fortunate'' again, because one sees at once that

$\scriptstyle>$ g:=x->exp(x^2);


\begin{displaymath}
g := x\rightarrow e^{(x^{2})}
\end{displaymath}

will do. So we find

$\scriptstyle>$ Int(x*exp(x^2),x=1..2)=g(2)-g(1);


\begin{displaymath}
{\displaystyle \int _{1}^{2}} x\,e^{(x^{2})}\,dx=e^{4} - e
\end{displaymath}

Apply evalf if you want a numerical result,

$\scriptstyle>$ evalf(g(2)-g(1)); g:='g':


\begin{displaymath}
51.87986820
\end{displaymath}

EXAMPLE 3.3.

$\scriptstyle>$ Int(ln(x)^2,x);


\begin{displaymath}
{\displaystyle \int } {\rm ln}(x)^{2}\,dx
\end{displaymath}

Now we should find $g$ such that

$\scriptstyle>$ diff(g(x),x)=ln(x)^2;


\begin{displaymath}
{\frac {\partial }{\partial x}}\,{\rm g}(x)={\rm ln}(x)^{2}
\end{displaymath}

This is a bit harder. However, we can proceed as follows. We can find a $g$ which is almost OK:

$\scriptstyle>$ g:=x->x*ln(x)^2;


\begin{displaymath}
g := x\rightarrow x\,{\rm ln}(x)^{2}
\end{displaymath}

Then

$\scriptstyle>$ diff(g(x),x);


\begin{displaymath}
{\rm ln}(x)^{2} + 2\,{\rm ln}(x)
\end{displaymath}

In this expression we should get rid of the term $2 {\rm ln}(x)$. So if we can find a function $h$ satisfying $h'(x) = 2 {\rm ln}(x)$, we are done, because then we can replace $g$ by $g-h$. So we are reduced to a similar, but simpler problem. A candidate for $h$ is given by $h(x) = 2 x {\rm ln}(x)$. Then $h'(x) = 2 {\rm ln}(x) + 2$. Now we must get rid of the term $2$. This is easy: replace $h(x)$ by $h(x)-2x$:

$\scriptstyle>$ h:=x->2*x*ln(x)-2*x;


\begin{displaymath}
h := x\rightarrow 2\,x\,{\rm ln}(x) - 2\,x
\end{displaymath}

$\scriptstyle>$ diff(h(x),x);


\begin{displaymath}
2\,{\rm ln}(x)
\end{displaymath}

This is what we were looking for. Hence our $g$ becomes

$\scriptstyle>$ g:=x->(x*ln(x)^2-(2*x*ln(x)-2*x));


\begin{displaymath}
g := x\rightarrow x\,{\rm ln}(x)^{2} - 2\,x\,{\rm ln}(x) + 2\,x
\end{displaymath}

Check:

$\scriptstyle>$ diff(g(x),x);


\begin{displaymath}
{\rm ln}(x)^{2}
\end{displaymath}

The trick applied twice in the latter example is the so-called integration by parts which can be expressed by the following formula

\begin{displaymath}\int f(x)\,({\frac {\partial }{\partial x}}\,g(x))\,
dx=f(x)*g(x)-\int ({\frac {\partial }{\partial x}}\,f(x))\,g(x)\,
dx.\end{displaymath}

This is valid for continuously differentiable functions $f$ and $g$. The proof is by differentiation.

Exercise 3.1.

Compute the primitives of the following functions. Check the results by differentiating:

  • $\int \frac {1}{(x + 1)^{2}}\,dx$
  • $\int x\,{\rm sin}(x)\,dx$
  • $\int x^{2}\,{\rm cos}(x)\,dx$

Exercise 3.2. (cf. EXAMPLE 1.4.)

Compute $\int _{1}^{3}x\,{\rm sin}(x)^{2}\,dx$.

Hint: use the relation ${\rm cos}(2 x) = 1 - 2 {\rm sin}(x)^2$.

EXAMPLE 3.4.

$\scriptstyle>$ Int(1/(x*ln(x)),x);


\begin{displaymath}
{\displaystyle \int } {\displaystyle \frac {1}{x\,{\rm ln}(x)}}
\,dx
\end{displaymath}

(restricted to $x>1$). Here integration by parts seems powerless. In textbooks you may find:

\begin{displaymath}\int \frac {1}{x\,{\rm ln}(x)}\,dx = \int \frac {1}{{\rm ln}(x)}\,d{\rm ln}(x)
= {\rm ln}({\rm ln}(x)).\end{displaymath}

The first relation makes sense when one applies the thumb rule: $d{\rm g}(x)={\rm g}'(x) dx$; the second one by putting ln$(x)=y$, namely

\begin{displaymath}\int \frac {1}{y}\,dy = {\rm ln}(y)\end{displaymath}

and substituting by $y={\rm ln}(x)$. This juggling can be turned into a precise theorem:
Theorem 2.
(``Substitution rule'') Let $g$ be a continuously differentiable function on $[a,b]$ and $f$ a continuous function defined for all $g(c)$ where $c\in [a,b]$. Then

\begin{displaymath}\int _{g(a)}^{g(y)}f(x)\,dx= \int _{a}^{y}f(g(y))\,({\frac {\partial }{\partial y}}\,g(y))\,dy\end{displaymath}

for all $y \in [a,b]$.

The proof of this useful theorem is very simple: differentiate both sides of the formula with respect to $y$. Then one gets an equality. So both members differ by a constant (i.e. independent of $y$). Finally, substitute $y=a$. Often the substitution rule is written in a less careful way:

\begin{displaymath}\int f(x)\,dx = \int f(g(y))\,({\frac {\partial }{\partial y}}\,g(y))\,dy.\end{displaymath}

Example 3.4. now goes as follows: let

\begin{displaymath}f(x)=1/(x\ {\rm ln}(x))\end{displaymath}

and

\begin{displaymath}g(y) = {\rm exp}(y).\end{displaymath}

Then

\begin{displaymath}f(g(y))=1/(y\ {\rm exp}(y))\end{displaymath}

and

\begin{displaymath}g'(y)={\rm exp}(y).\end{displaymath}

Hence we find

\begin{displaymath}\int f(x)\,dx = \int \frac {1}{y}\,dy = {\rm ln}(y)={\rm ln}({\rm ln}(x)).\end{displaymath}

EXAMPLE 3.5.

$\scriptstyle>$ Int(1/sqrt(1-x^2),x);


\begin{displaymath}
{\displaystyle \int } {\displaystyle \frac {1}{\sqrt{1 - x^{2}}}
} \,dx
\end{displaymath}

Here the substitution $x=\sin(y)$ is helpful. To be a bit more precise the function ${\rm f}(x)=\frac {1}{\sqrt{1 - x^{2}}}$ is defined and it is greater than $0$ for $-1<x<1$ and $g(y)=\sin(y)$ is restricted to $-\pi<y<\pi$. Then

\begin{displaymath}f(g(y))= \frac {1}{\sqrt{1 - {\rm sin}(y)^{2}}} = \frac {1}{\sqrt{{\rm cos}(y)^{2}}} = \frac {1}{{\rm cos}(y)},\end{displaymath}

because $\cos(y)>0$ for the values of $y$ under consideration. Since $g'(y)=\cos(y)$ the substitution formula yields $\int f(x)\,dx=y$. Obviously, we want $y$ as a function of $x$. This is easy: $y\rightarrow x$ is the inverse function arcsin of sin. Hence

\begin{displaymath}\int \frac {1}{\sqrt{1 - x^{2}}}\,dx = \arcsin(x).\end{displaymath}

Exercise 3.3.

Compute $\int \frac {1}{1 + {\rm sin}(x)}\,dx$ and check your result by differentiating.
Hint: substitute $x = 2 \arctan(t)$. First show that

  • $\sin(x) = \frac {2\,t}{1 + t^{2}},$
  • $\cos(x) = \frac {1 - t^{2}}{1 + t^{2}},$
  • $\frac {\partial }{\partial t}\,2\,{\rm arctan}(t)=\frac {2}{1 + t^{2}}$.
The substitution rule now shows that our integral is replaced by $\int g(t)\,dt$ where $g$ is a rational function of $t$.

Remark: This method works for any integral of the form $\int f({\rm sin}(x), \,{\rm cos}(x))\,dx$, where $f$ is rational function of two variables.

Exercise 3.4.

Compute $\int \frac {1}{{\rm sin}(x) + {\rm cos}(x)}\,dx$.

Submitted to HEJ
Manuscript no.: ANM-010201-A
Articles Frontpage previous next