# Integration by parts

## The Integration by parts formula

• Just as the Substitution rule is the method of integration corresponding to the Chain rule, Integration by parts is the method of integration corresponding to the Product rule.
• Let $$f$$ and $$g$$ be differentiable functions.
• Then the product rule says $(f(x)g(x))'=f'(x)g(x)+f(x)g'(x).$
• This can be rearranged as $f(x)g'(x)=(f(x)g(x))'-f'(x)g(x).$
• Taking antiderivatives, we get $\int f(x)g'(x)\,\mathrm dx=\int (f(x)g(x))'\,\mathrm dx-\int f'(x)g(x)\,\mathrm dx.$
• By definition, an antiderivative of the derivative is the original function, therefore we get a first formulation of Integration by parts: $\int f(x)g'(x)\,\mathrm dx=f(x)g(x)-\int f'(x)g(x)\,\mathrm dx.$
• There is another formulation, which might be easier to remember.
• Let $$u=f(x)$$ and $$v=g(x)$$.
• Then via the Substitution rule, the formula can be changed to $\int u\,\mathrm dv=uv-\int v\,\mathrm du.$

## Differentials

• When working with Integration by parts, it is potentially easier to work with differentials then with derivatives.
• A differential is an expression like $$\mathrm dv$$. You can think of it as the Mathematical object you get when you multiply $$g'(x)=\frac{\mathrm dv}{\mathrm dx}$$ with $$\mathrm dx$$.
• In fact, that is all you need to know about differentials:
• Notation. Let $$g$$ be a differentiable function, and let $$v=g(x)$$. Then the differential of $$v=g(x)$$ is $\mathrm dv=g'(x)\mathrm dx.$
• Examples.
• Let $$v=g(x)=x^2+2x-3$$.
• Then we have $$\mathrm dv=g'(x)\mathrm dx=(2x+2)\mathrm dx$$.
• Let $$v=g(x)=\sin3x$$.
• Then we have $$\mathrm dv=3\cos3x\mathrm dx$$.
• Let $$v=g(x)=e^{-2x}$$.
• Then we have $$\mathrm dv=-2e^{-2x}\mathrm dx$$.

## Integration by parts with a polynomial.

• 7.1.3. $$\int x\cos5x\,\mathrm dx$$.
• To use the Integration by parts formula, we need to break up the expression $$x\cos 5x\,\mathrm dx$$ into a $$u$$ part and a $$\mathrm dv$$ part.
• Note that the RHS (right-hand side) of the formula also has an indefinite integral.
• Therefore, when you separate the expression $$x\cos5x\,\mathrm dx$$ into a $$u$$ and a $$\mathrm dv$$, what you need to think about is that you want to do this in a way that $$\int v\,\mathrm du$$ is simpler than $$\int u\,\mathrm dv$$.
• The choice is not always obvious, and you have to be prepared to try out multiple choices before you get a solution.
• Here, let's take $$u=x$$ and $$\mathrm dv=\cos5x\mathrm dx$$.
• Now we have to say what $$\mathrm du$$ and $$v$$ are.
• Via the formula, we have $$\mathrm du=f'(x)\mathrm dx=1\cdot\mathrm dx=\mathrm dx$$.
• If $$\mathrm dv=\cos 5x\mathrm dx$$, then $$v=g(x)$$ is an antiderivative of $$g'(x)=\cos5x$$. We can choose $$v=\frac15\sin 5x$$.

## Integration by parts with a polynomial.

• Now we are ready to apply the formula: $\int x\cos5x\,\mathrm dx=\int u\,\mathrm dv=uv-\int v\,\mathrm du=x\frac15\sin5x-\int\frac15\sin5x\,\mathrm dx.$
• Why the choices $$u=x$$ and $$\mathrm dv=\cos5x\mathrm dx$$ are right is that we know how to calculate the indefinite integral on the right: $\int v\,\mathrm du=\int\frac15\sin5x\,\mathrm dx=-\frac{1}{25}\cos5x+C.$
• This gives the final answer: $\int x\cos5x\,\mathrm dx=\frac15x\sin5x-\int\frac15\sin5x\,\mathrm dx=\frac15x\sin5x+\frac{1}{25}\cos5x+C.$

