# Integration by Parts Done Right

Integration by parts is a technique for evaluating indefinite integral whose integrand is a product of two functions. It is based on the fact that

If two functions $u(x), v(x)$ are differentiable on an interval $I$ and $\int u(x)v'(x)\;dx$ exists, then $\int u'(x) v(x)\;dx = u(x)\cdot v(x)-\int u(x)\cdot v'(x)\;dx\quad\quad\quad(1)$

It is not difficult to see that (1) is true:

Provide $\int u(x)\cdot v(x)'\;dx$ exist, let $u = u(x), v = v(x)$

and $R = u\cdot v - \int u\cdot v'\; dx$.

By the rules of differentiation (see “Some rules of differentiation”), $R' = (u\cdot v)' - (\int u \cdot v'\;dx)'= u'\cdot v +u\cdot v' - u\cdot v' = u'\cdot v$.

i.e., $R = \int u'\cdot v\;dx$

or, $\int u'\cdot v\;dx= u\cdot v - \int u\cdot v'\;dx$

The key to apply this technique successfully is to choose proper $u, v$ so that the integrand in the original integral can be expressed as $u'\cdot v$ and, $\int u\cdot v'\;dx$ is easier to evaluate than $\int u'\cdot v\;dx$.

To evaluate $\int \log(x)\;dx$, we let $u = x, v=\log(x)$ to get $\int \log(x)\;dx = \int 1\cdot \log(x)\;dx$ $= \int (x)' \cdot \log(x) \;dx$ $= x\cdot\log(x) - \int x\cdot (\log(x))'\;dx$ $= x\log(x) - \int x \cdot \frac{1}{x}\;dx$ $= x\log(x) - \int 1\;dx$ $= x\log(x) -x$

In fact, for $n \ge 0$, $\int x^n \log(x)\;dx = \int (\frac{x^{n+1}}{n+1})'\log(x)\;dx$ $= \frac{x^{n+1}}{n+1}\log(x)-\int \frac{x^{n+1}}{n+1}(\log(x))'\;dx$ $= \frac{x^{n+1}}{n+1}\log(x)-\int\frac{x^{n+1}}{n+1}\cdot \frac{1}{x}\;dx$ $= \frac{x^{n+1}}{n+1}\log(x)-\frac{1}{n+1}\int x^n\;dx$ $= \frac{x^{n+1}}{n+1}\log(x)-\frac{x^{n+1}}{(n+1)^2}$.

The following example of integrating a rather ordinary-looking expression offers unexpected difficulties and surprises: $\int \sqrt{1-x^2}\;dx= \int x' \sqrt{1-x^2}\;dx$ $= x\sqrt{1-x^2}-\int x(\sqrt{1-x^2})'\;dx$ $= x\sqrt{1-x^2}- \int x\cdot \frac{1}{2}\cdot\frac{-2x}{\sqrt{1-x^2}}\;dx$ $= x\sqrt{1-x^2} +\int \frac{x^2}{\sqrt{1-x^2}}\;dx$ $= x\sqrt{1-x^2} + \int \frac{1-1+x^2}{\sqrt{1-x^2}}\;dx$ $= x\sqrt{1-x^2} + \int \frac{1}{\sqrt{1-x^2}}\;dx -\int \frac{1-x^2}{\sqrt{1-x^2}}\;dx$ $\overset{\frac{1-x^2}{\sqrt{1-x^2}}=\sqrt{1-x^2}}{= }x\sqrt{1-x^2}+\arcsin(x) - \boxed{\int\sqrt{1-x^2}\;dx}$

Notice the original integral (boxed) appears on the right of the “=” sign. However, this is not an indication that we have reached a dead end. To the contrary, after it is combined with the left side, we have $2\int\sqrt{1-x^2}\;dx = x\sqrt{1-x^2} + \arcsin(x)$

and so, $\int \sqrt{1-x^2}\;dx = \frac{1}{2}(x\sqrt{1-x^2} + \arcsin(x))$

Sometimes, successive integration by parts is required to complete the integration. For example, $\int e^x \cos(x)\;dx = \int (e^x)' \cos(x)\;dx$ $= e^x \cos(x)-\int e^x (\cos(x)' \; dx$ $= e^x \cos(x) +\int e^x \sin(x)\; dx$ $= e^x\cos(x)+\int (e^x)' \sin(x)\;dx$ $= e^x \cos(x) + (e^x \sin(x)-\int e^x (\sin(x))' \;dx)$ $=e^x \cos(x) + e^x \sin(x) - \boxed{\int e^x \cos(x)\;dx}$.

Hence, $2\int e^x\cos(x)\;dx = e^x\cos(x) + e^x\sin(x)$

i.e., $\int e^x\cos(x)\;dx = \frac{e^x}{2}(\cos(x)+\sin(x))$

Exercise-1 Evaluate

1) $\int \log^2(x)\;dx$

2) $\int x\log(\frac{1-x}{1+x})\;dx$

