Solution:
Key idea: We integrate by parts twice, ∫uvdx=u∫vdx−∫(dxdu∫vdx)dx, keeping ex as the second function both times. The original integral I comes back, and we solve the resulting equation for I.
Step 1 — First use of parts.
We take u=sinx and v=ex, so dxdu=cosx and ∫exdx=ex.
I=exsinx−∫excosxdx
Step 2 — Second use of parts.
Now we take u=cosx and v=ex, so dxdu=−sinx.
∫excosxdx=excosx−∫(−sinx)exdx
∫excosxdx=excosx+I
Step 3 — Put this back into Step 1.
We replace the integral in Step 1 by the result of Step 2.
I=exsinx−excosx−I
Step 4 — Solve for I.
We add I to both sides, divide by 2 and add the constant.
2I=ex(sinx−cosx)
I=21ex(sinx−cosx)+C
Therefore, ∫exsinxdx=21ex(sinx−cosx)+C.