Tutorials › Calculus II › Solving Cyclic Trigonometric Recurrences

Reduction Formulas · Tutorial 85 of 998

Solving Cyclic Trigonometric Recurrences

Build and solve paired sine-cosine recurrences, then verify the resulting polynomial antiderivatives by differentiation.

Intermediate 10 min read

What You'll Learn

  • Define paired recurrences for polynomial-weighted sine and cosine antiderivatives.
  • Track signs and polynomial degrees as each recurrence reduces the problem.
  • Resolve the alternating sine-cosine cycle with a finite polynomial calculation.
  • Derive compact antiderivative formulas for polynomial weights.
  • Check results by differentiation and identify a common sign error.

Why Pair Sine and Cosine Integrals?

Integration by parts applied to a polynomial times sine produces a cosine integral; applied to a polynomial times cosine, it produces a sine integral. These two calculations are linked. Treating them as a pair makes the alternating pattern easier to follow and gives a reliable way to reduce the polynomial degree until the calculation stops.

For example, integrating \(x^n\sin x\) by parts leaves an integral involving \(x^{n-1}\cos x\). Integrating that cosine integral by parts returns to a sine integral, now with a polynomial of still lower degree. The trigonometric functions cycle, but the polynomial degree decreases. That decrease is what makes the method terminate.

The Paired Recurrences

For a nonnegative integer \(n\), write \(S_n\) for an antiderivative of \(x^n\sin x\), and \(C_n\) for an antiderivative of \(x^n\cos x\). These antiderivatives are understood up to an additive constant. For \(n\geq 1\), integration by parts gives the paired recurrences below. The starting cases follow by direct integration.

Paired recurrences: For \(n\geq 1\), $$ S_n=-x^n\cos x+nC_{n-1}, \qquad C_n=x^n\sin x-nS_{n-1}. $$ The starting cases are \(S_0=-\cos x\) and \(C_0=\sin x\). Any final antiderivative may include an arbitrary constant.

For the first recurrence, take \(u=x^n\) and \(dv=\sin x\,dx\). Then \(du=nx^{n-1}\,dx\) and \(v=-\cos x\), giving \(S_n=-x^n\cos x+nC_{n-1}\). For the second, take \(u=x^n\) and \(dv=\cos x\,dx\). Then \(v=\sin x\), giving \(C_n=x^n\sin x-nS_{n-1}\).

Each recurrence lowers the polynomial degree by one, while alternating between sine and cosine. Substituting one recurrence into the other can lower the degree by two at a time. This is the key stopping mechanism: after finitely many substitutions, only the starting cases remain.

Worked Example: Integrating \(x^3\sin x\)

Worked Example: Integrating \(x^3\sin x\)

Use \(S_3=-x^3\cos x+3C_2\). The cosine recurrence gives \(C_2=x^2\sin x-2S_1\), and \(S_1=-x\cos x+C_0=-x\cos x+\sin x\). Substitution, shown one step at a time, yields $$ \begin{aligned} S_1&=-x\cos x+\sin x,\\ C_2&=x^2\sin x-2(-x\cos x+\sin x)\\ &=x^2\sin x+2x\cos x-2\sin x,\\ S_3&=-x^3\cos x+3(x^2\sin x+2x\cos x-2\sin x)\\ &=-x^3\cos x+3x^2\sin x+6x\cos x-6\sin x. \end{aligned} $$ Therefore an antiderivative is \(-x^3\cos x+3x^2\sin x+6x\cos x-6\sin x+C\). Differentiating the nonconstant terms gives $$ \begin{aligned} \frac{d}{dx}(-x^3\cos x+3x^2\sin x+6x\cos x-6\sin x) &=(-3x^2\cos x+x^3\sin x)\\ &\quad +(6x\sin x+3x^2\cos x)\\ &\quad +(6\cos x-6x\sin x)-6\cos x\\ &=x^3\sin x. \end{aligned} $$ The derivative equals the integrand, as required.

Resolving the Cycle for a General Polynomial

The paired recurrences can be used directly, as in the example. A second approach makes the alternating pattern explicit by seeking polynomial coefficients for the sine and cosine terms. This approach also shows the algebraic step that resolves the cycle without leaving an unknown integral on either side.

