6 Week 6

We continue our study of integration by looking at two very important techniques to calculate integrals: integration by substitution and integration by parts.

6.1 Integration by Substitution

So far we have learnt to integrate “sums of powers” functions such as \(x^2 + 2x + 3\) and standard integrals such as \(\sin(x), e^x\) etc. A useful method for more complicated functions is integration by substitution. Consider \[\begin{equation} \int x\sqrt{x^2+1} \,\mathrm{d}x. \tag{6.1} \end{equation}\] We cannot integrate this directly. If we try making a binomial expansion of the part under the square root sign and then multiplying by \(x\), we will only get an approximate answer. However, we can make a “substitution”:

Let \(u = x^2+ 1\). Then (6.1) becomes \[\begin{equation} \int x\sqrt{u}\,\mathrm{d}x=\int xu^{1/2}\,\mathrm{d}x. \tag{6.2} \end{equation}\] To get further, we need to replace all the “\(x\)” in the integral by “\(u\)” somehow; especially \(\mathrm{d}x\) by \(\mathrm{d}u\).

Here is where Leibniz notation for the derivative is “telling”. If \(u = x^2+ 1\), then \(\mathrm{d}u/\mathrm{d}x = 2x\), “and so” \(\mathrm{d}u = 2x\,\mathrm{d}x\), or \(\mathrm{d}u/2 = x\,\mathrm{d}x\).

If we use this in (6.2), we get \[\begin{equation} \int u^{1/2}x\,\mathrm{d}x = \int\frac12u^{1/2}\,\mathrm{d}u. \tag{6.3} \end{equation}\] (Note: It is convenient to work with \(\mathrm{d}u\) and \(\mathrm{d}x\) like above, and you should continue to do so; however the fact that (6.3) works is really a Theorem.)

Now our function is expressed entirely in terms of \(u\) and we can integrate with respect to \(u\) to give

\[ \int\frac12u^{1/2}\mathrm{d}u = \frac 12\cdot\frac23u^{3/2}+c = \frac13u^{3/2}+c. \]

\[ \int\frac12u^{1/2}\mathrm{d}u = \phantom{\frac 12\cdot\frac23u^{3/2}+c = \frac13u^{3/2}+c.} \]

Finally we can substitute for \(u\) to give the answer in terms of \(x\)

\[ \frac 13u^{3/2}+c = \frac13(x^2+1)^{3/2}+c. \]

Example 6.1 Evaluate \(\displaystyle\int\sin^2(x)\cos(x)\mathrm{d}x\).

Solution. Let \(u = \sin(x)\) so that \(\mathrm{d}u/\mathrm{d}x = \cos(x)\). Then \(\mathrm{d}x = \mathrm{d}u/\cos(x)\) and so \[ \int\sin^2(x)\cos(x)\mathrm{d}x = \int u^2\mathrm{d}u = \frac 13u^3+c. \] Hence \[ \int\sin^2(x)\cos(x)\mathrm{d}x = \frac 13\sin^3(x) + c. \]

This “by substitution” method is helpful in many cases. The “pattern” is this: usually we are looking for a part of the integrated expression such that the derivative of this part of the expression appears as a factor in the expression.

One way this can happen is that the numerator in a fraction is the derivative of the denominator, as in the following Example.

Example 6.2 Find \[ \int\frac{3x^2}{x^3-4}\mathrm{d}x. \]

Solution. Let \(u = x^3-4\) so that \(\mathrm{d}u = 3x^2\mathrm{d}x\). Then \[ \int\frac{3x^2}{x^3-4}\mathrm{d}x = \int \frac{\mathrm{d}u}{u} = \ln|u|+c = \ln|x^3-4|+c. \]

(For integrals of this class of examples, the result is always the natural log of the denominator.)

6.1.1 Trigonometric integrals and substitutions

Often a difficult integral may be made simpler by the use of trig identities. Knowing which identities will help when is a matter of practice.

Example 6.3 Find \[ \int\sin^2(x) \mathrm{d}x. \]

Solution. Using the trig identity for \(\cos(2x)\) we see that \(\sin^2(x) = (1-\cos(2x))/2\). So \[ \int\sin^2(x) \mathrm{d}x = \int\frac 12-\int\frac{\cos(2x)}{2} = \frac x2-\frac{\sin(2x)}{4}+c. \]

Example 6.4 Find \[ \int\frac{\mathrm{d}x}{\sqrt{a^2-x^2}}. \]

