Quick answer:
$$\int xe^{x}\,dx = xe^{x} - e^{x} + C = e^{x}(x - 1) + C$$
The integral of x·e^x is the standard first example of integration by parts, and once you understand it, a whole family of integrals like \( x^2e^x \), \( xe^{3x} \) and \( xe^{-x} \) falls into place. This guide covers why the method works, a second way to find the answer without parts, seven worked examples, the common mistakes, and practice problems with answers.
Why it works: the product rule in reverse
Integration by parts is the product rule run backward, and you can see it directly with this integral. Differentiate \( xe^x \):
$$\frac{d}{dx}\left(xe^x\right) = e^x + xe^x$$
Rearrange to isolate the piece you want: \( xe^x = \frac{d}{dx}(xe^x) - e^x \). Integrating both sides, the first term just gives back \( xe^x \) and the second gives \( e^x \). So the integral is \( xe^x - e^x + C \). The formal method below does exactly this, but in a way that works for integrals where the pattern isn’t so easy to spot.
Step by step with integration by parts
The integrand is a product of a polynomial and an exponential, which is the textbook case for integration by parts:
$$\int u\,dv = uv - \int v\,du$$
Choose \( u \) and \( dv \). By the LIATE order (Logs, Inverse trig, Algebraic, Trig, Exponential), the algebraic \( x \) comes before the exponential, so
$$u = x,\quad dv = e^x\,dx \qquad\Longrightarrow\qquad du = dx,\quad v = e^x$$
Apply the formula.
$$\int xe^x\,dx = xe^x - \int e^x\,dx = xe^x - e^x + C$$
Choosing \( u = x \) is what makes this work: differentiating \( x \) turns it into 1, and the remaining integral is easy.
A second method: educated guessing
Because differentiating \( e^x \) never changes it, you can guess that the answer looks like \( (ax + b)e^x \) and solve for the constants. Differentiating the guess with the product rule gives \( (ax + a + b)e^x \). For this to equal \( xe^x \), you need \( a = 1 \) and \( a + b = 0 \), so \( b = -1 \). The answer, \( (x - 1)e^x \), matches. This method of undetermined coefficients is a handy cross-check, and for higher powers it can be faster than repeated parts.
How to choose u and dv in general
The goal of integration by parts is to trade your integral for a simpler one. Two things must go right. First, you must be able to integrate \( dv \); otherwise you can’t even write down \( v \). Second, \( v\,du \) should be simpler than \( u\,dv \), which usually means \( u \) should get simpler when you differentiate it.
Polynomials are perfect for \( u \): each derivative lowers the degree by one, and eventually they disappear. Exponentials are perfect for \( dv \): they integrate to themselves, up to a constant, so they never get messier. That’s why every integral of the form polynomial times exponential follows the same plan, and why LIATE puts algebraic functions ahead of exponentials. LIATE is a rule of thumb rather than a law, but for this family it never fails.
What if you choose the other way?
With \( u = e^x \) and \( dv = x\,dx \) you’d get \( \frac{x^2}{2}e^x - \int\frac{x^2}{2}e^x\,dx \), which is harder than what you started with. The power of \( x \) went up instead of down, and it would keep going up with every further round. If parts makes things worse, swap your choices.
Check by differentiating
$$\frac{d}{dx}\big(xe^x - e^x\big) = e^x + xe^x - e^x = xe^x \checkmark$$
Worked examples
Example 1 (definite integral). Use the factored form, which is easier to evaluate:
$$\int_0^1 xe^x\,dx = \big[e^x(x-1)\big]_0^1 = 0 - (-1) = 1$$
At the top limit the factor \( x - 1 \) is 0, and at the bottom \( e^0(0 - 1) = -1 \). Subtracting bottom from top gives 1. A quick sketch confirms this is reasonable: the curve rises from 0 to about 2.7 on an interval of length 1.
Example 2 (squared factor). For \( x^2e^x \), apply parts with \( u = x^2 \). That leaves \( \int 2xe^x\,dx \), which is twice the basic integral. Applying parts again (or using the tabular method):
$$\int x^2e^x\,dx = x^2e^x - 2xe^x + 2e^x + C$$
Example 3 (coefficient in the exponent). For \( xe^{2x} \), \( v = \frac12e^{2x} \). The leftover integral \( \int\frac12e^{2x}dx \) brings in a second factor of \( \frac12 \), so the last term has \( \frac14 \):
$$\int xe^{2x}\,dx = \frac{xe^{2x}}{2} - \frac{e^{2x}}{4} + C$$
Example 4 (linear factor). For \( \int(2x + 3)e^x\,dx \), let \( u = 2x + 3 \), so \( du = 2\,dx \) and \( v = e^x \). You get \( (2x + 3)e^x - 2e^x \), which simplifies to
$$\int(2x+3)e^x\,dx = (2x + 1)e^x + C$$
Example 5 (decaying exponential). For \( xe^{-x} \), \( v = -e^{-x} \), and the result is \( -xe^{-x} - e^{-x} + C \). Over \( [0, \infty) \) this improper integral equals exactly 1, because \( xe^{-x} \) goes to 0 as \( x \) grows: the exponential decay beats the linear growth. Formally, you evaluate the antiderivative at a finite upper limit \( b \), which gives \( 1 - (b + 1)e^{-b} \), and then let \( b \) go to infinity. The second term vanishes, leaving 1.
Example 6 (cubic with the tabular method). For \( x^3e^x \), the derivatives of \( x^3 \) are \( 3x^2 \), \( 6x \), 6, 0, and every integral of \( e^x \) is \( e^x \). Pair each entry in the derivative column with the next entry in the integral column, and attach the signs \( +, -, +, - \) in order. Multiply diagonally with alternating signs:
$$\int x^3e^x\,dx = e^x\left(x^3 - 3x^2 + 6x - 6\right) + C$$
Example 7 (logarithmic limit). From 0 to \( \ln 2 \), use \( e^{\ln 2} = 2 \):
$$\begin{aligned} \int_0^{\ln 2}xe^x\,dx &= 2(\ln 2 - 1) - (0 - 1) \\ &= 2\ln 2 - 1 \approx 0.3863 \end{aligned}$$
You can check any of these in the integral calculator.
The tabular shortcut
For \( x^n e^{ax} \), list derivatives of \( x^n \) down one column and integrals of \( e^{ax} \) down another, multiply diagonally, and alternate signs \( +, -, +, \dots \). It’s the same as repeated integration by parts, just faster to write. Stop when the derivative column reaches 0; the polynomial always runs out after \( n + 1 \) rows, which is why these integrals always finish.
Common mistakes
- Choosing \( u = e^x \). That raises the power of \( x \) instead of lowering it. Let the polynomial be \( u \).
- Losing the minus sign. The formula is \( uv - \int v\,du \). Writing \( xe^x + e^x \) gives a function whose derivative is \( xe^x + 2e^x \).
- Forgetting the \( \frac1a \) factors. With \( e^{ax} \), each integration divides by \( a \). For \( xe^{3x} \) the constant term has \( \frac19 \), not \( \frac13 \).
- Guessing \( \frac{x^2}{2}e^x \). You can’t integrate the factors separately. Differentiating that guess gives \( xe^x + \frac{x^2}{2}e^x \), not \( xe^x \).
- Mixing up the signs in the tabular method. The signs alternate starting with plus. A sign error in the middle ruins every term after it.
Where it’s used
In probability, the average waiting time for an exponential distribution with rate \( \lambda \) is the integral of \( x\lambda e^{-\lambda x} \) from 0 to infinity, which equals \( \frac1\lambda \); with \( \lambda = 2 \) the answer is \( \frac12 \). The same integral gives the Laplace transform of \( t \), shows up in solving differential equations with repeated roots, and computes centers of mass for regions shaped by exponential curves. Its logarithmic cousin, the integral of ln x, uses the same parts technique with \( dv = dx \).
Try it yourself
Step-by-step solver·Exact symbolic engine
Interactive Calculus Problem Solver
Derivatives, antiderivatives, definite and improper integrals, and limits. Every answer comes with the rules used, and antiderivatives are verified by differentiating them back.
Input syntax
- Powers
x^2, rootssqrt(x),cbrt(x), absolute value|x| - Implicit multiplication works:
3x sin(2x) sin cos tan sec csc cot,asin acos atan,sinh cosh tanhe^xorexp(x);ln(x)andlog(x)are both the natural log- Constants
piande; bounds acceptinfand-inf
Practice problems
Try these before checking the answers.
- \( \int xe^{3x}\,dx \)
- \( \int_0^2 xe^{x}\,dx \)
- \( \int(x + 1)e^x\,dx \)
- \( \int xe^{-2x}\,dx \)
- \( \int_0^1 x^2e^{x}\,dx \)
- \( \int xe^{x/2}\,dx \)
Answers: (1) \( \frac{xe^{3x}}{3} - \frac{e^{3x}}{9} + C \); (2) \( e^2 + 1 \); (3) \( xe^x + C \); (4) \( -\frac{xe^{-2x}}{2} - \frac{e^{-2x}}{4} + C \); (5) \( e - 2 \); (6) \( 2xe^{x/2} - 4e^{x/2} + C \).
FAQ
Can I use u-substitution instead?
Not for \( xe^x \). Substitution works for \( xe^{x^2} \), because then \( x\,dx \) is part of \( d(x^2) \).
What is the integral of x·e^(x²)?
\( \frac12e^{x^2} + C \), by u-substitution with \( u = x^2 \).
What is the integral of x·e^(−x)?
It’s \( -xe^{-x} - e^{-x} + C \), or \( -(x + 1)e^{-x} + C \). From 0 to infinity it equals 1.
Why do I pick u = x?
Because differentiating \( x \) gives 1, which removes the polynomial, while integrating \( e^x \) keeps it simple. That is the whole idea behind LIATE.
What is the integral of x²·e^x?
\( e^x(x^2 - 2x + 2) + C \), found by applying integration by parts twice.
Is xe^x − e^x the same as e^x(x − 1)?
Yes. Factoring out \( e^x \) gives the same function, and both forms earn full credit. The factored form is usually easier to evaluate at limits.
Related: integral of ln x, derivative of e^2x.
Further reading
- Integration by Parts (Paul’s Online Math Notes) — the derivation of the formula, many examples, and the tabular method.
- Integration Strategy (Paul’s Online Math Notes) — a checklist for deciding when parts, substitution or another technique fits.
Calculators for this topic
Keep learning
Fundamental Theorem of Calculus (Parts 1 and 2) Explained
The Fundamental Theorem of Calculus links derivatives and integrals. Both parts explained with intuition, formulas and worked examples.
Improper Integrals: How to Tell If They Converge or Diverge
Improper integrals have infinite limits or infinite integrands. Learn the limit definition, the p-integral test, comparison, and 6 worked examples.