3) $\int \log(x+\sqrt{1+x^2})\; dx$

While Maxima choked:

Mathematica came through:

4) $\int \frac{x}{\sqrt{1+2x}}\;dx$

5) $\int x\cdot \arctan(x)\;dx$

6) $\int \frac{x^2}{(1+x^2)^2}\;dx$

7) $\int \frac{x^2\cdot e^x}{(x+2)^2}\;dx$

Both Maxima and Mathematica came though:

# In the spirit of Archimedes’ method of exhaustion

Shown in Fig. 1 is a pile of $n$ cylinders that approximates one half of a sphere.

Fig. 1

From Fig. 1, we see $r_i^2 = r^2-h_i^2$.

If $\Delta V_i$ denotes the volume of $i^{th}$ cylinder in the pile, then $\Delta V_i = \pi \cdot r_i^2 \cdot \frac{r}{n}$ $= \pi (r^2-h_i^2) \cdot \frac{r}{n}$ $= \pi (r^2-(i\cdot\frac{r}{n})^2)\cdot \frac{r}{n}$ $= \frac{\pi r^3}{n} (1-(\frac{i}{n})^2)$.

Let $V_{*}=\sum\limits_{i=1}^{n}\Delta V_i$,

we have $V_{*}= \sum\limits_{i=1}^{n}\frac{\pi r^3}{n} (1-(\frac{i}{n})^2)$ $= \frac{\pi r^3}{n}\sum\limits_{i=1}^{n}(1-(\frac{i}{n})^2)$ $= \frac{\pi r^3}{n}(\sum\limits_{i=1}^{n}1-\sum\limits_{i=1}^{n}(\frac{i}{n})^2)$ $= \frac{\pi r^3}{n}(n-\frac{1}{n^2}\sum\limits_{i=1}^{n}i^2)$ $= \frac{\pi r^3}{n}(n-\frac{n(n+1)(2n+1)}{6n^2})\quad\quad\quad($see “Little Bird and a Recursive Generator $)$ $= \pi r^3(1-\frac{(n+1)(2n+1)}{6n^2})$ $= \pi r^3(1-\frac{2n^2+3n+1}{6n^2})$ $= \pi r^3(1-\frac{2+\frac{3}{n}+\frac{1}{n^2}}{6})$.

As $n \rightarrow \infty,$ $V_* \rightarrow \pi r^3 (1-\frac{1}{3}) = \frac{2}{3}\pi r^3=V_{\frac{1}{2}sphere}.$

Therefore, $V_{sphere}= 2\cdot V_{\frac{1}{2}sphere}$ gives $V_{sphere} = \frac{4}{3}\pi r^3\quad\quad\quad(1-1)$

Similarly, we approximate a cone

by a stack of $n$ cylinders:

Fig. 2

Since $h_i = i\cdot\frac{h}{n}\quad\quad\quad(2-1)$

and $\frac{h_i}{h} = \frac{r_i}{r}$,

we have $r_i = \frac{r\cdot h_i}{h}\overset{(2-1)}{=}\frac{r}{h}\cdot i\frac{h}{n}=\frac{r\cdot i}{n}.\quad\quad\quad(2-2)$

If $\Delta V_i$ denotes the $i^{th}$ cylinder, then $\Delta V_i = \pi\cdot r_i^2\cdot\frac{h}{n}\overset{(2-2)}{=}\frac{\pi r^2 i^2 h}{n^3}$.

Let $V_* = \sum\limits_{i=1}^{n}\Delta V_i,$

we have $V_*= \frac{\pi r^2 h}{n^3}\sum\limits_{i=1}^{n} i^2$ $= \frac{\pi r h}{n^3} \cdot \frac{2n^3+3n^2+n}{6}$ $= \pi r^2 h (\frac{1}{3} + \frac{1}{2n} + \frac{1}{6n^2})$.

Since as $n \rightarrow \infty$, $V_*\rightarrow \frac{1}{3}\pi r^2 h$, we have $V_{cone} = \frac{1}{3}\pi r^2 h.\quad\quad\quad(2-3)$

We now derive the formula for a sphere’s surface area.

Let us approximate a sphere by many cones:

Fig. 3

From Fig. 3, we see that as $\Delta A_i \rightarrow 0$, $h \rightarrow r, \;\sum\limits_{i}\Delta A_i \rightarrow A_{sphere}$.

Consequently, $\sum\limits_{i} \Delta V_i \overset{(2-3)}{=} \sum\limits_{i} \frac{1}{3}\Delta A_i h = \frac{1}{3}h \sum\limits_{i}\Delta A_i \rightarrow \frac{1}{3}rA_{sphere}$

and, $\sum\limits_{i} \Delta V_i \rightarrow V_{sphere} \overset{(1-1)}{=} \frac{4}{3}\pi r^3$.

It follows that $\frac{1}{3}r A_{sphere} = \frac{4}{3}\pi r^3.$

Hence, $A_{sphere} = 4 \pi r^2.$