Solution. Let \(x = a\sin(\theta)\) then \(\mathrm{d}x = a\cos(\theta)d\theta\). So \(x^2 = a^2\sin^2(\theta)\) and \(\theta = \sin^{-1}(x/a)\). Hence \[ \int\frac{\mathrm{d}x}{\sqrt{a^2-x^2}} = \int\frac{a\cos(\theta)d\theta}{\sqrt{a^2-a^2\sin^2(\theta)}} = \int\frac{a\cos(\theta)d\theta}{a\sqrt{1-\sin^2(\theta)}} = \int\frac{\cos(\theta)d\theta}{\cos(\theta)} = \int d\theta = \theta + c. \] Hence \[ \int\frac{\mathrm{d}x}{\sqrt{a^2-x^2}} = \sin^{-1}\left(\frac xa\right) + c. \]

6.2 Integration by Parts

To integrate a product of two terms where one part is the derivative of the other, we have seen that integration by substitution may be used. When we have a product where one half is not the derivative of the other, integration by parts may be useful. The rule for integration by parts is derived from the rule for differentiating a product.

If \(y = uv\), where \(u\) and \(v\) are both functions of \(x\) then, \[\begin{equation} \frac{\mathrm{d}y}{\mathrm{d}x} = u\cdot\frac{\mathrm{d}v}{\mathrm{d}x} + v\cdot\frac{\mathrm{d}u}{\mathrm{d}x} \tag{6.4} \end{equation}\] If we integrate both sides of equation (6.4) with respect to \(x\) then we have \[\begin{equation} \int\frac{\mathrm{d}y}{\mathrm{d}x}\,\mathrm{d}x = \int u\cdot\frac{\mathrm{d}v}{\mathrm{d}x}\,\mathrm{d}x + \int v\cdot\frac{\mathrm{d}u}{\mathrm{d}x}\,\mathrm{d}x \tag{6.5} \end{equation}\] Now the integral of the left-hand side is given by \[\begin{equation} \int\frac{\mathrm{d}y}{\mathrm{d}x}\,\mathrm{d}x = y \tag{6.6} \end{equation}\] and \(y = uv\) so \[\begin{equation} uv =\int u\cdot\frac{\mathrm{d}v}{\mathrm{d}x}\,\mathrm{d}x +\int v\cdot\frac{\mathrm{d}u}{\mathrm{d}x}\,\mathrm{d}x \tag{6.7} \end{equation}\] and therefore, rearranging gives us \[\begin{equation} \int u\cdot \frac{\mathrm{d}v}{\mathrm{d}x}\,\mathrm{d}x = uv -\int v\cdot\frac{\mathrm{d}u}{\mathrm{d}x}\,\mathrm{d}x \tag{6.8} \end{equation}\] Equation (6.8) is the formula for integration by parts and can be used to integrate some types of product.

Example 6.5 Find \(\displaystyle\int x^3\ln(x)\mathrm{d}x\)

Solution. This is a product but one half is not the derivative of the other, so integration by parts must be used.

First choose one part of the product and let it be \(u\), then the other half is \(\mathrm{d}v/\mathrm{d}x\).

So, let \(u = \ln(x)\) and \(\mathrm{d}v/\mathrm{d}x = x^3\). Then \(\mathrm{d}u/\mathrm{d}x = 1/x\) and \(v=\displaystyle\int x^3\mathrm{d}x = x^4/4\).

Then substituting for \(u, \mathrm{d}u/\mathrm{d}x, v\) and \(\mathrm{d}v/\mathrm{d}x\) in equation (6.8) we get \[\begin{align*} \int u\frac{\mathrm{d}v}{\mathrm{d}x}\mathrm{d}x& = uv-\int v\frac{\mathrm{d}u}{\mathrm{d}x}\mathrm{d}x\\ \int x^3\ln(x)\mathrm{d}x& = \ln(x)\times \frac{x^4}{4} - \int\left(\frac{x^4}{4}\times\frac{1}{x}\right)\mathrm{d}x\\ &=\left(\frac{x^4}{4}\ln(x)\right)-\int\frac{x^3}{4}\mathrm{d}x = \left(\frac{x^4}{4}\ln(x)\right) - \left(\frac{x^4}{16}\right)+c\\ \int x^3\ln(x)\mathrm{d}x& = \frac{x^4}{4}\left(\ln(x)-\frac14\right)+c. \end{align*}\]

