Tutorials › Calculus II › Tabular Integrals of Polynomials Times Cosine

Repeated and Tabular Parts · Tutorial 57 of 998

Tabular Integrals of Polynomials Times Cosine

Use a derivative–antiderivative table to integrate polynomial–cosine products, keep the signs straight, and check the result.

Intermediate 10 min read

What You'll Learn

  • Set up a tabular integration table for a polynomial times cosine.
  • Track the repeating antiderivatives of cosine and the diagonal signs.
  • Write the finite tabular formula for a polynomial of degree n.
  • Check a tabular antiderivative by differentiating it.
  • Identify and correct a common sign error.

Why cosine needs careful sign tracking

A polynomial multiplied by a trigonometric function is a natural setting for repeated integration by parts. The polynomial becomes simpler each time it is differentiated, while successive antiderivatives of cosine cycle through sine and cosine with changing signs. A table organizes those two patterns so that the repeated steps can be read systematically.

The key is to track two things separately: the derivatives of the polynomial, and the successive antiderivatives beginning with \(\cos x\). The signs in the diagonal products are also essential. A correct table makes the calculation compact, but checking the final expression by differentiation confirms that every sign and term is right.

Scope: The method here applies to \(P(x)\cos x\), where \(P\) is a polynomial. The cosine factor is \(\cos x\); products involving a different frequency or phase are separate cases.

The tabular pattern

Let \(P(x)\) be a polynomial of degree \(n\). Repeated differentiation eventually gives zero: \(P^{(n+1)}(x)=0\). Meanwhile, starting with \(\cos x\), its successive antiderivatives are \(\sin x\), \(-\cos x\), \(-\sin x\), \(\cos x\), and then the cycle repeats.

For the table, pair the polynomial derivatives with these successive antiderivatives. Put alternating signs \(+,-,+,-,\ldots\) on the diagonal products. Stop after the last nonzero derivative of the polynomial.

Tabular rule: If \(P\) has degree \(n\), then
$$ \int P(x)\cos x\,dx = \sum_{k=0}^{n}(-1)^k P^{(k)}(x)V_{k+1}(x)+C, $$
where \(P^{(0)}=P\), \(V_1(x)=\sin x\), and \(V_{k+1}\) is the next antiderivative in the sequence. Thus \(V_2=-\cos x\), \(V_3=-\sin x\), \(V_4=\cos x\), and the sequence repeats. The constant of integration is \(C\).

In a table, the first antiderivative entry is \(\sin x\), not \(\cos x\), because the diagonal products use antiderivatives of the integrand. The cosine is the starting integrand; its first antiderivative is sine.

Polynomial derivativesSuccessive antiderivativesDiagonal sign
\(P\)\(\sin x\)\(+\)
\(P'\)\(-\cos x\)\(-\)
\(P''\)\(-\sin x\)\(+\)
\(P'''\)\(\cos x\)\(-\)
Continue until the polynomial derivative is zero.The antiderivative cycle repeats.Continue alternating.

Why the table works

The table is a compact way of recording repeated integration by parts. Its correctness can also be seen directly by differentiating the sum. This gives a useful check on the signs and explains why all terms except the original integrand cancel.

Derivation: Write \(V_0(x)=\cos x\), with \(V_{j+1}'(x)=V_j(x)\) for each \(j\geq 0\). Define
$$ F(x)=\sum_{k=0}^{n}(-1)^kP^{(k)}(x)V_{k+1}(x). $$
Differentiating each product gives
$$ F'(x) = \sum_{k=0}^{n}(-1)^kP^{(k+1)}(x)V_{k+1}(x) + \sum_{k=0}^{n}(-1)^kP^{(k)}(x)V_k(x). $$
In the first sum, set \(j=k+1\). Its terms are then \((-1)^{j-1}P^{(j)}V_j\) for \(j=1,\ldots,n+1\). For each \(j=1,\ldots,n\), this cancels the term \((-1)^jP^{(j)}V_j\) in the second sum. The remaining term from the second sum is \(P(x)V_0(x)=P(x)\cos x\). The extra term from the first sum is zero because \(P^{(n+1)}=0\). Therefore \(F'(x)=P(x)\cos x\), which proves that \(F\) is an antiderivative.

This cancellation is the same structure recorded by the alternating diagonal signs. The polynomial degree determines when the process ends: once its derivative is zero, there are no further nonzero diagonal products.

Worked examples

Worked Example: Integrate \(x\cos x\)

Differentiate the polynomial until it reaches zero, and list the antiderivatives of cosine beside it:

$$ \begin{array}{c|c|c} \text{Derivative} & \text{Antiderivative} & \text{Sign}\\ x & \sin x & +\\ 1 & -\cos x & -\\ 0 & & \end{array} $$

The diagonal products are \(x\sin x\) and \(-1(-\cos x)\), with the second product carrying a minus sign. Thus

$$ \int x\cos x\,dx =x\sin x-1(-\cos x) =x\sin x+\cos x+C. $$

Check by differentiating:

$$ \frac{d}{dx}\bigl(x\sin x+\cos x\bigr) =\sin x+x\cos x-\sin x =x\cos x. $$

The derivative is the original integrand.

Worked Example: Integrate \((x^2+2x-1)\cos x\)

Set \(P(x)=x^2+2x-1\). Its derivatives are \(P'(x)=2x+2\), \(P''(x)=2\), and \(P'''(x)=0\). The table gives

$$ \begin{array}{c|c|c} P & \sin x & +\\ 2x+2 & -\cos x & -\\ 2 & -\sin x & +\\ 0 & & \end{array} $$

Apply the signs to the diagonal products:

$$ \begin{aligned} \int (x^2+2x-1)\cos x\,dx &=(x^2+2x-1)\sin x -(2x+2)(-\cos x) +2(-\sin x)+C\\ &=(x^2+2x-3)\sin x+(2x+2)\cos x+C. \end{aligned} $$

To check, differentiate the simplified expression:

$$ \begin{aligned} \frac{d}{dx}\bigl((x^2+2x-3)\sin x+(2x+2)\cos x\bigr) &=(2x+2)\sin x+(x^2+2x-3)\cos x\\ &\quad+2\cos x-(2x+2)\sin x\\ &=(x^2+2x-1)\cos x. \end{aligned} $$

The sine terms cancel, and the remaining cosine coefficient is the original polynomial.

Worked Example: Integrate \((2x^3-3x^2+4x-5)\cos x\)

Let \(P(x)=2x^3-3x^2+4x-5\). Compute each derivative:

$$ P'=6x^2-6x+4,\qquad P''=12x-6,\qquad P'''=12,\qquad P^{(4)}=0. $$

Use the alternating signs with the cosine antiderivative cycle:

$$ \begin{aligned} \int P(x)\cos x\,dx &=P\sin x-P'(-\cos x)+P''(-\sin x)-P'''(\cos x)+C\\ &=(P-P'')\sin x+(P'-P''')\cos x+C\\ &=(2x^3-3x^2-8x+1)\sin x +(6x^2-6x-8)\cos x+C. \end{aligned} $$

For the check, write \(A=2x^3-3x^2-8x+1\) and \(B=6x^2-6x-8\). Then \(A'=6x^2-6x-8=B\) and \(B'=12x-6\). Differentiation gives

$$ \begin{aligned} \frac{d}{dx}\bigl(A\sin x+B\cos x\bigr) &=A'\sin x+A\cos x+B'\cos x-B\sin x\\ &=(A'-B)\sin x+(A+B')\cos x\\ &=(2x^3-3x^2+4x-5)\cos x. \end{aligned} $$

Here \(A'-B=0\), and \(A+B'=2x^3-3x^2+4x-5\), so the check recovers the integrand.

Worked Example: Integrate \(x^4\cos x\)

The derivatives of \(x^4\) are \(x^4\), \(4x^3\), \(12x^2\), \(24x\), \(24\), and then \(0\). The table therefore gives

$$ \begin{aligned} \int x^4\cos x\,dx &=x^4\sin x-4x^3(-\cos x)+12x^2(-\sin x)-24x(\cos x)+24\sin x+C\\ &=x^4\sin x+4x^3\cos x-12x^2\sin x-24x\cos x+24\sin x+C. \end{aligned} $$

Differentiate to verify all terms:

$$ \begin{aligned} \frac{d}{dx}\bigl(&x^4\sin x+4x^3\cos x-12x^2\sin x-24x\cos x+24\sin x\bigr)\\ ={}&4x^3\sin x+x^4\cos x+12x^2\cos x-4x^3\sin x\\ &-24x\sin x-12x^2\cos x-24\cos x+24x\sin x+24\cos x\\ ={}&x^4\cos x. \end{aligned} $$

Every term except \(x^4\cos x\) cancels in the derivative.

A common sign error

The antiderivative column already contains negative entries, such as \(-\cos x\). Those signs must be combined with the separate alternating diagonal signs. Treating the negative entry as if it were \(+\cos x\), or forgetting to subtract the product in the second row, changes the answer.

Common mistake: For \(\int x\cos x\,dx\), an incorrect sign choice is \(x\sin x-\cos x\). Its derivative is
$$ \frac{d}{dx}(x\sin x-\cos x) =\sin x+x\cos x+\sin x =x\cos x+2\sin x, $$
which is not the integrand. The second table entry is \(-\cos x\), and the diagonal sign is minus, so the correct product is \(-1(-\cos x)=+\cos x\). Thus the correct antiderivative is \(x\sin x+\cos x+C\), whose derivative is \(x\cos x\).

Using the method reliably

Before simplifying, write the derivatives and antiderivatives clearly. This makes it easier to distinguish a sign belonging to an antiderivative from a sign belonging to the diagonal. Then combine like sine terms and like cosine terms only after the full table expression has been written.

1
Differentiate the polynomial.
Continue until the derivative is zero; a degree-\(n\) polynomial has no nonzero derivative beyond the \(n\)th.
2
List successive antiderivatives.
For cosine, begin with \(\sin x\), then use \(-\cos x\), \(-\sin x\), and \(\cos x\), repeating the cycle as needed.
3
Multiply diagonally with alternating signs.
Use \(+,-,+,-,\ldots\), remembering that the antiderivative entries may themselves be negative.
4
Simplify and check.
Collect sine and cosine terms, then differentiate the result and compare it with the original product.

Tabular integration is useful because it turns repeated integration by parts into an organized finite calculation whenever the polynomial factor eventually differentiates to zero. It does not remove the need to track signs: the table is reliable only when both the antiderivative cycle and diagonal signs are recorded correctly.

Check Your Understanding

Use a table for each integral, and differentiate your result to check it.

  1. What are the first five entries in the successive-antiderivative sequence beginning with the first antiderivative of \(\cos x\)?
  2. Evaluate \(\int (x+3)\cos x\,dx\).
  3. Evaluate \(\int (x^2-2x)\cos x\,dx\).
  4. Why does the tabular sum stop after finitely many nonzero polynomial derivatives?
  5. Differentiate \(x^3\sin x+3x^2\cos x-6x\sin x-6\cos x\) and identify the integrand.

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