Integration by parts can be used to integrate the product of a trig function with an exponential. For example, consider:

int{}{}{e^x sin(x) dx}

First let’s recall the integration by parts formula:

int{}{}{u dv}~=~uv~-~int{}{}{v du}

The trick is to pick u and v in such a way that

uv~-~int{}{}{v du}

is a simpler expression. In this case, try

u~=~e^x,~ dv~=~sin(x) dx

Then

v~=~int{}{}{sin(x) dx}~ =~ - cos(x)

(ignore constants of integration for now, we’ll add it at the end). And so

int{}{}{e^x sin(x) dx}  =  -e^x cos(x) +  int{}{}{e^x cos(x) dx}

It seems that we haven’t gotten anywhere. But we can apply integration by parts again on the second integral. We take

u = e^x,~ dv ~= cos(x) dx

Hence

int{}{}{e^x cos(x) dx}  = e^x sin(x) -  int{}{}{e^x sin(x) dx}

Putting everything together

int{}{}{e^x sin(x) dx}~ =~ -e^x cos(x)~ + ~ int{}{}{e^x cos(x) dx}

~~~=~  -e^x cos(x) ~+~ e^x sin(x) ~-~  int{}{}{e^x sin(x) dx}

Now add

int{}{}{e^x sin(x) dx}

To both sides. Then we find (making sure to add in the constant of integration)

int{}{}{e^x sin(x) dx} ~ =~ {1/2}e^x (sin(x) - cos(x)) ~+~C