## Integration by parts with a polynomial.

• 7.1.6. $$\int(x-1)\sin\pi x\,\mathrm dx$$.
• Once again, we have to separate the expression $$u\,\mathrm dv=(x-1)\sin\pi x$$.
• Let's take $$u=x-1$$ and $$\mathrm dv=\sin\pi x\,\mathrm dx$$.
• Then we get $$\mathrm du=\mathrm dx$$ and $$v=-\frac{1}{\pi}\cos\pi x$$.
• Therefore, Interation by parts gives $\int(x-1)\sin\pi x\,\mathrm dx=-(x-1)\frac{1}{\pi}\cos\pi x+\int\frac{1}{\pi}\cos\pi x\,\mathrm dx=\frac{1-x}{\pi}\cos\pi x+\frac{1}{\pi^2}\sin\pi x+C.$

## Integration by parts with a polynomial.

• 7.1.7. $$\int(x^2+2x)\cos x\,\mathrm dx$$.
• Let's take $$u=x^2+2x$$ and $$\mathrm dv=\cos x\mathrm dx$$.
• Then we get $$\mathrm du=(2x+2)\mathrm dx$$ and $$v=\sin x$$.
• Thus, Integration by parts gives $\int(x^2+2x)\cos x\,\mathrm dx=(x^2+2x)\sin x-\int(2x+2)\sin x\,\mathrm dx.$
• Here, the new thing is that in order to calculate $$\int(2x+2)\sin x\,\mathrm dx$$, we need to apply integration by parts again.
• For that, let $$u=2x+2$$ and $$\mathrm dv=\sin x\mathrm dx$$.
• Then we get $$\mathrm du=2\mathrm dx$$ and $$v=-\cos x$$.
• That in turn gives $\int(2x+2)\sin x\,\mathrm dx=-(2x+2)\cos x+\int2\cos x\mathrm dx=-(2x+2)\cos x+2\sin x+C.$
• With this, we can finish the original calculation: $\int(x^2+2x)\cos x\,\mathrm dx=(x^2+2x)\sin x-\int(2x+2)\sin x\,\mathrm dx=(x^2+2x)\sin x+(2x+2)\cos x-2\sin x+C.$
• From these, you can see that if the integrand is a product of a polynomial and some other function you know how to integrate, then you can make $$u$$ the polynomial, and $$\mathrm dv$$ given by that other function.

## Integration by parts for definite integrals

• Let $$f$$ and $$g$$ be functions with domain $$[a,b]$$, which are differentiable on $$(a,b)$$.
• Let's now take definite integrals over $$[a,b]$$ for the product rule formula: $f(x)g'(x)=(f(x)g(x))'-f'(x)g(x).$
• Using FTC Part 2, we get the Integration by parts for definite integrals formula: $\int_a^bf(x)g'(x)\,\mathrm dx=\left[f(x)g(x)\right]_a^b-\int_a^bf'(x)g(x)\,\mathrm dx.$
• It's better to use this version for definite integrals. You can still use $$u$$ and $$v$$ in your calculations if you prefer.
• 7.1.23. $$\int_0^{1/2}x\cos\pi x\,\mathrm dx$$.
• We need $$x\cos\pi x=uv'$$.
• We let $$u=x$$ and $$v'=\cos\pi x$$.
• Then we have $$u'=1$$ and $$v=\frac{1}{\pi}\sin\pi x$$.
• Therefore, we get $\int_0^{1/2}x\cos\pi x\,\mathrm dx=\left[x\frac{1}{\pi}\sin\pi x\right]_0^{1/2}-\int_0^{1/2}\frac{1}{\pi}\sin\pi x\,\mathrm dx =\frac{1}{2\pi}+\left[\frac{1}{\pi^2}\cos\pi x\right]_0^{1/2}=\frac{1}{2\pi}-\frac{1}{\pi^2}.$
• Exercises. 7.1: 24, 28, 29, 20.

## $$\int\ln x\,\mathrm dx$$.

