Why Use a Recurrence?
Integration by parts can reduce an integral containing a polynomial and a trigonometric function to another integral of the same type but with a lower power of \(x\). Rather than repeat the full integration-by-parts calculation for every power, we can record that reduction as a recurrence: a formula that expresses a family member in terms of lower-index members and explicit terms.
For polynomial–trigonometric integrals, the power often drops by two when the sine and cosine recurrences are combined. The process therefore ends at a base case involving either a constant or a first power of \(x\). Keeping the frequency and signs visible is essential: both affect the coefficients in the recurrence.
Define the Integral Families
Let \(b\) be a nonzero real number and let \(n\) be a nonnegative integer. We use \(S_n\) and \(C_n\) for particular antiderivatives of the following integrands:
We choose the base antiderivatives \(S_0(x)=-\cos(bx)/b\) and \(C_0(x)=\sin(bx)/b\), and define the higher-index particular antiderivatives using the recurrences derived below. Any other antiderivative of the same integrand differs from the chosen one by an additive constant. The condition \(b\ne 0\) matters because the formulas divide by \(b\); the zero-frequency case has different, simpler integrands.
The base cases follow directly from the elementary antiderivatives of sine and cosine. For \(n=1\), one integration by parts gives formulas that will also serve as the lowest-power checks:
Derive the First-Order Recurrences
For \(S_n\), integrate \(x^n\sin(bx)\) by parts, taking \(u=x^n\) and \(dv=\sin(bx)\,dx\). Then \(du=nx^{n-1}\,dx\) and \(v=-\cos(bx)/b\). For \(n\ge 1\), this gives
For \(C_n\), take \(u=x^n\) and \(dv=\cos(bx)\,dx\), so \(du=nx^{n-1}\,dx\) and \(v=\sin(bx)/b\). The result, again for \(n\ge 1\), is
These formulas are exact for the chosen particular antiderivatives defined from the base cases. If they are used to describe arbitrary indefinite integrals, an additive constant must be included. Each recurrence lowers the polynomial power by one but switches between the sine and cosine families.
Reduce the Power by Two
Substituting one first-order recurrence into the other produces a recurrence involving only sine integrals, or only cosine integrals. For example, when \(n\ge 2\), substitute the formula for \(C_{n-1}\) into the formula for \(S_n\):
For the cosine family, substitute the formula for \(S_{n-1}\) into the formula for \(C_n\). This gives
The two-step reduction is useful because it keeps each calculation within one family. Repeating it eventually reaches \(S_0\) or \(C_0\) when the starting power is even, and \(S_1\) or \(C_1\) when the starting power is odd. Those are the required base cases.
Worked Examples
Worked Example: Integrate \(x^2\sin(2x)\)
Here \(n=2\) and \(b=2\). Use the two-step sine recurrence, ending at \(S_0\):
Thus the indefinite integral is the expression above plus \(C\). Check by differentiating its terms:
Adding these derivatives cancels the \(x\cos(2x)\) and \(\sin(2x)\) terms, leaving \(x^2\sin(2x)\), as required.
Worked Example: Integrate \(x^3\cos(x)\)
Set \(b=1\) and use the two-step cosine recurrence. Because the power is odd, the reduction ends at \(C_1\):
Here \(C_1=x\sin(x)+\cos(x)\), obtained from the first-order recurrence or the stated base formula. Differentiate the result, using the product rule on both terms:
The sine terms cancel. The cosine terms combine to \((x^3-6x+6x)\cos(x)=x^3\cos(x)\). Therefore the antiderivative is correct, up to an arbitrary constant.
Worked Example: Integrate \(x^4\cos(x)\)
Now \(n=4\) and \(b=1\). First reduce to \(C_2\), then use the even-power base case:
Substitute the expression for \(C_2\) into \(C_4\), multiplying each term by \(-12\):
To check, let \(A=x^4-12x^2+24\) and \(B=4x^3-24x\). The derivative of \(A\sin(x)+B\cos(x)\) is \((A'-B)\sin(x)+(A+B')\cos(x)\). Here \(A'=4x^3-24x=B\) and \(B'=12x^2-24\), so
This confirms the antiderivative. The check also shows why it is useful to collect the sine and cosine coefficients before differentiating.
A Reliable Recurrence Procedure
When using these formulas, identify the family, frequency, and starting power before substituting. Then reduce the index in steps of two until a base case is reached. A short record of the procedure helps prevent a dropped factor or a sign error:
Write down whether the integral is in the \(S_n\) or \(C_n\) family, the integer \(n\), and the nonzero frequency \(b\).
Keep the terms involving \(b\) and \(b^2\) in the same positions as in the formula.
Use \(S_0,C_0,S_1,\) or \(C_1\), as determined by the parity of \(n\).
Use the product rule and confirm that all extra sine and cosine terms cancel.
Common Pitfall: Losing the Sign or a Factor of \(b\)
A frequent error is to use a positive cosine term in \(S_0\). Since the derivative of \(\cos(bx)\) is \(-b\sin(bx)\), the correct base antiderivative is \(-\cos(bx)/b\), not \(+\cos(bx)/b\). For example, the incorrect choice would give
which has the wrong sign. The correction is
A related mistake is to forget that differentiating \(\sin(bx)\) or \(\cos(bx)\) introduces a factor of \(b\). This is why the first integration produces \(1/b\), and the two-step recurrence contains \(1/b^2\). A useful final check is to differentiate the proposed expression rather than relying only on visual pattern matching.
Why the Recurrences Matter
Each recurrence captures the same integration-by-parts mechanism in a reusable form. The first-order versions switch between sine and cosine while lowering the power by one. The two-step versions lower the power by two without changing families, which gives a direct route to the base cases. This makes the calculation systematic for any nonnegative integer power, rather than a collection of unrelated formulas.
The recurrences also make assumptions explicit. They require an integer power \(n\ge 1\) for the first-order formulas, \(n\ge 2\) for the two-step formulas, and \(b\ne 0\) throughout. At \(n=0\) or \(n=1\), use the base cases instead of applying a recurrence with an index below zero. Once the antiderivative is obtained, differentiating it checks both the coefficients and the signs.
Check Your Understanding
Try each question by writing the relevant recurrence before substituting values.
- State the first-order recurrence for \(S_n\) and identify the restrictions on \(n\) and \(b\).
- Use the two-step recurrence to express \(S_4\) in terms of \(S_2\) and explicit trigonometric terms.
- Why does the two-step recurrence reduce the index by two rather than by one?
- Which base case is needed to evaluate \(C_5\), and why?
- Differentiate \(S_0=-\cos(bx)/b\) to verify its integrand.