Tutorials › Calculus II › The Coefficient Pattern for x^n e^(ax)

Repeated and Tabular Parts · Tutorial 54 of 998

The Coefficient Pattern for x^n e^(ax)

Learn how repeated integration by parts creates the coefficient pattern for \(x^n e^{ax}\), and how to apply and check the resulting formula when \(a\ne 0\).

Intermediate 9 min read

What You'll Learn

  • State the conditions under which the formula for the antiderivative of \(x^n e^{ax}\) applies.
  • Derive the coefficient pattern from a recurrence obtained by integration by parts.
  • Explain the roles of the factorials, alternating signs, and powers of \(a\).
  • Apply the formula when \(a\) is positive, negative, or a nonunit value.
  • Check an antiderivative by differentiating it and identify a common coefficient error.

Why a Coefficient Pattern Appears

When a polynomial is multiplied by an exponential, repeated integration by parts reduces the degree of the polynomial one step at a time. For \(x^n e^{ax}\), the process eventually stops because differentiating \(x^n\) repeatedly leads to zero. The terms that accumulate have a predictable pattern: factorials come from successive powers of \(n\), and powers of \(a\) come from repeatedly integrating the exponential.

Recognizing this pattern lets us write an antiderivative for any nonnegative integer power \(n\), without rebuilding a tabular integration calculation from scratch each time. The parameter \(a\) must be nonzero for the formula below, because its coefficients contain powers of \(1/a\).

Definition: Let \(n\) be a nonnegative integer and \(a\) a nonzero real number. The integrand \(x^n e^{ax}\) is a monomial multiplied by an exponential with constant rate \(a\). Its antiderivative is \[ \int x^n e^{ax}\,dx = e^{ax}\sum_{k=0}^{n}(-1)^k\frac{n!}{(n-k)!\,a^{k+1}}x^{n-k}+C. \] Here \(C\) is an arbitrary constant, and \(0!=1\).

The finite sum is the coefficient pattern of interest. Written term by term, it begins

$$ e^{ax}\left( \frac{x^n}{a} -\frac{n x^{n-1}}{a^2} +\frac{n(n-1)x^{n-2}}{a^3} -\frac{n(n-1)(n-2)x^{n-3}}{a^4} +\cdots \right)+C. $$

The sum ends with a constant term inside the parentheses, namely \((-1)^n n!/a^{n+1}\). At the \(k\)-th term, the factorial ratio \(n!/(n-k)!\) is the product \(n(n-1)\cdots(n-k+1)\); for \(k=0\), that product is empty and the ratio is \(1\). Thus the numerical factors are not simply \(1, n, n^2,\ldots\): they are successive falling products of integers.

Deriving the Formula from Integration by Parts

Repeated integration by parts gives a recurrence. To avoid ambiguity about constants while deriving it, let \(J_n\) denote a particular antiderivative of \(x^n e^{ax}\). The integration-by-parts identity \(\int u\,dv=uv-\int v\,du\), applied with \(u=x^n\) and \(dv=e^{ax}\,dx\), gives the recurrence below for \(n\ge 1\). Since an antiderivative of \(e^{ax}\) is \(e^{ax}/a\), the starting case is \(J_0=e^{ax}/a\).

$$ J_n=\frac{x^n e^{ax}}{a}-\frac{n}{a}J_{n-1}, \qquad J_0=\frac{e^{ax}}{a}. $$

Each use of the recurrence contributes one more term. For example, the first substitution produces

$$ J_n = \frac{x^n e^{ax}}{a} -\frac{n x^{n-1}e^{ax}}{a^2} +\frac{n(n-1)}{a^2}J_{n-2}. $$

Continuing in the same way, each substitution supplies an additional factor \(-1/a\), while the polynomial degree supplies the next descending integer. After \(n\) substitutions the remaining antiderivative is \(J_0\), so the expansion terminates:

$$ J_n = e^{ax}\left( \frac{x^n}{a} -\frac{n x^{n-1}}{a^2} +\frac{n(n-1)x^{n-2}}{a^3} -\cdots +(-1)^n\frac{n!}{a^{n+1}} \right). $$

For the term indexed by \(k\), the descending product contains \(k\) factors, from \(n\) down to \(n-k+1\). That product is \(n!/(n-k)!\). There have also been \(k+1\) divisions by \(a\), including the first integration of the exponential, and the sign has changed \(k\) times. These observations give exactly the stated coefficient.

