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).

∫excos⁡x dx=ex(sin⁡x+cos⁡x)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 excos⁡xe^x\cos x vanishes under differentiation, so a single integration by parts will not finish. Applying it twice loops the integral back to itself.

∫u dv=uv−∫v du\int u\,dv = uv - \int v\,du

Call the target integral II. First take u=cos⁡xu = \cos x and dv=ex dxdv = e^x\,dx, so du=−sin⁡x dxdu = -\sin x\,dx and v=exv = e^x.

I=∫excos⁡x dx=excos⁡x+∫exsin⁡x dxI = \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=ex dxdv = e^x\,dx. Take u=sin⁡xu = \sin x, so du=cos⁡x dxdu = \cos x\,dx and v=exv = e^x.

∫exsin⁡x dx=exsin⁡x−∫excos⁡x dx=exsin⁡x−I\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=excos⁡x+exsin⁡x−II = e^x\cos x + e^x\sin x - I
2I=ex(sin⁡x+cos⁡x)2I = e^x(\sin x + \cos x)

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

∫excos⁡x dx=ex(sin⁡x+cos⁡x)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=ex dxdv = 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(sin⁡x+cos⁡x)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 cos⁡x\cos x for sin⁡x\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)?

∫exsin⁡x dx=ex(sin⁡x−cos⁡x)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πexcos⁡x dx=[ex(sin⁡x+cos⁡x)2]0π=eπ(0−1)2−1(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}.