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.
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.
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 derivatives | Successive antiderivatives | Diagonal 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.
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:
The diagonal products are \(x\sin x\) and \(-1(-\cos x)\), with the second product carrying a minus sign. Thus
Check by differentiating:
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
Apply the signs to the diagonal products:
To check, differentiate the simplified expression:
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:
Use the alternating signs with the cosine antiderivative cycle:
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
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
Differentiate to verify all terms:
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.
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.
Continue until the derivative is zero; a degree-\(n\) polynomial has no nonzero derivative beyond the \(n\)th.
For cosine, begin with \(\sin x\), then use \(-\cos x\), \(-\sin x\), and \(\cos x\), repeating the cycle as needed.
Use \(+,-,+,-,\ldots\), remembering that the antiderivative entries may themselves be negative.
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.
- What are the first five entries in the successive-antiderivative sequence beginning with the first antiderivative of \(\cos x\)?
- Evaluate \(\int (x+3)\cos x\,dx\).
- Evaluate \(\int (x^2-2x)\cos x\,dx\).
- Why does the tabular sum stop after finitely many nonzero polynomial derivatives?
- Differentiate \(x^3\sin x+3x^2\cos x-6x\sin x-6\cos x\) and identify the integrand.