# How should I solve integrals of this type?

The general form of the integral I want to solve is:

$$\int e^{bx}\sin(ax) dx$$

Euler's formula has a nice connection, but the i makes it too complicated.

Doing it by parts doesn't seem to get me anywhere.

Do you have any tips for how to begin solving this?

-
sorry I dont know how to make a proper integral symbol on my question. If someone could edit it, it would be very nice –  JLL May 16 '14 at 4:05
Interestingly enough, you have mentioned the two easy ways of doing it. Integration by parts twice suffices, or use Euler's formula. –  mixedmath May 16 '14 at 4:06
But how would I approach an integral with an imaginary number, i? Also, I have not yet tried doing it by parts TWICE yet, I will try it now –  JLL May 16 '14 at 4:08
Are $\large a$ and $\large b$ reals numbers ?. –  Felix Marin May 16 '14 at 4:23
It doesn't matter whether they are real or complex, the formula is the same. –  Robert Israel May 16 '14 at 4:58

This is related to a classing integration by parts question. It goes like this.

Call the original integral $I$, for reasons that you'll see in a moment. Then we have

\begin{align} \int \sin(ax)\exp(bx) \mathrm dx &= \sin(ax) \frac{\exp(bx)}{b} - \frac{a}{b} \int \cos(ax) \exp(bx) \mathrm dx \\ &= \sin(ax) \frac{\exp(bx)}{b} - \frac{a}{b} \left(\cos(ax) \frac{\exp(bx)}{b} - \frac{a}{b}\int\cos(ax)\exp(bx) \mathrm dx\right) \\ &= \sin(ax) \frac{\exp(bx)}{b} - a\cos(ax) \frac{\exp(bx)}{b^2} + \frac{a^2}{b^2}I, \end{align}

so that we can gather the $I$ terms on the left to see that

$$I\left(1 + \frac{a^2}{b^2}\right) = \sin(ax) \frac{\exp(bx)}{b} - a\cos(ax) \frac{\exp(bx)}{b^2}.$$

In total,

$$I = \left(1 + \frac{a^2}{b^2}\right)^{-1}\left(\sin(ax) \frac{\exp(bx)}{b} - a\cos(ax) \frac{\exp(bx)}{b^2}\right).$$

