From Recurrence to Reliable Evaluation
Integrals of a polynomial times a sine or cosine function are well suited to repeated integration by parts. The polynomial degree decreases each time, so the process terminates after finitely many steps. The main challenge is not the number of steps; it is keeping the sine and cosine integrals, signs, frequency factors, and endpoint terms consistent.
This workshop uses the coupled recurrences for \(x^n\sin(bx)\) and \(x^n\cos(bx)\) to evaluate both indefinite and definite integrals. The frequency \(b\) is assumed to be a nonzero real number, and \(n\) is a nonnegative integer. If \(b=0\), the trigonometric factor is constant or zero, so these formulas, which divide by \(b\), do not apply.
The Coupled Reduction Formulas
Integration by parts gives a formula for \(I_n\) in terms of \(J_{n-1}\), and a second formula for \(J_n\) in terms of \(I_{n-1}\). For \(n\geq 1\), the indefinite forms are understood up to an arbitrary additive constant:
The sign in the second formula is negative because the antiderivative of \(\sin(bx)\) is \(-\cos(bx)/b\). The frequency \(b\) appears in the denominator because differentiating or integrating a trigonometric function with argument \(bx\) introduces a factor of \(b\).
The base cases are immediate:
For a definite integral over \([a,c]\), integration by parts includes the evaluated boundary term. The formulas are
Here \([F(x)]_a^c\) means \(F(c)-F(a)\). It is not enough to substitute the upper endpoint alone: both endpoint values must be included.
Why the Recurrences Work
To derive the sine formula, choose \(u=x^n\) and \(dv=\sin(bx)\,dx\). Then \(du=nx^{n-1}\,dx\) and \(v=-\cos(bx)/b\). The integration-by-parts identity \(\int u\,dv=uv-\int v\,du\) gives
For the cosine formula, take \(u=x^n\) and \(dv=\cos(bx)\,dx\). In this case \(v=\sin(bx)/b\), so
These calculations also explain the definite versions: evaluate the \(uv\) term at \(c\) and \(a\), then retain the remaining integral over \([a,c]\). Each reduction lowers the polynomial degree by one. The two formulas alternate between sine and cosine, and the process reaches the base cases after finitely many reductions.
Worked Example: An Indefinite Sine Integral
Worked Example: Reduce \(\int x^3\sin(2x)\,dx\)
Let \(I_3=\int x^3\sin(2x)\,dx\) and \(J_2=\int x^2\cos(2x)\,dx\). Use the sine recurrence with \(n=3\) and \(b=2\):
Now reduce \(J_2\):
To find \(I_1\), apply the sine recurrence once more, then use the cosine base case:
Substitute this result into \(J_2\), then substitute \(J_2\) into \(I_3\):
Check by differentiating each term. The derivatives are, in order, \(-\frac32x^2\cos(2x)+x^3\sin(2x)\), \(\frac32x^2\cos(2x)+\frac32x\sin(2x)\), \(\frac34\cos(2x)-\frac32x\sin(2x)\), and \(-\frac34\cos(2x)\). All terms except \(x^3\sin(2x)\) cancel, so the derivative is the required integrand.
Worked Example: A Definite Cosine Integral
Worked Example: Evaluate \(\int_0^\pi x^2\cos(2x)\,dx\)
Apply the definite cosine recurrence with \(n=2\) and \(b=2\):
The boundary term is zero at both endpoints, since \(\sin(2\pi)=\sin(0)=0\). Reduce the remaining integral using the definite sine formula:
The first boundary term is \(-\pi/2-0=-\pi/2\). The remaining integral is
Therefore \(\int_0^\pi x\sin(2x)\,dx=-\pi/2\), and the original integral is \(0-(-\pi/2)=\pi/2\). As a check, an antiderivative is \(\frac{x^2\sin(2x)}2+\frac{x\cos(2x)}2-\frac{\sin(2x)}4\). Its value at \(\pi\) is \(\pi/2\), and its value at \(0\) is \(0\), giving the same result.
Worked Example: A Definite Sine Integral
Worked Example: Evaluate \(\int_0^1 x^2\sin(3x)\,dx\)
First use the definite sine recurrence with \(n=2\) and \(b=3\):
The boundary term is \(-\cos(3)/3-0=-\cos(3)/3\). To evaluate the remaining integral, use the cosine recurrence with \(n=1\):
The first term is \(\sin(3)/3\). The base integral is
Consequently,
For a check, an antiderivative obtained from the recurrence is \(-x^2\cos(3x)/3+2x\sin(3x)/9+2\cos(3x)/27\). Its value at \(1\) is \((-9\cos(3)+6\sin(3)+2\cos(3))/27\), and its value at \(0\) is \(2/27\). Subtracting gives \((6\sin(3)-7\cos(3)-2)/27\), as above.
A Sign Error to Avoid
A frequent mistake is to use a positive sign in the sine recurrence's first term. For example, an incorrect start for \(\int x\sin(2x)\,dx\) is
The error comes from overlooking that an antiderivative of \(\sin(2x)\) is \(-\cos(2x)/2\), not \(+\cos(2x)/2\). The correct calculation is
Differentiating the correct expression gives \(-\cos(2x)/2+x\sin(2x)+\cos(2x)/2=x\sin(2x)\). This check catches the sign error immediately. For definite integrals, also evaluate every bracket as upper endpoint minus lower endpoint; omitting the lower endpoint can change the answer even when the recurrence itself is correct.
Using the Method Efficiently
Before applying the formulas, confirm that \(n\) is a nonnegative integer and \(b\ne0\). Then track the degree reduction and switch between sine and cosine as required. A useful record for each step is the polynomial power, the trigonometric function, and the coefficient generated by \(n/b\). For definite integrals, record the boundary term separately before reducing the remaining integral.
Use the sine formula for an \(x^n\sin(bx)\) integrand and the cosine formula for an \(x^n\cos(bx)\) integrand.
Divide the boundary term by \(b\), and multiply the reduced integral by \(n/b\), retaining the recurrence's stated sign.
The polynomial exponent falls by one at each step, and the trigonometric factor alternates between sine and cosine.
For an indefinite integral, differentiate the proposed antiderivative. For a definite integral, evaluate its antiderivative at both endpoints and subtract.
These checks matter because the recurrences produce several terms whose cancellations may not be obvious. Differentiation confirms an indefinite result locally, while endpoint evaluation confirms that a definite result includes the full contribution from the interval.
Check Your Understanding
Use the recurrences and show the intermediate steps in each calculation.
- State the conditions on \(n\) and \(b\) for the displayed reduction formulas to apply.
- Use the sine recurrence to begin reducing \(\int x^2\sin(4x)\,dx\). Which integral remains after the first step?
- Write the definite cosine recurrence for \(\int_a^c x^n\cos(bx)\,dx\), including its boundary term.
- Evaluate \(\int_0^{\pi/2}\cos(2x)\,dx\) using the base case, showing both endpoint values.
- Why does a derivative check help identify an incorrect sign in an indefinite answer?