Combining the Factors
Integrals containing a polynomial multiplied by an exponential and a sine or cosine bring together two useful patterns. The polynomial becomes zero after finitely many derivatives, while the exponential-trigonometric factor has an antiderivative of the same general form as itself. Repeated integration by parts can therefore produce a finite expression rather than an endless chain of new integrals.
The practical order matters. First find an antiderivative of the exponential-trigonometric factor. Then use the polynomial as the factor to differentiate. For a definite integral, evaluate the resulting antiderivative at the upper and lower endpoints only after the algebra is complete.
The Antiderivatives to Start With
For \(a^2+b^2>0\), useful starting antiderivatives are
These formulas can be checked directly. For example, differentiating the numerator in the sine formula gives \(e^{ax}\) times
Dividing by \(a^2+b^2\) leaves \(e^{ax}\sin(bx)\), as required. Differentiating the cosine formula in the same way gives \(e^{ax}\cos(bx)\). The condition \(a^2+b^2>0\) ensures that the denominators are not zero.
Why Repeated Integration by Parts Stops
Integration by parts states that \(\int u\,dv=uv-\int v\,du\), when the functions involved are differentiable and the indicated antiderivative exists. For a polynomial factor, each differentiation lowers its degree; eventually its derivative is zero. This makes repeated integration by parts especially effective here.
The alternating signs and the nested antiderivatives follow from integration by parts. The finite expression is not a separate integration rule to memorize without reason; it is repeated use of that rule.
Take \(G_0\) to be an antiderivative of the exponential times the sine or cosine.
Record \(p,p',p'',\ldots\) until the derivatives reach zero.
Form \(G_0,G_1,\ldots\), with each new function an antiderivative of the preceding one.
Multiply corresponding entries, use signs \(+,-,+,-,\ldots\), and stop when the polynomial derivatives vanish.
This rule can also be justified by differentiating its right-hand side. For each term \( (-1)^k p^{(k)}G_k\), the product rule gives a term \( (-1)^k p^{(k)}G_{k-1}\) when \(k\geq 1\), because \(G_k'=G_{k-1}\). That term cancels the contribution \( (-1)^{k-1}p^{(k)}G_{k-1}\) from the preceding product. All such terms cancel in pairs, leaving \(pG_0'=pf\); the final polynomial derivative is zero. Thus the displayed sum differentiates to the original integrand.
Worked Example: A Quadratic Times an Exponential Sine
Worked Example: A Quadratic Times an Exponential Sine
Find \(\int x^2e^x\sin x\,dx\), and check the result by differentiation.
For \(e^x\sin x\), take \(a=b=1\) in the starting formula. Set
Integrating this function gives the next entries:
Indeed, \(G_0'=e^x\sin x\), \(G_1'=G_0\), and \(G_2'=G_1\). The polynomial derivatives are \(p=x^2\), \(p'=2x\), \(p''=2\), and \(p'''=0\). Apply the alternating signs:
To check, differentiate the three nonconstant terms. Differentiating \(x^2G_0\) gives \(2xG_0+x^2e^x\sin x\). Differentiating \(-2xG_1\) gives \(-2G_1-2xG_0\). Differentiating \(2G_2\) gives \(2G_1\). The terms \(2xG_0\) and \(-2xG_0\) cancel, as do \(-2G_1\) and \(2G_1\). The remaining derivative is \(x^2e^x\sin x\).
Worked Example: A Definite Integral and Its Endpoints
Worked Example: A Definite Integral and Its Endpoints
Evaluate \(\int_0^\pi xe^x\cos x\,dx\).
An antiderivative of \(e^x\cos x\) is \(H_0=e^x(\sin x+\cos x)/2\). An antiderivative of \(H_0\) is \(H_1=e^x\sin x/2\). Since \(p=x\) and \(p'=1\), repeated integration by parts gives
Now evaluate the antiderivative at each endpoint. At \(x=\pi\), \(\sin\pi=0\) and \(\cos\pi=-1\), so its value is \(-\pi e^\pi/2\). At \(x=0\), the first term is zero because of its factor \(x\), and the second term is zero because \(\sin 0=0\). Thus the value at \(0\) is \(0\). Therefore
For a check, differentiate \(xH_0-H_1\). Its derivative is \(H_0+xe^x\cos x-H_1'\). Since \(H_1'=H_0\), the \(H_0\) terms cancel, leaving \(xe^x\cos x\). The endpoint subtraction also uses the correct order, upper value minus lower value.
Worked Example: A Shifted Quadratic and a Different Exponent
Worked Example: A Shifted Quadratic and a Different Exponent
Find \(\int (x-1)^2e^{2x}\sin x\,dx\), then verify it by differentiation.
For \(e^{2x}\sin x\) and \(e^{2x}\cos x\), the starting antiderivatives are
Differentiating gives \(S_0'=e^{2x}\sin x\) and \(C_0'=e^{2x}\cos x\). Integrate \(S_0\) once and then twice to obtain
These choices satisfy \(G_1'=S_0\) and \(G_2'=G_1\). For \(p=(x-1)^2\), the derivatives are \(p'=2(x-1)\) and \(p''=2\). Therefore
Substituting the functions gives the fully explicit antiderivative:
To check it without expanding every coefficient, differentiate the three terms in the compact form. The derivative of \((x-1)^2S_0\) is \(2(x-1)S_0+(x-1)^2e^{2x}\sin x\). The derivative of \(-2(x-1)G_1\) is \(-2G_1-2(x-1)S_0\). The derivative of \(2G_2\) is \(2G_1\). The terms involving \(S_0\) and \(G_1\) cancel, leaving exactly \((x-1)^2e^{2x}\sin x\).
A Common Sign Error
The signs in repeated integration by parts alternate. For a quadratic polynomial, the correct pattern is \(+,-,+\). A tempting but incorrect calculation is to write
where \(G_0'=f\), \(G_1'=G_0\), and \(G_2'=G_1\). This uses plus signs where integration by parts requires minus signs. Differentiating the proposed expression gives \(x^2f+4xG_0+4G_1\), not \(x^2f\) in general. The corrected expression is
Differentiation confirms the correction: the extra terms \(2xG_0\) and \(-2xG_0\), and \(-2G_1\) and \(2G_1\), cancel. This check is especially useful when the trigonometric factors make a sign error hard to spot by inspection.
Choosing and Checking a Strategy
When the polynomial is low degree, tabular integration by parts is often the most direct route: it makes the terminating derivatives visible. For a definite integral, the same antiderivative can be used, but endpoint values should be simplified carefully, especially when sine and cosine take exact values at the endpoints. For an indefinite integral, the final check is to differentiate the proposed antiderivative and recover the full original integrand.
Always retain the constant \(C\) for an indefinite integral. For a definite integral, no constant is needed: it cancels in the subtraction of endpoint values. In either case, keep the polynomial derivatives and the successive antiderivatives distinct, and pair them in order. That simple bookkeeping prevents many errors.
Check Your Understanding
Use the repeated-integration-by-parts pattern to answer these questions. Check each proposed antiderivative by differentiation.
- What is the sequence of derivatives of \(p(x)=x^3\), and at what point does it become zero?
- For \(e^{2x}\cos x\), what are the coefficients in its antiderivative’s denominator?
- When \(p(x)=x^2\), what are the signs of the three terms in the tabular expression?
- Why does the expression for \(\int_0^\pi xe^x\cos x\,dx\) use the value at \(\pi\) minus the value at \(0\)?
- What derivative check should an indefinite answer pass before it is accepted?