Today is going to be the last day where we will focus on integration by parts. We’re going to run through a few more examples, but each of them will be slightly different from what you’ve seen already and will give you a few more insights into some of the tricks you might have to play.

Definite integrals using integration by parts

Let’s look at the following integral: $\int_0^{\frac{\pi}{2}} x^2 \sin x dx$

Where as usual we see that the $x^2$ term becomes simpler if we differentiate it and so we choose: $u=x^2,\,\,\,\,\, dv=\sin x dx$

Thus $du=2x dx,\,\,\,\,\, v=-\cos x$

Using the normal integration parts algorithm we will get the following, and note that now we need to evaluate the result at the limits of integration: $\left.-x^2 \cos x\right|_0^{\frac{\pi}{2}}+ \int_0^{\frac{\pi}{2}} 2x \cos x dx$

We can’t quite solve this last integral directly so we integrate by parts again. However, we note that the first term in this expression actually evaluates to zero when we plug in both limits, so we are left with just the integral term. We again make a choice for a new $u$ and $dv$ as: $u=x,\,\,\,\,\, dv=\cos xdx$

Thus $du=dx,\,\,\,\,\, v=\sin x$

Remembering the factor of $2$ we get: $\left. 2 x \sin x\right|_0^{\frac{\pi}{2}}-2 \int_0^{\frac{\pi}{2}} \sin x dx=2\frac{\pi}{2}\sin\frac{\pi}{2}+\left(\left. 2\cos x\right|_0^{\frac{\pi}{2}}\right)=\pi+2(0-1)=\pi-2$

Note that we could quite happily have worked out the whole thing as an indefinite integral and then used the evaluation theorem at the very end. Try it both ways and make sure that you see that they give the same answer.

Circular reasoning?

In this example we’re going to see an integration that looks like it comes to a dead-end, but in fact before we know it we’ve solved it! $\int e^x\sin x dx$

In this case neither the exponential nor the trig function get simpler when we differentiate them. We will choose: $u=e^x,\,\,\,\,\, dv=\sin x dx\longrightarrow du=e^x dx,\,\,\,\,\, v=-\cos x$

plug this in and we get: $\int e^x\sin x dx= -e^x \cos x+\int e^x \cos x dx$

This integral looks just as hard as the first, but we’ll plug away at it. Now make a new choice to solve the second integral: $u=e^x,\,\,\,\,\, dv=\cos x dx\longrightarrow du=e^x dx,\,\,\,\,\, v=\sin x$

Plug this in and we have: $\int e^x\sin x dx= -e^x \cos x+e^x\sin x-\int e^x\sin x dx$

Disaster!! It looks like our answer includes the thing that we were trying to find in the first place….but there’s a subtle but important difference, and that is in the minus sign! We can now rearrange the above equation by taking the integral on the right hand side to the left: $2\int e^x\sin x dx= -e^x \cos x+e^x\sin x$

and so $\int e^x\sin x dx=\frac{e^x}{2}\left(\sin x-\cos x\right)+c$

So we actually have the answer without having to do the second integral…magic!!

Note that it might be a bit surprising that the $c$ popped up out of nowhere. The point is that an indefinite integral is only ever defined up to an additive constant and so we are always free to add this.

A cheeky trig integral

Let’s look at something which seems really hard to do but actually using integration by parts becomes pretty easy… $\int \arcsin x dx$

Integration by parts helps us because it allows us to work with the derivatives of functions to simplify things.

We’re going to choose here to have: $u=\arcsin x,\,\,\,\,\, dv=dx$

To work out what $du$ is it’s easiest to invert the expression to get $x=\sin u$, then take $\frac{dx}{du}=\cos u=\sqrt{1-\sin^2u}=\sqrt{1-x^2}$. Thus: $du=\frac{dx}{\sqrt{1-x^2}}$

Plugging this into the integration by parts formula: $\int \arcsin x dx=x\arcsin x-\int \frac{x}{\sqrt{1-x^2}} dx$

This last expression we can solve with a substitution: $p=1-x^2\rightarrow dp=-2x dx$: $\int \arcsin x dx=x\arcsin x+\frac{1}{2}\int \frac{1}{\sqrt{p}} dp=x\arcsin x+\sqrt{p}+c=x\arcsin x+\sqrt{1-x^2}+c$

Substitution then by parts

How about the following integral: $\int \cos\sqrt{x} dx$

We start with a simpler substitution: $\sqrt{x}=u\rightarrow \frac{dx}{2\sqrt{x}}=du\rightarrow dx=2u du$ which gives: $\int \cos\sqrt{x} dx=2 \int u\cos u du$

And now we use integration by parts on this, choosing $dg=\cos u du, \,\,\,\, f=u$ (note that I’ve chosen these variable labels so that you have to pay attention to what we’re doing in the integration by parts). $\int \cos\sqrt{x}dx=2 \int u\cos u du=2 u\sin u-\int 2\sin u du=2u\sin u+2\cos u+c$ $2(\sqrt{x}\sin\sqrt{x}+\cos\sqrt{x})+c$

Try them yourself…

Try solving: $\int (\ln x)^2 dx$

Both by choosing $u=(\ln x)^2\,\,\, dv= dx$ and separately by choosing $u=\ln x\,\,\, dv=\ln x dx$. Make sure that you get the same answer.

Note importantly that: $\ln |x|=\ln x+ c$

Though we won’t be able to explain exactly why until you have done complex numbers. What this means though is that in reality you can always convert a $\ln x$ into a $\ln x+c$.

Try this one yourself too: $\int x \sin x\cos x dx$

Hint: you will have to work out how to integrate $\sin x\cos x$ and this can be done with a simple integration by parts, or by writing this in terms of a double angle formula.

## Bonus Section

I’m going to try and add a few thoughts on some completely unrelated areas of mathematics to each lecture – just a few moments to get you thinking about some area of maths which I think you might find rather fascinating.

We’ll start with some thoughts on the subject of Number Theory – the study of integers. It might seem like once you’ve learned to count, you know everything there is to know about integers, but this is so far from the truth that you wouldn’t believe how deep this subject gets!

I’m sure you all know what a prime number is: those numbers greater than 1 which are divisible only by themselves and 1. They are in many ways the most fundamental of numbers. All other numbers can be constructed from them.

The Fundamental Theorem of Arithmetic tells us that all numbers can be written as the product of prime numbers. This in itself is not so special – the theorem tells us however that each number can be written like this in only one way – the product is unique for every number. For instance: $50=2*5*5$

There is no other way to write 50 as the product of primes (other than by rearranging the above).

The way we break down each number into its prime factors is called Prime Factorization. It’s actually quite easy to prove this by induction.

There’s a second statement which looks like it should be just as easy to prove:

Every even integer greater than 2 can be written as the sum of two primes.

This is known as Goldbach’s conjecture and we still cannot prove that it is true, although we know that it holds true for integers up to around $10^{18}$. Doesn’t that seem strange?

Prime numbers really are the bricks and mortar of all  numbers. Next up, how many primes are there and how many twin primes are there?

See a nice video here showing some mysteries of the prime numbers:

 How clear is this post?