Maths WorkshopMaths problems with full solutions
Exercise 738Calculus › Single-variable calculus › Integration › Integration techniquesL1Added 2 Nov 2026

Integrating by parts twice and coming back

#integration by parts#exponential#trigonometric

Statement

Compute J=∫0πexsin⁡x dxJ=\displaystyle\int_0^\pi e^x\sin x\,dx.

Hint

Integrate by parts twice. The original integral reappears: treat it as an unknown and solve an equation.

Show solutionHide solution

Solution

First pass. With u=sin⁡xu=\sin x, v′=exv'=e^x:
J=[exsin⁡x]0π−∫0πexcos⁡x dx=−K,K=∫0πexcos⁡x dx.J=\bigl[e^x\sin x\bigr]_0^\pi-\int_0^\pi e^x\cos x\,dx=-K,\qquad K=\int_0^\pi e^x\cos x\,dx.

Second pass. With u=cos⁡xu=\cos x, v′=exv'=e^x:
K=[excos⁡x]0π+∫0πexsin⁡x dx=(−eπ−1)+J.K=\bigl[e^x\cos x\bigr]_0^\pi+\int_0^\pi e^x\sin x\,dx=(-e^\pi-1)+J.

Solving. J=−K=eπ+1−JJ=-K=e^\pi+1-J, so 2J=eπ+12J=e^\pi+1 and
J=eπ+12≈12.07.J=\frac{e^\pi+1}2\approx12.07.

Remark. An antiderivative is ex(sin⁡x−cos⁡x)2\frac{e^x(\sin x-\cos x)}2. The "cyclic" method also works for ∫eaxcos⁡bx dx\int e^{ax}\cos bx\,dx and is the real-variable counterpart of taking the imaginary part of ∫e(1+i)xdx\int e^{(1+i)x}dx.