## 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 $\int e^x \cos x \, {\rm d}x$

and $\int e^x \sin x \, {\rm d}x$

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 $u = e^x$ and ${\rm d} v = \cos x \, {\rm d}x$, so that ${\rm d} u = e^x \, {\rm d}x$ and $v = \sin x$. Then, calling the integral to be determined “I,” for reasons that will become clear shortly, we have $I = \int e^x \cos x \, {\rm d}x$ $I = uv - \int v \, {\rm d}u$ $I = e^x \sin x - \int e^x \sin x \, {\rm d}x$

In the integral on the right side of the previous equation, integrate by parts again, letting $U = e^x$ and ${\rm d} V = \sin x \, {\rm d}x$, so that ${\rm d} U = e^x \, {\rm d}x$ and $V = -\cos x$. The result is $I = e^x \sin x - \left [ UV - \int V \, {\rm d}U \right ]$ $I = e^x \sin x - \left [ e^x \left ( -\cos x \right ) - \int e^x \left ( -\cos x \right ) \, {\rm d}x \right ]$ $I = e^x \sin x - \left [- e^x \cos x + \int e^x \cos x \, {\rm d}x \right ]$ $I = e^x \sin x + e^x \cos x - \int e^x \cos x \, {\rm d}x$

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 $I = e^x \sin x + e^x \cos x - I$ $2I = e^x \sin x + e^x \cos x$ $2I = e^x \left [ \sin x + \cos x \right ]$ $I = \dfrac{e^x}{2} \left [ \sin x + \cos x \right ]$ $\int e^x \cos x \, {\rm d}x = \dfrac{e^x}{2} \left [ \sin x + \cos x \right ]$

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 $\int e^x \sin x \, {\rm d}x = \dfrac{e^x}{2} \left [ \sin x - \cos x \right ]$

Now for the trick, which relies on you knowing about complex numbers, including Euler’s formula: $e^{ix} = \cos x + i \sin x$

The strategy is to multiply the second of the original integrals by $i$ 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 $\int e^x \sin x \, {\rm d}x$ by $i$ and add it to $\int e^x \cos x \, {\rm d}x$ and combine the integrals into one integral: $\int e^x \cos x \, {\rm d}x + i \int e^x \sin x \, {\rm d}x = \int \left [ e^x \cos x + i e^x \sin x \right ] \, {\rm d}x$ $\int e^x \cos x \, {\rm d}x + i \int e^x \sin x \, {\rm d}x = \int e^x \left [ \cos x + i \sin x \right ] \, {\rm d}x$ $\int e^x \cos x \, {\rm d}x + i \int e^x \sin x \, {\rm d}x = \int e^x \left [ e^{ix} \right ] \, {\rm d}x$       (using Euler’s formula)

Now combine the exponential functions on the right side of the previous equation and antidifferentiate: $\int e^x \cos x \, {\rm d}x + i \int e^x \sin x \, {\rm d}x = \int e^{(1 + i)x} \, {\rm d}x$ $\int e^x \cos x \, {\rm d}x + i \int e^x \sin x \, {\rm d}x = \dfrac{1}{1 + i} e^{(1 + i)x}$

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: $\int e^x \cos x \, {\rm d}x + i \int e^x \sin x \, {\rm d}x = \dfrac{1}{1 + i} \times \dfrac{1 - i}{1 - i} e^x e^{ix}$ $\int e^x \cos x \, {\rm d}x + i \int e^x \sin x \, {\rm d}x = \dfrac{1 - i}{1 - i^2} e^x \left [ \cos x + i \sin x \right ]$ $\int e^x \cos x \, {\rm d}x + i \int e^x \sin x \, {\rm d}x = \dfrac{1 - i}{2} e^x \left [ \cos x + i \sin x \right ]$ $\int e^x \cos x \, {\rm d}x + i \int e^x \sin x \, {\rm d}x = \dfrac{e^x}{2} \left [ 1 - i \right ] \left [ \cos x + i \sin x \right ]$ $\int e^x \cos x \, {\rm d}x + i \int e^x \sin x \, {\rm d}x = \dfrac{e^x}{2} \left [ \cos x + i \sin x - i \cos x - i^2 \sin x \right ]$ $\int e^x \cos x \, {\rm d}x + i \int e^x \sin x \, {\rm d}x = \dfrac{e^x}{2} \left [ \cos x + i \sin x - i \cos x + \sin x \right ]$ $\int e^x \cos x \, {\rm d}x + i \int e^x \sin x \, {\rm d}x = \dfrac{e^x}{2} \left [ \sin x + \cos x + i \left ( \sin x - \cos x \right ) \right ]$ $\int e^x \cos x \, {\rm d}x + i \int e^x \sin x \, {\rm d}x = \dfrac{e^x}{2} \left [ \sin x + \cos x \right ] + i \dfrac{e^x}{2} \left [ \sin x - \cos x \right ]$

