# Integral of eˣ sin x: Formula, Steps and Examples

> The integral of eˣ sin x is ½eˣ(sin x − cos x) + C. Learn the integrate-twice-and-solve trick, a check, a graph and the e^(ax) sin(bx) formula.

Source: https://practicecalculus.com/integrals/e-to-the-x-sin-x
Updated: 2026-11-06

$$ \int e^x\sin x\,dx = \frac{e^x}{2}\left(\sin x - \cos x\right) + C $$

## At a glance

- **Antiderivative:** $\frac{1}{2}e^x(\sin x - \cos x) + C$
- **Method:** Integration by parts twice, then solve for the integral
- **Companion:** $\int e^x\cos x\,dx = \frac{1}{2}e^x(\sin x + \cos x) + C$
- **General form:** $\int e^{ax}\sin bx\,dx = \frac{e^{ax}(a\sin bx - b\cos bx)}{a^2 + b^2} + C$
- **From 0 to π:** $\frac{e^\pi + 1}{2} \approx 12.07$

## Key takeaways

- The integral of $e^x\sin x$ is $\frac{1}{2}e^x(\sin x - \cos x) + C$.
- Integrate by parts twice. The original integral comes back, and you solve for it like an unknown in an equation.
- Keep the same type of function as $u$ both times (say, the exponential), or the second step undoes the first.
- In general, $\int e^{ax}\sin bx\,dx = \frac{e^{ax}(a\sin bx - b\cos bx)}{a^2+b^2} + C$.

The **integral of $e^x\sin x$ is $\dfrac{1}{2}e^x(\sin x - \cos x) + C$**. It is the famous "loop" integral: integration by parts never finishes on its own, but after two steps you can solve for the answer with algebra.

$$\int e^x\sin x\,dx = \frac{e^x}{2}\left(\sin x - \cos x\right) + C$$

## Graph of eˣ sin x

```graph
title: 'y = eˣ sin x with the area from 0 to π shaded'
caption: 'The shaded area is $\frac{e^\pi + 1}{2} \approx 12.07$. The curve oscillates like $\sin x$, but the swings grow because of the $e^x$ factor.'
x: [-3, 4]
y: [-3, 8]
functions:
  - expr: exp(x)*sin(x)
    label: y = eˣ sin x
shade:
  expr: exp(x)*sin(x)
  from: 0
  to: 3.14159
points:
  - [2.35619, 7.4605, 'max at x = 3π/4']
```

## How to integrate eˣ sin x step by step

Call the integral $I$. Use [integration by parts](/rules/integration-by-parts-rule) with the trig function as $u$ both times.

1. **First pass.** $u = \sin x$, $dv = e^x\,dx$, so $du = \cos x\,dx$ and $v = e^x$:
$$I = e^x\sin x - \int e^x\cos x\,dx$$
2. **Second pass**, on $\int e^x\cos x\,dx$. Again the trig function is $u$: $u = \cos x$, $dv = e^x\,dx$, so $du = -\sin x\,dx$, $v = e^x$:
$$\int e^x\cos x\,dx = e^x\cos x + \int e^x\sin x\,dx = e^x\cos x + I$$
3. **Substitute back.** The original integral has returned:
$$I = e^x\sin x - e^x\cos x - I$$
4. **Solve for $I$.** Add $I$ to both sides: $2I = e^x(\sin x - \cos x)$, so
$$I = \frac{e^x}{2}(\sin x - \cos x) + C$$

The $+ C$ is added at the end, after solving. It works just as well with $u = e^x$ both times. What fails is switching: if you take $u = \sin x$ first and $u = e^x$ second, the second step undoes the first and you get $I = I$.

## Check by differentiating

$$\frac{d}{dx}\left[\frac{e^x}{2}(\sin x - \cos x)\right] = \frac{e^x}{2}(\sin x - \cos x) + \frac{e^x}{2}(\cos x + \sin x) = \frac{e^x}{2}\cdot 2\sin x = e^x\sin x$$

## The general formula

The same two-step loop for $e^{ax}\sin bx$ and $e^{ax}\cos bx$ gives

