# A NEAT TRICK FOR DETERMINING THE INTEGRALS OF EXP(X) COS X AND EXP(X) SIN X

A Neat Trick For Determining The Integrals Of exp(x) cos x And exp(x) sin x

The standard method (typically found in first-year calculus textbooks) for determining the integrals

and

is to integrate by parts twice. If you haven’t seen the standard method, I’ll show you how to do the first one; the second one is similar. Later in the post I’ll show you the neat trick for determining both integrals at once.

It doesn’t much matter whether you let u represent the exponential function or the trigonometric function in the first integration, but you have to be consistent in the second integration. (That is, if you let u stand for the exponential function in the first integration, then also let u stand for the exponential function in the second integration. Alternatively, if you let u stand for the trigonometric function in the first integration, then also let u stand for the trigonometric function in the second integration.) Otherwise, after two integrations by parts you will end up with 0 = 0, which is true but not helpful.

So, let  and , so that  and . Then, calling the integral to be determined “I,” for reasons that will become clear shortly, we have

In the integral on the right side of the previous equation, integrate by parts again, letting  and , so that  and . The result is

We seem to be going around in circles, because the integral on the right side of the previous equation is the same as the one we started with. However, if we just replace it by its label I, the previous equation is seen to be an algebraic equation that we can solve for I. (This is the motivation for introducing the label I.) Doing this, we obtain

You can check the result by differentiating it to arrive at the original function. Some people enjoy this method as it seems as if we got something for nothing. We never really “finished” the integration by parts (after two iterations, we were still left with an integral), and yet the final result somehow popped out.

And of course, if you need to determine the other integral, then you have to go through the process once more, integrating by parts twice again. Try it for practice, if you wish; the result is

Now for the trick, which relies on you knowing about complex numbers, including Euler’s formula:

The strategy is to multiply the second of the original integrals by  and then add it to the first of the original integrals. It turns out that combining them in this way results in an integral that is quite easy to determine; no integration by parts four times is needed. Then we just separate the final result into a sum of real and imaginary parts; the real part is the result for the first integral and the imaginary part is the result of the second integral.

Let’s see how it works: First multiply  by  and add it to  and combine the integrals into one integral:

(using Euler’s formula)

Now combine the exponential functions on the right side of the previous equation and antidifferentiate:

The final stage is to express the right side of the previous equation as the sum of a real part and an imaginary part. Part of this process is to multiply the numerator and denominator of the fractional factor by the complex conjugate of the denominator; the other part is to separate the exponential functions on the right side of the equation:

Matching real and imaginary parts on both sides of the previous equation gives us the final results:

Conclusion: Does the trick save work? The integration step in the trick method is very easy, so we’re trading four integrations by parts plus some algebra for a simple integration and some algebra with complex numbers. It’s a trade I’d make any day. But of course, to each his own, so try both ways and decide for yourself which way you like better.

If the integrals are a bit more complex, then the savings in the trick method are even greater. For example, you might try using both methods to determine the integrals

and

Integration by parts is even more of a pain, but the trick method is hardly more difficult. If you do try them, you can check your final results against these:

I just did these two integrals with pencil and paper, and the trick method is much faster. Even if you only have to work out one of the integrals (the method is the same, you just ignore one of the final results), I think the trick method is still a time-saver and the probability of making an error is reduced, because you avoid the messy integrations by parts.

Source: QED