Matching real and imaginary parts on both sides of the previous equation gives us the final results: $\int e^x \cos x \, {\rm d}x = \dfrac{e^x}{2} \left [ \sin x + \cos x \right ]$ $\int e^x \sin x \, {\rm d}x = \dfrac{e^x}{2} \left [ \sin x - \cos x \right ]$

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 $\int e^{ax} \cos bx \, {\rm d}x$

and $\int e^{ax} \sin bx \, {\rm d}x$

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: $\int e^{ax} \cos bx \, {\rm d}x = \dfrac{e^{ax}}{a^2 + b^2} \left [ b\sin bx + a\cos bx \right ]$ $\int e^{ax} \sin bx \, {\rm d}x = \dfrac{e^{ax}}{a^2 + b^2} \left [ a\sin bx - b\cos bx \right ]$

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.

Advertisements ## About Santo D'Agostino

I have taught mathematics and physics since the mid 1980s. I have also been a textbook writer/editor since then. Currently I am working independently on a number of writing and education projects while teaching physics at my local university. I love math and physics, and love teaching and writing about them. My blog also discusses education, science, environment, etc. https://qedinsight.wordpress.com Further resources, and online tutoring, can be found at my other site http://www.qedinfinity.com
This entry was posted in Calculus, Mathematics and tagged , , , . Bookmark the permalink.

### 11 Responses to A Neat Trick For Determining The Integrals Of exp(x) cos x And exp(x) sin x

1. Kenneth Webster says:

aawwww dip

2. Mathew says:

Hmm thats a pretty neat trick I’m wondering if I can apply Euler’s method to evaluate integrals involving trigonometric functions in general ?is there is any geometric significance to this perhaps a reason why this method is simpler.

• Santo D'Agostino says:

These are good questions, Mathew! I don’t know if this trick is helpful for other trig integrals. I gave it a little thought, and I am guessing that the answer is no, but I’m not sure. I think it’s worth more thought.

As for the geometry of the situation, you can think of the function e^x*sin(x) as an exponential function, but with a variable amplitude, where the amplitude is the sine function. The complex exponential function can be visualized as an arrow with length 1 that can spin around the origin, so it can serve just as well as the sine function to provide a variable amplitude. Just provide a “spinner” for each x-value, and orient all of the arrows so that they follow a sine curve as you move along the x-axis. The amplitude of the real exponential function is given by the y-component of the arrow for each x-value. A similar interpretation can be given for a real exponential times a cosine function.

There is a major integration method in which a tough real integral becomes simpler when translated into a contour integral in a complex variable, and after you do the contour integral you then translate your result back into the real realm. This trick is not the same, as we always stick to a real integral, but nevertheless it is reminiscent of the other method.

3. tomcircle says:

Reblogged this on Singapore Maths Tuition.

4. suri says:

Thanks a lot….sir

5. preet says:

Thank you. The conclusion solves everything and saves time

6. Harsh says:

Hello,

Thanks for the help, but I find LIATE violated here as you considered exponential function as first and trigonometric functions as second. Correct me if I am wrong but I am confused. Can you please explain.

Thanks

7. Manideepa says:

Superb

8. mohsan ali says:

how we solve integration of cost *exp(t) from 0 to infinity.. any direct formula is possible for that problem plzz answer it

9. Don't show it to my dad says:

thanks a lot dude, that will reduce my calculation time from now. 🙂

10. +251915403050 says:

Think
😊☺😀