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

> The integral of x eˣ is (x − 1)eˣ + C. See the integration by parts steps, why u = x is the right choice, a graph and examples like x e^(2x).

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

$$ \int x e^x\,dx = (x - 1)e^x + C $$

## At a glance

- **Antiderivative:** $(x-1)e^x + C$
- **Method:** Integration by parts with $u = x$, $dv = e^x\,dx$
- **From 0 to 1:** $1$
- **With e^(kx):** $\int xe^{kx}\,dx = \left(\frac{x}{k} - \frac{1}{k^2}\right)e^{kx} + C$

## Key takeaways

- The integral of $xe^x$ is $xe^x - e^x + C = (x-1)e^x + C$.
- Use integration by parts with $u = x$. Differentiating $x$ makes it disappear, and $e^x$ is easy to integrate.
- Choosing $u = e^x$ instead makes the leftover integral harder, not easier.
- For $e^{kx}$, the answer is $\left(\frac{x}{k} - \frac{1}{k^2}\right)e^{kx} + C$.

The **integral of $xe^x$ is $(x - 1)e^x + C$**. It is the standard first example of integration by parts: a power of $x$ times an exponential.

$$\int x e^x\,dx = xe^x - e^x + C = (x-1)e^x + C$$

## Graph of x eˣ and its antiderivative

```graph
title: 'y = x eˣ and its antiderivative (x − 1)eˣ'
caption: 'The shaded area from $0$ to $1$ is exactly $1$. The dashed antiderivative has its minimum at $x = 0$, where $xe^x$ crosses from negative to positive.'
x: [-4, 1.4]
y: [-1.5, 5]
functions:
  - expr: x*e^x
    label: y = x eˣ
  - expr: (x-1)*e^x
    label: y = (x − 1)eˣ (antiderivative)
    dashed: true
shade:
  expr: x*e^x
  from: 0
  to: 1
points:
  - [0, -1, '(0, −1)']
  - [1, 2.718, '(1, e)']
```

## How to integrate x eˣ step by step

The formula for [integration by parts](/rules/integration-by-parts-rule) is $\int u\,dv = uv - \int v\,du$.

1. **Choose the parts.** Let $u = x$ and $dv = e^x\,dx$.
2. **Find $du$ and $v$.** $du = dx$ and $v = e^x$.
3. **Apply the formula.**
$$\int xe^x\,dx = xe^x - \int e^x\,dx$$
4. **Finish the easy integral.** $\int e^x\,dx = e^x$, so
$$\int xe^x\,dx = xe^x - e^x + C = (x-1)e^x + C$$

**Why $u = x$?** The goal is a simpler leftover integral. Differentiating $x$ gives $1$, so the $x$ is gone after one step. The LIATE rule (Logs, Inverse trig, Algebraic, Trig, Exponential) says the same thing: algebraic comes before exponential, so $x$ is $u$.

**What if you choose the other way?** With $u = e^x$ and $dv = x\,dx$, you get $\frac{x^2}{2}e^x - \int\frac{x^2}{2}e^x\,dx$. The power of $x$ went up, so the problem got worse.

## Check by differentiating

$$\frac{d}{dx}\Big((x-1)e^x\Big) = 1\cdot e^x + (x-1)e^x = xe^x$$

The [product rule](/rules/product-rule) gives back exactly the integrand. The [derivative of x eˣ](/derivatives/x-e-to-the-x) page shows the forward direction.

## Definite integrals

**From 0 to 1:**

$$\int_0^1 xe^x\,dx = \Big[(x-1)e^x\Big]_0^1 = 0\cdot e - (-1)\cdot 1 = 1$$

**From −∞ to 0:** as $x \to -\infty$, $(x-1)e^x \to 0$ because the exponential wins. So

$$\int_{-\infty}^{0} xe^x\,dx = (0 - 1)e^0 - 0 = -1$$

The answer is negative since $xe^x < 0$ for $x < 0$.

## Worked examples

**Example 1: a faster exponential.** $\int xe^{2x}\,dx$. Let $u = x$, $dv = e^{2x}\,dx$, so $v = \frac{1}{2}e^{2x}$:

$$\int xe^{2x}\,dx = \frac{x}{2}e^{2x} - \frac{1}{2}\int e^{2x}\,dx = \frac{x}{2}e^{2x} - \frac{1}{4}e^{2x} + C$$

In general, $\int xe^{kx}\,dx = \left(\frac{x}{k} - \frac{1}{k^2}\right)e^{kx} + C$.

**Example 2: decay.** With $k = -1$, the general formula gives $\int xe^{-x}\,dx = (-x - 1)e^{-x} + C = -(x+1)e^{-x} + C$. From $0$ to $\infty$ this is $0 - (-1) = 1$. This is the average waiting time in the exponential distribution with rate $1$.

**Example 3: a linear factor.** $\int(3x + 2)e^x\,dx$. With $u = 3x + 2$, $du = 3\,dx$:

$$(3x+2)e^x - 3e^x + C = (3x - 1)e^x + C$$

**Example 4: a higher power.** For $x^2e^x$, use parts twice. The result is $(x^2 - 2x + 2)e^x + C$, shown on the [integral of x² eˣ](/integrals/x-squared-e-to-the-x) page.

## Common mistakes

1. **Integrating factor by factor.** $\int xe^x\,dx \ne \frac{x^2}{2}e^x$. The integral of a product is not the product of the integrals.
2. **Choosing $u = e^x$.** The leftover integral then contains $x^2$, which is harder.
3. **A sign slip in the last step.** It is $xe^x - \int e^x\,dx$, so the $e^x$ term is subtracted. Check by differentiating.
4. **Forgetting $\frac{1}{k}$ for $e^{kx}$.** With $e^{2x}$, $v = \frac{1}{2}e^{2x}$, not $e^{2x}$.

For more practice, see the [integration by parts guide](/blog/integration-by-parts) and the [integration by parts practice problems](/practice-problems/integration-by-parts).

## Frequently asked questions

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

It is $(x - 1)e^x + C$, or $xe^x - e^x + C$.

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

It is $\frac{x}{2}e^{2x} - \frac{1}{4}e^{2x} + C$. Use parts with $u = x$ and $dv = e^{2x}\,dx$, so $v = \frac{1}{2}e^{2x}$.

### What is the integral of x e^(−x)?

It is $-(x+1)e^{-x} + C$. From $0$ to $\infty$ the integral equals $1$.

### Can I use u-substitution for x eˣ?

No. A substitution needs the derivative of the inside to appear as a factor, and there is no inside function here. This is a product of two unrelated functions, which is what integration by parts is for.
