A Linear Factor Times an Exponential Sine
Earlier tutorials showed that \(\int e^{ax}\sin bx\,dx\) requires integrating by parts twice and solving for the integral, a cyclic argument. When a linear polynomial \(px+q\) multiplies the integrand, the method still works, but the polynomial must be reduced as well. The efficient plan is to apply integration by parts once to remove the polynomial, which leaves integrals of \(e^{ax}\sin bx\) and \(e^{ax}\cos bx\), and then to use the two cyclic formulas.
Write \(\Delta=a^2+b^2\), which appears in every denominator below. The formulas assume that \(a\) and \(b\) are not both zero, so that \(\Delta>0\).
The Two Cyclic Formulas
Differentiating either formula with the product rule confirms it. For instance, the derivative of \(e^{ax}(a\sin bx-b\cos bx)\) is \(e^{ax}\bigl[a(a\sin bx-b\cos bx)+ab\cos bx+b^2\sin bx\bigr]=e^{ax}\Delta\sin bx\), and dividing by \(\Delta\) gives the integrand.
Deriving the General Result
Let \(u=px+q\) and \(dv=e^{ax}\sin bx\,dx\). Then \(du=p\,dx\) and \(v=\frac{e^{ax}(a\sin bx-b\cos bx)}{\Delta}\). Integration by parts gives
The remaining integral uses both cyclic formulas: \(a\int e^{ax}\sin bx\,dx-b\int e^{ax}\cos bx\,dx=\frac{e^{ax}}{\Delta}\bigl[a(a\sin bx-b\cos bx)-b(a\cos bx+b\sin bx)\bigr]=\frac{e^{ax}\bigl[(a^2-b^2)\sin bx-2ab\cos bx\bigr]}{\Delta}\). Putting the pieces together:
In practice, do not memorize this formula. Learn the two-step procedure and carry the specific numbers through it, as the examples below do.
Worked Examples
Worked Example: a = b = 1
Find \(\int xe^{x}\sin x\,dx\).
Here \(p=1\), \(q=0\), \(a=b=1\), and \(\Delta=2\). Then \(a^2-b^2=0\) and \(2ab=2\). The first bracket of the general formula is \(a(px+q)-\frac{p(a^2-b^2)}{\Delta}=x\), and the second is \(b(px+q)-\frac{2abp}{\Delta}=x-1\). Therefore the antiderivative is \(\frac{e^x}{2}\bigl[x\sin x-(x-1)\cos x\bigr]\), or
Differentiating confirms the answer: the product rule produces \(\frac{e^x}{2}\bigl[x\sin x+(1-x)\cos x+\sin x+x\cos x-\cos x-(1-x)\sin x\bigr]\), and the bracket simplifies to \(2x\sin x\).
Worked Example: A Decaying Exponential
Find \(\int(2x+1)e^{-x}\sin2x\,dx\).
Here \(p=2\), \(q=1\), \(a=-1\), \(b=2\), and \(\Delta=5\). Then \(a^2-b^2=-3\) and \(2ab=-4\). The first bracket is \(a(px+q)-\frac{p(a^2-b^2)}{\Delta}=-(2x+1)+\frac65=-2x+\frac15\), and the second is \(b(px+q)-\frac{2abp}{\Delta}=2(2x+1)+\frac85=4x+\frac{18}{5}\). Multiplying through by \(\frac{1}{\Delta}=\frac15\) and clearing fractions gives
The decay of the exponential means the antiderivative also decays, and the linear factors dominate the amplitude at large \(x\).
Worked Example: A Growing Exponential
Find \(\int(x-3)e^{2x}\sin x\,dx\).
Here \(p=1\), \(q=-3\), \(a=2\), \(b=1\), and \(\Delta=5\). The first bracket is \(2(x-3)-\frac35=2x-\frac{33}{5}\), and the second is \((x-3)-\frac45=x-\frac{19}{5}\). Dividing by \(\Delta=5\) and clearing fractions gives
The fractions \(\frac{33}{5}\) and \(\frac{19}{5}\) come from combining the constant \(q=-3\) with the correction terms, which is where arithmetic slips are most common. Differentiating the answer is the safest check.
Worked Example: A Definite Integral
Evaluate \(\int_0^{\pi}xe^{x}\sin x\,dx\).
Using the first example, at \(x=\pi\) we have \(\sin\pi=0\) and \(\cos\pi=-1\), so the bracket equals \(-(1-\pi)=\pi-1\). At \(x=0\) the bracket equals \(1\). Therefore
The large value reflects the growth of \(e^x\) over \([0,\pi]\), where \(e^\pi\approx23.1\).
A Reliable Procedure
Read off \(p,q,a,b\) and compute \(\Delta=a^2+b^2\).
Take \(u=px+q\) and \(dv=e^{ax}\sin bx\,dx\).
\(v=\frac{e^{ax}(a\sin bx-b\cos bx)}{\Delta}\).
Apply both cyclic formulas, then divide by \(\Delta\) again.
Confirm that all non-polynomial terms recombine to \((px+q)e^{ax}\sin bx\).
Common Mistakes
The leading mistakes are forgetting that \(\Delta\) appears squared in the correction term, mixing the signs in \(a\sin bx-b\cos bx\), and dropping the factor \(p\) in front of the reduction integral. Another is to skip the check: with four parameters in the formula, a sign slip is very likely, and differentiation catches it quickly. It also helps to keep fractions until the last step and clear them only once, so that the common denominator \(\Delta^2\) is handled in one place rather than in several.
Practice Problems with Answers
Try each problem before reading the answer. Every answer below was checked by differentiation or by numerical integration.
- Find an antiderivative of \(xe^x\sin x\). Hint: here \(\Delta=2\). Answer: \(\frac{e^x}{2}[x\sin x+(1-x)\cos x]\)
- Evaluate \(\int_0^{\pi}xe^x\sin x\,dx\). Hint: use \(\sin\pi=0\), \(\cos\pi=-1\). Answer: \(\frac{e^\pi(\pi-1)}{2}-\frac12\)
- Find an antiderivative of \((x-3)e^{2x}\sin x\). Hint: here \(\Delta=5\). Answer: \(\frac{e^{2x}}{25}[(10x-33)\sin x+(19-5x)\cos x]\)
- Evaluate \(\int_0^{\pi}(2x+1)e^{-x}\sin2x\,dx\). Hint: evaluate the second example at \(0\) and \(\pi\). Answer: \(\frac{2}{25}\bigl(9-(10\pi+9)e^{-\pi}\bigr)\approx0.580\)
Why the Answer Has This Form
Every antiderivative in this family has the shape \(e^{ax}\bigl[(Ax+B)\sin bx+(Cx+D)\cos bx\bigr]\) with constants \(A,B,C,D\). The exponential and the trigonometric pair are preserved by differentiation, and the linear factor stays linear. This suggests a second method, undetermined coefficients: assume that shape, differentiate, and match coefficients of \(xe^{ax}\sin bx\), \(xe^{ax}\cos bx\), \(e^{ax}\sin bx\), and \(e^{ax}\cos bx\) with those of the integrand. It yields four linear equations and the same answer. The parts method is faster to carry out by hand, but the form tells you what to expect and helps when checking.
Special Cases
If \(a=0\), the integrand is \((px+q)\sin bx\), and \(\Delta=b^2\). The general formula reduces to \(-\frac{(px+q)\cos bx}{b}+\frac{p\sin bx}{b^2}\), which is the familiar result from a single parts step. If \(b=0\), the integrand is zero and the formula degenerates, so the case does not arise. If \(p=0\), the polynomial is constant and the formula returns \(q\) times the cyclic formula.
A Numerical Spot Check
Test the first example at \(x=1\). The integrand \(xe^x\sin x\) equals \(e\sin1=2.7183\cdot0.8415=2.287\). The derivative of the antiderivative \(\frac{e^x}{2}[x\sin x+(1-x)\cos x]\) at \(x=1\) is, by the computation in that example, \(\frac{e}{2}\cdot2\sin1=e\sin1\), which matches. A single-point check like this does not prove the formula, but a mismatch would reveal an error immediately, and it takes only a few seconds.
For a definite integral, a rough numerical estimate is also reassuring. The integral \(\int_0^\pi xe^x\sin x\,dx\approx24.3\) can be compared with a Simpson estimate from the values \(0\), \(\frac\pi2e^{\pi/2}\approx7.56\), and \(0\) at \(0\), \(\frac\pi2\), and \(\pi\): \(\frac{\pi/2}{3}(0+4\cdot7.56+0)\approx15.8\). The coarse rule is low because the integrand peaks beyond \(\frac\pi2\), where the exponential growth is larger, but it is the right order of magnitude. A finer rule with more points would close the gap, and any error in the exact answer of the size of a missing factor of \(2\) or \(e\) would show up even at this coarse level.
Where This Fits in the Course
This tutorial belongs to the module “Repeated and Tabular Parts”. The tutorial just before it is “Deriving Recurrences for Exponential-Trigonometric Moments,” and the one that follows is “Quadratic Polynomial Factors with Exponential Cosines.” It combines the polynomial reduction of tabular parts with the cyclic argument you have already used.
Check Your Understanding
Use the procedure and examples above to answer these questions.
- What is \(\Delta\) for \(e^{3x}\sin 4x\)?
- Why does one integration by parts remove the linear factor?
- Evaluate \(\int_0^\pi xe^x\sin x\,dx\).
- Which cyclic formula is needed for the leftover integral?
- Differentiate \(\frac{e^x}{2}[x\sin x+(1-x)\cos x]\) and confirm that the result is \(xe^x\sin x\).