Let \(P\) be a polynomial and seek an antiderivative of \(P(x)\sin x\) in the form \(A(x)\sin x+B(x)\cos x\), where \(A\) and \(B\) are polynomials. Differentiating gives $$ \frac{d}{dx}(A\sin x+B\cos x) =(A'-B)\sin x+(A+B')\cos x. $$ For this derivative to equal \(P\sin x\), the coefficients must satisfy $$ A'-B=P,\qquad A+B'=0. $$ The first equation gives \(B=A'-P\). Differentiating it and substituting into the second equation produces $$ A+A''=P'. $$ This is the algebraic cycle: the coefficient \(A\) is related to its second derivative. Because \(P\) is a polynomial, repeated differentiation eventually gives zero, so this equation can be resolved by a finite sum.

Theorem: If \(P\) is a polynomial, an antiderivative of \(P(x)\sin x\) is $$ \bigl(P'-P'''+P^{(5)}-\cdots\bigr)\sin x +\bigl(-P+P''-P^{(4)}+\cdots\bigr)\cos x. $$ Continue each sum only as long as the indicated derivatives are nonzero. An antiderivative of \(P(x)\cos x\) is $$ \bigl(P-P''+P^{(4)}-\cdots\bigr)\sin x +\bigl(P'-P'''+P^{(5)}-\cdots\bigr)\cos x. $$ Again, the sums terminate because sufficiently high derivatives of a polynomial vanish.

To justify the sine formula, set \(A=P'-P'''+P^{(5)}-\cdots\) and \(B=-P+P''-P^{(4)}+\cdots\). The alternating terms cancel in \(A+A''\), leaving \(P'\). Since \(B=A'-P\), we have \(A'-B=P\), and \(A+A''=P'\) implies \(A+B'=0\). The differentiated expression is therefore \(P\sin x\).

For the cosine formula, use the same derivative identity and require \(A'-B=0\) and \(A+B'=P\). These equations give \(B=A'\) and \(A+A''=P\). The finite choice \(A=P-P''+P^{(4)}-\cdots\) satisfies this equation, and \(B=A'=P'-P'''+P^{(5)}-\cdots\). Substitution into the derivative identity gives \(P\cos x\). This proves both formulas.

Worked Example: Resolving the Polynomial Cycle for \(x^3\sin x\)

Worked Example: Resolving the Polynomial Cycle for \(x^3\sin x\)

Take \(P(x)=x^3\). The coefficient equation is \(A+A''=P'=3x^2\). Since \(P'''=6\) and the next derivative is zero, the finite alternating sum gives $$ A=P'-P'''=3x^2-6. $$ Then \(B=A'-P=6x-x^3\). Thus a proposed antiderivative is $$ F(x)=(3x^2-6)\sin x+(6x-x^3)\cos x. $$ Differentiate each term: $$ \begin{aligned} F'(x) &=6x\sin x+(3x^2-6)\cos x\\ &\quad +(6-3x^2)\cos x-(6x-x^3)\sin x\\ &=x^3\sin x. \end{aligned} $$ The cosine terms cancel, and \(6x\sin x-(6x-x^3)\sin x=x^3\sin x\). The derivative check confirms the antiderivative.

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

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

Start with \(C_4=x^4\sin x-4S_3\), using the already established recurrence for \(S_3\). Substituting that expression gives $$ \begin{aligned} C_4 &=x^4\sin x-4(-x^3\cos x+3x^2\sin x+6x\cos x-6\sin x)\\ &=x^4\sin x+4x^3\cos x-12x^2\sin x-24x\cos x+24\sin x. \end{aligned} $$ To check, differentiate: $$ \begin{aligned} \frac{d}{dx}(&x^4\sin x+4x^3\cos x-12x^2\sin x-24x\cos x+24\sin x)\\ &=4x^3\sin x+x^4\cos x\\ &\quad +12x^2\cos x-4x^3\sin x\\ &\quad -24x\sin x-12x^2\cos x\\ &\quad -24\cos x+24x\sin x+24\cos x\\ &=x^4\cos x. \end{aligned} $$ All terms other than \(x^4\cos x\) cancel.

When the Recurrences Are Useful

The paired recurrences are especially useful when a polynomial weight makes repeated integration by parts manageable and a clear stopping rule is needed. They tell you which lower-degree integral appears next, and they make the alternating signs visible. For indefinite integrals, the result is a polynomial combination of sine and cosine plus a constant. For definite integrals, apply the same recurrences to antiderivatives and then evaluate the resulting boundary terms at the specified endpoints.

For a general polynomial \(P\), the finite-sum formulas can be quicker than repeatedly writing the recurrences. The recurrence is often easier to derive and apply when the polynomial is a simple power; the finite-sum form can make the overall pattern clearer for a higher-degree polynomial. Both methods rely on polynomial derivatives eventually vanishing.

Key check: A proposed antiderivative is correct only if differentiating it returns the original integrand. In these problems, cancellation between sine and cosine terms is an important part of that check, not a reason to skip it.

A Common Sign Error

The cosine recurrence has a minus sign: \(C_n=x^n\sin x-nS_{n-1}\). Losing that sign changes terms in the final answer. For instance, the expression $$ -x^3\cos x+3x^2\sin x-6x\cos x+6\sin x $$ is not an antiderivative of \(x^3\sin x\). Differentiation gives $$ x^3\sin x+12x\sin x, $$ not \(x^3\sin x\). The correct recurrence calculation gives \(+6x\cos x-6\sin x\) in place of \(-6x\cos x+6\sin x\). Differentiating the corrected expression cancels the extra terms and leaves exactly \(x^3\sin x\).

A practical safeguard is to keep each recurrence on its own line, preserve the minus sign when substituting, and differentiate the final expression. This checks both the algebra and the trigonometric signs.

Check Your Understanding

Use the paired recurrences or the finite polynomial formulas to answer these questions. Check each antiderivative by differentiation.

  1. Write the recurrences for \(S_2\) and \(C_2\) in terms of lower-degree antiderivatives.
  2. Find an antiderivative of \(x^2\cos x\).
  3. For a polynomial \(P\), what equation does the sine coefficient \(A\) satisfy when seeking an antiderivative \(A\sin x+B\cos x\) of \(P\sin x\)?
  4. Why do the finite alternating sums for polynomial-weighted sine and cosine integrals terminate?
  5. Differentiate your answer for \(\int x^3\cos x\,dx\) and verify that it returns \(x^3\cos x\).

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