• This is a special case, since it is an elementary function which we can integrate via Integration by parts.
• Let's write $$\ln x\mathrm dx=u\mathrm dv$$.
• We can put $$u=\ln x$$ and $$\mathrm dv=\mathrm dx$$.
• Then we have $$\mathrm du=\frac{1}{x}\mathrm dx$$ and $$v=x$$.
• Therefore, we get $\int\ln x\,\mathrm dx=x\ln x-\int\frac{x}{x}\mathrm dx=x\ln x-x+C.$
• Exercises. 7.1: 10, 11, 15, 26, 30.

## Integration by parts with exponential functions, $$\sin$$ and $$\cos$$

• 7.1.18. $$\int e^{-\theta}\cos2\theta\,\mathrm d\theta$$.
• When you want to integrate a product of two functions which are exponential or $$\sin$$ or $$\cos$$, what's important to remember is to keep performing the same operation on the same term. Let me first show what happens if you do not do this.
• Let's start out by letting $$u=e^{-\theta}$$ and $$\mathrm dv=\cos2\theta\mathrm d\theta$$.
• Then we get $$\mathrm du=-e^{-\theta}\mathrm d\theta$$ and $$v=\frac12\sin2\theta$$.
• Therefore, Integration by parts gives $\int e^{-\theta}\cos2\theta\,\mathrm d\theta=\frac12e^{-\theta}\sin2\theta+\int\frac12e^{-\theta}\sin2\theta\,\mathrm d\theta.$
• WRONG CHOICE We need to perform Integration by parts again. Let's see what happens if we take $$u=\frac12\sin2\theta$$ and $$\mathrm dv=e^{-\theta}$$.
• This gives $$\mathrm du=\cos2\theta\mathrm d\theta$$ and $$v=-e^{-\theta}$$.
• Thus, the calculation continues as $\frac12e^{-\theta}\sin2\theta+\int\frac12e^{-\theta}\sin2\theta\,\mathrm d\theta=\frac12e^{-\theta}\sin2\theta-\frac12e^{-\theta}\sin2\theta+\int e^{-\theta}\cos2\theta\,\mathrm d\theta.$
• We've gotten back to the original integral! We've worked for nothing!

## Integration by parts with exponential functions, $$\sin$$ and $$\cos$$

• CORRECT CHOICE
• When performing Integration by parts on $$\int e^{-\theta}\cos2\theta\,\mathrm d\theta$$, we had $$u=e^{-\theta}$$ and $$\mathrm dv=\cos2\theta\mathrm d\theta$$. Therefore, when performing Integration by parts on $$\int\frac12e^{-\theta}\sin2\theta\,\mathrm d\theta$$, we need to put $$u=e^{-\theta}$$ and $$\mathrm dv=\frac12\sin2\theta$$.
• (Actually, it's OK to pull the $$\frac12$$ out of the integral, I just keep it there to make the argument clearer.)
• We get $$\mathrm du=-e^{-\theta}\,\mathrm dx$$ and $$v=-\frac14\cos2\theta$$.
• Therefore, the calculation continues as $\frac12e^{-\theta}\sin2\theta+\int\frac12e^{-\theta}\sin2\theta\,\mathrm d\theta=\frac12e^{-\theta}\sin2\theta-\frac14e^{-\theta}\cos2\theta-\int\frac14e^{-\theta}\cos2\theta\,\mathrm d\theta.$
• We have gotten $\int e^{-\theta}\cos2\theta\,\mathrm d\theta=\frac12e^{-\theta}\sin2\theta-\frac14e^{-\theta}\cos2\theta-\frac14\int e^{-\theta}\cos2\theta\,\mathrm d\theta.$
• Note that we have the same integral on the two sides of the equation.
• Therefore, we can rearrange it as $\frac54\int e^{-\theta}\cos2\theta\,\mathrm d\theta=\frac12e^{-\theta}\sin2\theta-\frac14e^{-\theta}\cos2\theta.$
• That is, the final answer is $\int e^{-\theta}\cos2\theta\,\mathrm d\theta=\frac25e^{-\theta}\sin2\theta-\frac15e^{-\theta}\cos2\theta.$

## Exercises.

• 7.1: 17, 9, 12, 37, 40, 41, 48, 52.