By choosing the terms we did for \(u\) and \(\mathrm{d}v/\mathrm{d}x\), the formula helped us simplify what had to be integrated. We could have chosen \(u\) as \(x^3\) and \(\mathrm{d}v/\mathrm{d}x\) as \(\ln(x)\), but if we had, we would have found that after substituting our terms into the formula, the integral was no more simple that before.

Knowing which term to choose for which part of the formula is on the whole a question of practice.

Example 6.6 Find \(\displaystyle\int xe^{-x}\mathrm{d}x\)

Solution. Let \(u = x\) and \(\mathrm{d}v/\mathrm{d}x=e^{-x}\) so that \(\mathrm{d}u/\mathrm{d}x = 1\) and \(v=\displaystyle\int e^{-x}\mathrm{d}x = -e^{-x}\). So using integration by parts \[\begin{align*} \int u\frac{\mathrm{d}v}{\mathrm{d}x}\mathrm{d}x& = uv-\int v\frac{\mathrm{d}u}{\mathrm{d}x}\mathrm{d}x\\ \int xe^{-x}\mathrm{d}x&=x(-e^{-x})-\int-e^{-x}\mathrm{d}x\\ &=-xe^{-x}+\int e^{-x}\mathrm{d}x\\ &=-xe^{-x}-e^{-x}+c. \end{align*}\]

Example 6.7 Find \(\displaystyle\int \ln(x)\mathrm{d}x\)

Solution. At first sight this doesn’t look as if integration by parts will be useful as it doesn’t seem to involve a product. However we can think of it as \(\displaystyle\int 1\times\ln(x)\mathrm{d}x\).

Let \(u = \ln(x)\) and \(\mathrm{d}v/\mathrm{d}x = 1\) then \(\mathrm{d}u/\mathrm{d}x = 1/x\) and \(v = x\). hence using integration by parts we see that \[\begin{align*} \int u\frac{\mathrm{d}v}{\mathrm{d}x}\mathrm{d}x& = uv-\int v\frac{\mathrm{d}u}{\mathrm{d}x}\mathrm{d}x\\ \int\ln(x)\mathrm{d}x&=x\ln(x)-\int x\times\frac 1x \mathrm{d}x\\ &=x\ln(x)-\int 1\mathrm{d}x\\ &=x\ln(x)-x + c. \end{align*}\]

Sometimes it is necessary to apply the formula twice (or more).

Example 6.8 Find \(\displaystyle\int x^2\sin(2x)\mathrm{d}x\)

Solution. Let \(u = x^2\) and let \(\mathrm{d}v/\mathrm{d}x = \sin(2x)\). Then \(\mathrm{d}u/\mathrm{d}x = 2x\) and \(v = \displaystyle\int \sin(2x)\mathrm{d}x = -\cos(2x)/2\).

Using integration by parts. \[\begin{align} \int u\frac{\mathrm{d}v}{\mathrm{d}x}\mathrm{d}x& = uv-\int v\frac{\mathrm{d}u}{\mathrm{d}x}\mathrm{d}x\\ \int x^2\sin(2x)\mathrm{d}x&=\left(x^2\times\frac{-\cos(2x)}{2}\right)-\int\left(\frac{-\cos(2x)}{2}\times2x\right)\mathrm{d}x\\ &=\left(\frac{-x^2\cos(2x)}{2}\right)+\int x\cos(2x)\mathrm{d}x \tag{6.9} \end{align}\]

We still have to integrate the term under the integral sign on the right-hand side to get the answer, and that term is a product with neither part being the derivative of the other, so integration by parts should help again. Considering just that term:-

We have \(\displaystyle\int x\cos(2x)\mathrm{d}x\). Let \(u=x\) and \(\mathrm{d}v/\mathrm{d}x = \cos(2x)\). Then \(\mathrm{d}u/\mathrm{d}x = 1\) and \(v=\sin(2x)/2\). \[\begin{align} \int x\cos(2x)\mathrm{d}x &= \left(x\times\frac{\sin(2x)}{2}\right) - \int\frac{\sin(2x)}{2}\times1\mathrm{d}x\\ &= \left(\frac{x\sin(2x)}2\right)+\left(\frac{\cos(2x)}4\right). \tag{6.10} \end{align}\] Now substituting (6.10) into (6.9) we can obtain the answer to the original integral \[ \int x^2\sin(2x)\mathrm{d}x = -\frac{x^2\cos(2x)}2+\frac{x\sin(2x)}2+\frac{\cos(2x)}4 + c. \]