Reducing the Polynomial Degree
An integral of a quadratic polynomial multiplied by an exponential cosine can look as if it requires several separate techniques. The useful structure is that differentiating the polynomial reduces its degree, while the exponential and trigonometric factors remain within a small family. Repeated integration by parts can therefore reduce the problem to the basic exponential-sine and exponential-cosine integrals.
We will consider real constants \(p,q,r,a,b\) and integrals of the form \[ \int (px^2+qx+r)e^{ax}\cos(bx)\,dx. \] The main formula applies when \(a\) and \(b\) are not both zero. If both are zero, the exponential and cosine factors are both \(1\), and the integral is an ordinary polynomial integral.
The formula will use both \(P'(x)\) and \(P''(x)\). For this polynomial, \(P'(x)=2px+q\), \(P''(x)=2p\), and \(P'''(x)=0\). That last equality is what makes the repeated reduction stop after a finite number of steps.
The Basic Exponential-Trigonometric Antiderivatives
Set \(D=a^2+b^2\). If \(D>0\), the basic antiderivatives are
Here \(C\) is an arbitrary constant. These formulas include cases where exactly one of \(a\) and \(b\) is zero. For example, if \(b=0\) and \(a\ne0\), the first formula becomes \(\int e^{ax}\,dx=e^{ax}/a+C\). The condition \(D>0\) excludes only \(a=b=0\).
A Formula for the Quadratic Case
To state the result compactly, define two functions \(A(x)\) and \(B(x)\) in terms of \(P\), \(P'\), and \(P''\). The antiderivative is expressed as \(e^{ax}\bigl(A(x)\cos(bx)-B(x)\sin(bx)\bigr)\). The following theorem gives the coefficients explicitly.
where
Because \(P'=2px+q\) and \(P''=2p\), each coefficient is at most linear or quadratic in \(x\), and can be simplified before writing the answer.
Why the Formula Works
A short derivation makes the degree reduction and the signs in the formula easier to follow. Use Euler’s identity \(e^{ibx}=\cos(bx)+i\sin(bx)\), where \(i^2=-1\), and let \(\lambda=a+ib\). Since \(D>0\), \(\lambda\ne0\). The real part of \(e^{\lambda x}P(x)\) is \(e^{ax}P(x)\cos(bx)\). Thus we can first find a complex antiderivative and then take its real part.
Consider
The product rule gives
The terms involving \(P'\) and \(P''\) cancel. Since \(P'''(x)=0\), this leaves \(G'(x)=e^{\lambda x}P(x)\). Taking real parts therefore gives an antiderivative of \(P(x)e^{ax}\cos(bx)\).
To make the real part explicit, the needed reciprocal powers are
Write the expression in parentheses in \(G(x)\) as \(A(x)+iB(x)\). Then \[ \operatorname{Re}\bigl(e^{(a+ib)x}(A+iB)\bigr) =e^{ax}\bigl(A\cos(bx)-B\sin(bx)\bigr). \] Substituting the reciprocal powers above gives exactly the stated formulas for \(A\) and \(B\). This proves the result.
Worked Examples
Worked Example: A Quadratic with \(a=b=1\)
Evaluate \(\int (2x^2-3x+1)e^x\cos x\,dx\). Here \(P=2x^2-3x+1\), \(P'=4x-3\), \(P''=4\), and \(D=1^2+1^2=2\). Substitution into the coefficient formula gives
For \(B\),
Therefore
Check by setting \(A=x^2-\frac32x-\frac12\) and \(B=-x^2+\frac72x-3\), so the expression is \(e^x(A\cos x-B\sin x)\). Its cosine coefficient after differentiation is \(A'+A-B\): \[ \left(2x-\frac32\right)+\left(x^2-\frac32x-\frac12\right)-\left(-x^2+\frac72x-3\right) =2x^2-3x+1. \] Its sine coefficient is \(-A-B-B'\): \[ -\left(x^2-\frac32x-\frac12\right)-\left(-x^2+\frac72x-3\right)-\left(-2x+\frac72\right)=0. \] The derivative is the required integrand.
Worked Example: A Different Exponential Rate
Evaluate \(\int (x^2+2x+1)e^{2x}\cos x\,dx\). Here \(P=x^2+2x+1\), \(P'=2x+2\), \(P''=2\), and \(D=2^2+1^2=5\). First,
For the sine coefficient,
Thus
To check, write the expression as \(e^{2x}(A\cos x-B\sin x)\). Differentiation gives cosine coefficient \(A'+2A-B\) and sine coefficient \(-A-2B-B'\). Substitution yields \[ A'+2A-B=x^2+2x+1,\qquad -A-2B-B'=0. \] Hence the derivative is \((x^2+2x+1)e^{2x}\cos x\).
Worked Example: Zero Exponential Rate
Evaluate \(\int (2x^2-x+3)\cos(2x)\,dx\). Here \(a=0\), \(b=2\), \(P=2x^2-x+3\), \(P'=4x-1\), \(P''=4\), and \(D=4\). The coefficients become
Consequently,
For a check, let \(A=x-\frac14\) and \(K=x^2-\frac12x+1\), so the proposed antiderivative is \(A\cos(2x)+K\sin(2x)\). Its cosine coefficient is \(A'+2K=1+2x^2-x+2=2x^2-x+3\). Its sine coefficient is \(K'-2A=(2x-\frac12)-(2x-\frac12)=0\). The derivative is the stated integrand.
When Both Parameters Are Zero
If \(a=b=0\), then \(D=0\), so the theorem’s formula cannot be used. In this case \(e^{ax}=1\) and \(\cos(bx)=1\), and direct polynomial integration gives
This is not a limitation of integration by parts; it is only the point at which the displayed formula, which divides by powers of \(D\), is undefined.
A Common Sign Error
The sine term in the basic cosine antiderivative has a plus sign: \[ \int e^x\cos x\,dx=\frac{e^x(\cos x+\sin x)}{2}+C. \] A common incorrect version uses a minus sign. Differentiating that incorrect expression shows the problem:
which is not \(e^x\cos x\). With the correct plus sign,
The coefficient check used in the examples is a reliable way to catch this type of error. For an expression \(e^{ax}(A\cos(bx)-B\sin(bx))\), its derivative has cosine coefficient \(A'+aA-bB\) and sine coefficient \(-bA-aB-B'\). The target integral requires the first coefficient to equal \(P\) and the second to equal zero.
Using the Reduction Efficiently
For a new problem, first identify \(P\), \(P'\), \(P''\), and \(D=a^2+b^2\). Confirm \(D>0\), substitute into the two coefficient formulas, and simplify \(A\) and \(B\) before combining them into the antiderivative. This keeps polynomial arithmetic separate from the final trigonometric expression.
The reduction is useful because the polynomial derivatives simplify the work: the original quadratic appears in the first terms, its linear derivative appears in the next terms, and its constant second derivative appears in the final terms. No derivative beyond \(P''\) contributes. The result also makes clear that both cosine and sine terms may appear in the antiderivative, even though the original integrand contains only cosine.
Check Your Understanding
Use the coefficient formulas and check each proposed antiderivative by differentiation.
- For \(P(x)=x^2\), \(a=1\), and \(b=2\), find \(A(x)\) and \(B(x)\).
- Why does the formula require \(a\) and \(b\) not to be simultaneously zero?
- For \(a=0\) and \(b\ne0\), which of \(A\) and \(B\) may still depend on \(x\)?
- State the cosine and sine coefficients obtained by differentiating \(e^{ax}(A\cos(bx)-B\sin(bx))\).
- What is the third derivative of a quadratic polynomial, and why does that matter in the derivation?