Theorem: For every nonnegative integer \(n\) and every nonzero real number \(a\), \[ \int x^n e^{ax}\,dx = e^{ax}\sum_{k=0}^{n}(-1)^k\frac{n!}{(n-k)!\,a^{k+1}}x^{n-k}+C. \] The formula follows from repeated integration by parts, which stops after \(n\) differentiations of the polynomial.

Why the Formula Differentiates Correctly

The recurrence explains how the formula is found. We can also verify directly why its adjacent terms cancel when differentiated. Define the polynomial

$$ P_n(x)=\sum_{k=0}^{n}c_kx^{n-k}, \qquad c_k=(-1)^k\frac{n!}{(n-k)!\,a^{k+1}}. $$

The proposed antiderivative is \(e^{ax}P_n(x)\). By the product rule, its derivative is \(e^{ax}(aP_n+P_n')\). The term of degree \(n\) in \(aP_n+P_n'\) comes only from \(a c_0x^n\), and \(a c_0=1\), so that term is \(x^n\). For each \(k\) from \(1\) through \(n\), the coefficient of \(x^{n-k}\) has two contributions: \(a c_k\) from \(aP_n\), and \((n-k+1)c_{k-1}\) from differentiating the preceding power in \(P_n\). Their sum is zero:

$$ a c_k+(n-k+1)c_{k-1} = (-1)^k\frac{n!}{(n-k)!\,a^k} + (-1)^{k-1}\frac{n!}{(n-k)!\,a^k} =0. $$

All powers below \(x^n\) therefore cancel, leaving \(aP_n+P_n'=x^n\). Consequently,

$$ \frac{d}{dx}\bigl(e^{ax}P_n(x)\bigr) = e^{ax}\bigl(aP_n(x)+P_n'(x)\bigr) = x^n e^{ax}. $$

This verifies the formula for every allowed \(n\) and \(a\), not only for a particular example.

Worked Examples

Worked Example: Integrate \(x^3e^{2x}\)

Here \(n=3\) and \(a=2\), so the four terms correspond to \(k=0,1,2,3\). Substituting into the formula gives

$$ \begin{aligned} \int x^3e^{2x}\,dx &=e^{2x}\left( \frac{x^3}{2} -\frac{3x^2}{2^2} +\frac{3\cdot2\,x}{2^3} -\frac{3\cdot2\cdot1}{2^4} \right)+C\\ &=e^{2x}\left( \frac{x^3}{2}-\frac{3x^2}{4} +\frac{3x}{4}-\frac{3}{8} \right)+C. \end{aligned} $$

To check, set \(P(x)=x^3/2-3x^2/4+3x/4-3/8\). Then

$$ \begin{aligned} P'(x)&=\frac{3x^2}{2}-\frac{3x}{2}+\frac34,\\ 2P(x)&=x^3-\frac{3x^2}{2}+\frac{3x}{2}-\frac34,\\ \frac{d}{dx}\bigl(e^{2x}P(x)\bigr) &=e^{2x}\bigl(P'(x)+2P(x)\bigr) =e^{2x}x^3. \end{aligned} $$

The derivative equals the original integrand, as required.

Worked Example: Integrate \(x^4e^{-x}\)

Now \(n=4\) and \(a=-1\). Because \(a\) is negative, its powers affect the signs. Substitution gives

$$ \begin{aligned} \int x^4e^{-x}\,dx &=e^{-x}\left( \frac{x^4}{-1} -\frac{4x^3}{(-1)^2} +\frac{4\cdot3\,x^2}{(-1)^3} -\frac{4\cdot3\cdot2\,x}{(-1)^4} +\frac{4\cdot3\cdot2\cdot1}{(-1)^5} \right)+C\\ &=e^{-x}\left(-x^4-4x^3-12x^2-24x-24\right)+C. \end{aligned} $$

Let \(P(x)=-x^4-4x^3-12x^2-24x-24\). Differentiating the polynomial gives \(P'(x)=-4x^3-12x^2-24x-24\). Since the derivative of \(e^{-x}\) is \(-e^{-x}\), the product rule gives

$$ \begin{aligned} \frac{d}{dx}\bigl(e^{-x}P(x)\bigr) &=e^{-x}\bigl(P'(x)-P(x)\bigr)\\ &=e^{-x}\left[ (-4x^3-12x^2-24x-24) -(-x^4-4x^3-12x^2-24x-24) \right]\\ &=x^4e^{-x}. \end{aligned} $$

This check also shows why a negative \(a\) does not invalidate the formula: its powers are retained in the coefficients, and the cancellations still work.

Worked Example: Integrate \(x^2e^{3x}\)

For \(n=2\) and \(a=3\), there are three terms. The factorial ratio for the last term is \(2!/0!=2\):

$$ \begin{aligned} \int x^2e^{3x}\,dx &=e^{3x}\left( \frac{x^2}{3} -\frac{2x}{3^2} +\frac{2}{3^3} \right)+C\\ &=e^{3x}\left(\frac{x^2}{3}-\frac{2x}{9}+\frac{2}{27}\right)+C. \end{aligned} $$

Let \(P(x)=x^2/3-2x/9+2/27\). Then \(P'(x)=2x/3-2/9\), and

$$ \begin{aligned} 3P(x)&=x^2-\frac{2x}{3}+\frac{2}{9},\\ \frac{d}{dx}\bigl(e^{3x}P(x)\bigr) &=e^{3x}\bigl(P'(x)+3P(x)\bigr)\\ &=e^{3x}\left(\frac{2x}{3}-\frac{2}{9} +x^2-\frac{2x}{3}+\frac{2}{9}\right) =x^2e^{3x}. \end{aligned} $$

The check confirms both the \(1/a^{k+1}\) powers and the factorial factor in the constant term.

A Common Coefficient Error

A frequent mistake is to include the alternating signs and powers of \(a\) but omit the descending factors from differentiating \(x^n\). For instance, an incorrect attempt at \(\int x^2e^{2x}\,dx\) might use

$$ e^{2x}\left(\frac{x^2}{2}-\frac{x}{2^2}+\frac{1}{2^3}\right). $$

Differentiating this proposed answer does not give the integrand. If \(Q(x)=x^2/2-x/4+1/8\), then \(Q'(x)=x-1/4\), and

$$ \frac{d}{dx}\bigl(e^{2x}Q(x)\bigr) =e^{2x}\bigl(Q'(x)+2Q(x)\bigr) =e^{2x}\left(x^2+\frac{x}{2}\right), $$

which contains an unwanted \(x/2\) term. The missing factor is \(n=2\) in the second term and \(2\cdot1\) in the third. The corrected calculation is

$$ \int x^2e^{2x}\,dx =e^{2x}\left(\frac{x^2}{2}-\frac{2x}{2^2} +\frac{2\cdot1}{2^3}\right)+C =e^{2x}\left(\frac{x^2}{2}-\frac{x}{2}+\frac14\right)+C. $$

Indeed, if \(R(x)=x^2/2-x/2+1/4\), then \(R'(x)=x-1/2\) and \(2R(x)=x^2-x+1/2\). Thus \(R'+2R=x^2\), confirming the corrected answer.

Conditions and Practical Use

The formula is intended for \(n=0,1,2,\ldots\) and \(a\ne0\). The finite endpoint of the sum depends on \(n\) being a nonnegative integer: differentiating the monomial eventually gives zero, so the repeated integration-by-parts process ends. If \(a=0\), the displayed formula cannot be used because it divides by powers of \(a\); in that separate case the integrand is \(x^n\), whose antiderivative is \(x^{n+1}/(n+1)+C\).

For a specific problem, first identify \(n\) and \(a\), then write every term through \(k=n\). Keep the powers of \(a\) visible until substituting its value, especially when \(a\) is negative or has magnitude other than \(1\). Finally, differentiate the proposed antiderivative: the exponential factor contributes \(a\), and the polynomial derivative cancels all but the leading \(x^n\).

Key takeaway: The coefficient of \(x^{n-k}e^{ax}\) is \((-1)^k n!/((n-k)!\,a^{k+1})\). The factorial ratio records the successive derivatives of \(x^n\); the alternating sign and power \(a^{k+1}\) record repeated integration of \(e^{ax}\).

Check Your Understanding

Use the coefficient formula, and check proposed antiderivatives by differentiating them.

  1. State the allowed values of \(n\) and \(a\) for the formula.
  2. Write the coefficient of \(x^{n-2}e^{ax}\) in terms of \(n\) and \(a\), when \(n\ge2\).
  3. Use the formula to find an antiderivative of \(xe^{4x}\).
  4. Why does the sum stop after the term indexed by \(k=n\)?
  5. What error results from omitting the descending factorial factors, and how can differentiation reveal it?

Test yourself: Calculus II final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon