AP Calculus BC

Integral of e^x cos(x): Answer, Proof, and Steps

The integral of e^x cos(x) is e^x(sin x + cos x)/2 + C. Integration by parts applied twice brings back the original integral, and solving that equation for it produces the factor of one half. Differentiating e^x(sin x + cos x)/2 returns e^x cos(x).

excosxdx=ex(sinx+cosx)2+C\int e^x\cos x\,dx = \frac{e^x(\sin x+\cos x)}{2} + C

Integration by parts, applied twice

Neither factor of excosxe^x\cos x vanishes under differentiation, so a single integration by parts will not finish. Applying it twice loops the integral back to itself.

udv=uvvdu\int u\,dv = uv - \int v\,du

Call the target integral II. First take u=cosxu = \cos x and dv=exdxdv = e^x\,dx, so du=sinxdxdu = -\sin x\,dx and v=exv = e^x.

I=excosxdx=excosx+exsinxdxI = \int e^x\cos x\,dx = e^x\cos x + \int e^x\sin x\,dx

Apply parts again to the new integral, keeping dv=exdxdv = e^x\,dx. Take u=sinxu = \sin x, so du=cosxdxdu = \cos x\,dx and v=exv = e^x.

exsinxdx=exsinxexcosxdx=exsinxI\int e^x\sin x\,dx = e^x\sin x - \int e^x\cos x\,dx = e^x\sin x - I

Solving for the integral

The original integral II has reappeared on the right. Substitute the second result into the first and collect the II terms.

I=excosx+exsinxII = e^x\cos x + e^x\sin x - I
2I=ex(sinx+cosx)2I = e^x(\sin x + \cos x)

Divide by 22 to isolate II, then attach the constant of integration.

excosxdx=ex(sinx+cosx)2+C\int e^x\cos x\,dx = \frac{e^x(\sin x + \cos x)}{2} + C

Where the one half comes from

The integral is not integrated away; it is solved for like a variable. Moving I-I across the equation creates the 2I2I, and dividing gives the 12\frac{1}{2}.

Common mistakes

This double-parts pattern trips students in a few predictable ways.

  • Switching the choice of uu on the second pass. Both integrations by parts must keep dv=exdxdv = e^x\,dx; swapping to u=exu = e^x unwinds the first step back to I=II = I.
  • Forgetting to divide by 22. After 2I=ex(sinx+cosx)2I = e^x(\sin x + \cos x) you must halve both sides.
  • Dropping the constant. Even after solving algebraically, the indefinite integral needs +C+ C.

Every answer on this page is machine checked

An automated test differentiates the antiderivative above and confirms it returns the integrand. A wrong sign or a missing factor fails the build, so it cannot reach you.

Frequently asked questions

Why does integrating e^x cos(x) require parts twice?

Because one pass trades cosx\cos x for sinx\sin x but leaves an exe^x times a trig function. A second pass brings back the original integral, which you then solve for algebraically.

What is the integral of e^x sin(x)?

exsinxdx=ex(sinxcosx)2+C\int e^x\sin x\,dx = \frac{e^x(\sin x - \cos x)}{2} + C. The same double-parts method applies, and only the internal sign differs from the cosine case.

What is the integral of e^x cos(x) from 0 to pi?

0πexcosxdx=[ex(sinx+cosx)2]0π=eπ(01)21(0+1)2=eπ+12\int_0^{\pi} e^x\cos x\,dx = \left[\frac{e^x(\sin x + \cos x)}{2}\right]_0^{\pi} = \frac{e^{\pi}(0 - 1)}{2} - \frac{1(0 + 1)}{2} = -\frac{e^{\pi} + 1}{2}.