Dear Uncle Colin,

How would you integrate exsin(x) (with respect to x, obviously)?

- Difficult Integral, Just Kan’t See The Right Answer

Hi, DIJKSTRA, and thanks for your message! As seems to be the way recently, there are several ways to approach this.

My favourite way

One of the best bits about further maths for me were things like proof by induction, reduction formulas, and setting a value on an integral to help you solve it. They all feel like cheating, somehow, and I get a small frisson of excitement every time I get to use them.

Here, we can let I=exsin(x)dx and proceed by parts (it really doesn’t matter which part we pick to differentiate.) Let’s let u=ex and dvdx=sin(x), making dudx=ex and v=cos(x).

This gives us I=cos(x)ex+excos(x)dx

Repeating the trick, with U=ex and dVdx=cos(x), gives us dUdx=ex and V=sin(x). This means:

I=cos(x)ex+sin(x)exexsin(x)dx.

However, that last term is just I! With a bit of rearrangement and tidying up:

2I=ex(sin(x)cos(x)), so I=12ex(sin(x)cos(x)). Plus a constant.

The Ansatz method

I don’t have a good translation for Ansatz, a word introduced to me by a German lecturer in my final year; the best I have is ‘template’: you make a guess about what the answer ought to look like and work backwards from there. It’s very much a Mathematical Pirate trick, but it does drop out nicely.

Here, we might assume an answer of the form ex(asin(x)+bcos(x)). The derivative of this (which ought to match the thing we’re trying to integrate) is ex((ab)sin(x)+(a+b)cos(x)).

Matching coefficients with the integrand gives ab=1 and a+b=0, so a=12 and b=12 - which leads to the same answer as before.

Complex variables!

A third option is to use the representation sin(x)=eixeix2i to make the integral 12i(e(1+i)xe(1i)x).

This integrates to 12i(11+ie(1+i)x11ie(1i)x), which is a bit of a mess.

Let’s note that 11+i=1i2 if you realise the denominator; similarly, 11i=1+i2. There’s also a factor of ex all the way through, so I’ll bring that out. This leaves us with:

ex4i((1i)eix(1+i)eix)

We could try to pattern-match sin(x) and cos(x) back onto that, but it’s probably simpler to say e±ix=cos(x)±isin(x).

We’ve then got ex4i((1i)(cos(x)+isin(x))(1+i)(cos(x)isin(x))).

Multiplying out: ex4i((cos(x)+sin(x)cos(x)sin(x))+i(sin(x)cos(x)+sin(x)cos(x))). There’s a lot of cancelling available there - the “real” part of the bracket vanishes, and the i alongside the complex part and the i on the bottom of the fraction simplify out. This gives us: ex4(2sin(x)+2cos(x)), which simplifies down as before.

Plus a constant.

There are probably several other ways to approach it - I’d love to hear of them - but I hope that helps.

- Uncle Colin