$$\int e^{ax}\sin bx\,dx = \frac{e^{ax}(a\sin bx - b\cos bx)}{a^2 + b^2} + C$$

$$\int e^{ax}\cos bx\,dx = \frac{e^{ax}(a\cos bx + b\sin bx)}{a^2 + b^2} + C$$

With $a = b = 1$ the denominator is $2$, matching the result above.

**A quicker route with complex numbers.** Since $e^{ix} = \cos x + i\sin x$, $e^x\sin x$ is the imaginary part of $e^{(1+i)x}$. Integrating gives $\frac{e^{(1+i)x}}{1+i} = \frac{(1-i)}{2}e^x(\cos x + i\sin x)$, whose imaginary part is $\frac{e^x}{2}(\sin x - \cos x)$.

## Definite integrals

**From 0 to π:**

$$\left[\frac{e^x}{2}(\sin x - \cos x)\right]_0^\pi = \frac{e^\pi}{2}(0 + 1) - \frac{1}{2}(0 - 1) = \frac{e^\pi + 1}{2} \approx 12.07$$

**From 0 to π/2:** $\frac{e^{\pi/2}}{2}(1 - 0) - \frac{1}{2}(0 - 1) = \frac{e^{\pi/2} + 1}{2} \approx 2.905$.

**Decaying version.** $\int_0^\infty e^{-x}\sin x\,dx$. Use the formula with $a = -1$, $b = 1$: the antiderivative is $\frac{e^{-x}(-\sin x - \cos x)}{2}$, which goes to $0$ at infinity. So the value is $0 - \left(-\frac{1}{2}\right) = \frac{1}{2}$.

## Worked examples

**Example 1: eˣ cos x.** From step 2 above, $\int e^x\cos x\,dx = e^x\cos x + I$. Substitute $I$:

$$\int e^x\cos x\,dx = e^x\cos x + \frac{e^x}{2}(\sin x - \cos x) = \frac{e^x}{2}(\sin x + \cos x) + C$$

**Example 2: different rates.** $\int e^{2x}\sin 3x\,dx = \frac{e^{2x}(2\sin 3x - 3\cos 3x)}{13} + C$, using $a^2 + b^2 = 4 + 9 = 13$.

**Example 3: damped vibration.** A spring's displacement is $e^{-t}\cos t$. Its total signed displacement over $[0, \infty)$ is $\int_0^\infty e^{-t}\cos t\,dt = \frac{1}{2}$, from the cosine formula with $a = -1$, $b = 1$: the antiderivative $\frac{e^{-t}(\sin t - \cos t)}{2}$ goes from $-\frac{1}{2}$ to $0$.

## Common mistakes

1. **Switching the choice of $u$** between the two passes. You end up with $I = I$, which is true but useless.
2. **Forgetting to divide by 2.** After step 3 you have $2I$, not $I$.
3. **Sign errors in the second pass.** $\frac{d}{dx}\cos x = -\sin x$, so the second integral is added, not subtracted.
4. **Expecting parts to terminate.** With $x\sin x$ the power of $x$ drops away; with $e^x\sin x$ nothing drops away, so you need the loop. Compare the [integral of x sin x](/integrals/x-sin-x).

The [repeated parts and LIATE](/learn/calculus-2/integration-techniques/repeated-parts-and-liate) lesson practices this loop, and the [integration by parts guide](/blog/integration-by-parts) has more examples.

## Frequently asked questions

### What is the integral of eˣ sin x?

It is $\frac{1}{2}e^x(\sin x - \cos x) + C$.

### What is the integral of eˣ cos x?

It is $\frac{1}{2}e^x(\sin x + \cos x) + C$. The same two-step method works, with the sign of the cosine term flipped.

### Why does integration by parts not end for eˣ sin x?

Neither $e^x$ nor $\sin x$ becomes simpler when differentiated, so parts keeps cycling. After two steps the original integral reappears, and you solve the equation $I = \text{stuff} - I$ for $I$.

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

It is $\frac{e^{2x}(2\sin 3x - 3\cos 3x)}{13} + C$, from the general formula with $a = 2$ and $b = 3$.