It's a bit clever, and a bit cool if you've never seen this done before. (And I omitted the constant of integration, so it's really this $+ C$).

-

Yet another way: guess that the answer is of the form $$\int e^{bx} \sin(a x) = c_1 e^{bx} \cos(ax) + c_2 e^{bx} \sin(ax)$$ differentiate both sides, and equate coefficients of $e^{bx} \cos(ax)$ and $e^{bx}\sin(ax)$: \eqalign{ 0 &= b c_1 + a c_2\cr 1 &= -a c_1 + b c_2\cr} Then solve for $c_1$ and $c_2$.

-
Somehow this is the most honest, as this is how I would actually go about doing this integral now. –  mixedmath May 16 '14 at 5:04
elegant work +1 –  Hashir Omer May 16 '14 at 12:51
What motivates the guess, and what justifies equating coefficients? –  Jack M May 16 '14 at 17:09
@JackM Differentiating $e^x\cos x$ or $e^x\sin x$ gives combinations of terms similar to your integrand. It stands that some combination of these might differentiate to give the integrand precisely; we then must figure out which combination.. You equate coefficients because you want to find the particular case where the (differentiated) functions are the same. –  Robert Mastragostino May 16 '14 at 20:01

A nice variation on the standard method as given in @mixedmath's answer: let $$I=\int e^{bx}\sin ax\,dx\quad\hbox{and}\quad J=\int e^{bx}\cos ax\,dx\ .$$ Integrating both of these by parts gives $$I=\frac{1}{b}e^{bx}\sin ax-\frac{a}{b}J\quad\hbox{and}\quad J=\frac{1}{b}e^{bx}\cos ax+\frac{a}{b}I\ ;$$ now treat these as two equations in the unknowns $I$ and $J$, and solve.

-

By using the exponential version of sine: \begin{align} \int e^{bx} \ \sin(ax) \ dx &= \frac{1}{2i} \int \left( e^{(b+ai)x} - e^{(b-ai)x} \right) \ dx \\ &= \frac{1}{2i} \left[ \frac{e^{(b+ai)x}}{b+ai} - \frac{e^{(b-ai)x}}{b-ai} \right] \\ &= \frac{1}{2i (b+ai)(b-ai)} \left[ (b-ai) e^{(b+ai)x} - (b+ai)e^{(b-ai)x} \right] \\ &= \frac{1}{2i(b^{2}+a^{2})} \left[ b \ e^{bx} \left(e^{ai x} - e^{-ai x} \right) - (ai) e^{bx} \left( e^{ai x} + e^{-ai x} \right) \right] \\ &= \frac{e^{bx}}{b^{2} + a^{2}} \left[ b \sin(ax) - a \cos(ax) \right] \end{align}

By using integration by parts: \begin{align} \int e^{bx} \ \sin(ax) \ dx &= \frac{1}{b} e^{bx} \sin(ax) - \frac{a}{b} \int e^{bx} \ \cos(ax) \ dx \\ &= \frac{1}{b} e^{bx} \sin(ax) - \frac{a}{b^{2}} e^{bx} \cos(ax) - \frac{a^{2}}{b^{2}} \int e^{bx} \ \sin(ax) \ dx \end{align} which is \begin{align} \left( 1 + \frac{a^{2}}{b^{2}} \right) \int e^{bx} \ \sin(ax) \ dx = \frac{1}{b} e^{bx} \sin(ax) - \frac{a}{b^{2}} e^{bx} \cos(ax) \end{align} or \begin{align} \int e^{bx} \ \sin(ax) \ dx = \frac{e^{bx}}{b^{2} + a^{2}} \left[ b \sin(ax) - a \cos(ax) \right] \end{align}

-
I think you should add some details between the second to last and last equality in the Euler's formula method. This may not be very trivial for OP. –  Cameron Williams May 16 '14 at 4:26
No its okay I understand it, I really appreciate that you showed the solution with Euler's formula, thanks. –  JLL May 16 '14 at 4:28

Another way of exploiting the connection to the complex exponential function is to use $\ e^{i \cdot ax} \$ as the factor $\ \cos (ax) \ + \ i \ \sin (ax) \$ . If you now integrate

$$\ \int \ e^{bx} \ \cdot \ e^{i \cdot ax} \ \ dx \ \ = \ \ \int \ e^{(b + ia) \cdot x} \ \ dx \ \ = \ \ \frac{1}{b \ + \ ia} \ e^{(b + ia) \cdot x} \ \ ,$$

treating the complex number in the same manner as any real constant in a similar integral, we obtain

$$\frac{b \ - \ ia}{a^2 \ + \ b^2} \ \cdot \ e^{bx} \ [ \ \cos (ax) \ + \ i \ \sin (ax) \ ] \ \ .$$

What is nice about this technique is that we get a "two-fer" (and no need for integration by parts): separating the real and imaginary parts of this anti-derivative, after multiplying it out, and relating them to the corresponding parts of the integrand, yields

$$\ \int \ e^{bx} \ \cos(ax) \ \ dx \ \ = \ \ e^{bx} \ \left[ \ \frac{b}{a^2 \ + \ b^2} \ \cos (ax) \ + \ \frac{a}{a^2 \ + \ b^2} \ \ \sin (ax) \ \right]$$

and

$$\ \int \ e^{bx} \ \sin(ax) \ \ dx \ \ = \ \ e^{bx} \ \left[ \ \frac{b}{a^2 \ + \ b^2} \ \sin (ax) \ - \ \frac{a}{a^2 \ + \ b^2} \ \ \cos (ax) \ \right] \ \ .$$

-
This is by far the best answer, because it illustrates a method that is very fast and very widely applicable! +1 –  user111187 May 16 '14 at 5:08
I don't know about it being the "best answer", but it is a nice method tying together the circular trig functions with the complex exponential function. I like the technique for illustrating how many problems using $\ \mathbb{R} \$ have simpler solutions by moving on into $\ \mathbb{C} \$ . –  RecklessReckoner May 16 '14 at 5:14

A third (or maybe fourth, depending on how you're counting) method (related to the one in David's answer) which uses a bit of linear algebra is as follows: \begin{align*} \left[\begin{array}{c} e^{ax}\cos(bx)\\ e^{ax}\sin(bx) \end{array}\right]' &= \left[ \begin{array}{c} ae^{ax}\cos(bx) - be^{ax}\sin(bx)\\ ae^{ax}\sin(bx) + be^{ax}\cos(bx) \end{array} \right]\\ &= \left[ \begin{array}{cc} a & -b\\ b & a \end{array} \right] \left[ \begin{array}{c} e^{ax}\cos(bx)\\ e^{ax}\sin(bx) \end{array} \right] \end{align*}

Using the adjoint method, and the fact that the integral is (up to a constant) the functional inverse of the derivative on the space of smooth functions, we have: \begin{align*} \int \left[\begin{array}{c} e^{ax}\cos(bx)\\ e^{ax}\sin(bx) \end{array}\right] \text{d}x &= \frac{1}{a^2+b^2} \left[ \begin{array}{cc} a & b\\ -b & a \end{array} \right] \left[\begin{array}{c} e^{ax}\cos(bx)\\ e^{ax}\sin(bx) \end{array}\right] + \left[\begin{array}{c} C_1\\ C_2 \end{array}\right]\\ &= \left[\begin{array}{c} \frac{1}{a^2+b^2}\left(ae^{ax}\cos(bx) + be^{ax}\sin(bx)\right) + C_1\\ \frac{1}{a^2+b^2}\left(ae^{ax}\sin(bx)-be^{ax}\cos(bx)\right) + C_2 \end{array}\right] \end{align*} Hence we have: \begin{align*} \int e^{ax}\cos(bx) \,\text{d}x &= \frac{1}{a^2+b^2}\left(ae^{ax}\cos(bx) + be^{ax}\sin(bx)\right) + C\\ \int e^{ax}\sin(bx) \, \text{d}x &= \frac{1}{a^2+b^2}\left(ae^{ax}\sin(bx)-be^{ax}\cos(bx)\right) + C \end{align*}

Why the downvote? This method works quite well computing integrals of this type.

-