Tutorials › Calculus II › Quadratic Polynomial Factors with Exponential Cosines

Repeated and Tabular Parts · Tutorial 69 of 998

Quadratic Polynomial Factors with Exponential Cosines

Use repeated integration by parts to derive and apply a compact formula for quadratic polynomial–exponential cosine integrals.

Intermediate 10 min read

What You'll Learn

  • Identify when the exponential-trigonometric antiderivative formula applies
  • Reduce a quadratic polynomial using its first and second derivatives
  • Resolve the resulting expression into real cosine and sine terms
  • Evaluate quadratic examples with different exponential rates and frequencies
  • Check an antiderivative by differentiating its cosine and sine coefficients
  • Recognize and correct a common sign error in the base integrals

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.

Definition: Let \(P(x)=px^2+qx+r\). A quadratic polynomial–exponential cosine integral is an indefinite integral of \(P(x)e^{ax}\cos(bx)\), where \(p,q,r,a,b\) are real constants. The polynomial has degree less than two if \(p=0\); it is constant if \(p=q=0\).

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

$$ \int e^{ax}\cos(bx)\,dx = \frac{e^{ax}\bigl(a\cos(bx)+b\sin(bx)\bigr)}{D}+C, $$
$$ \int e^{ax}\sin(bx)\,dx = \frac{e^{ax}\bigl(a\sin(bx)-b\cos(bx)\bigr)}{D}+C. $$

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.

Theorem: If \(D=a^2+b^2>0\) and \(P(x)=px^2+qx+r\), then
$$ \int P(x)e^{ax}\cos(bx)\,dx = e^{ax}\bigl(A(x)\cos(bx)-B(x)\sin(bx)\bigr)+C, $$

where

$$ A(x) = \frac{aP(x)}{D} -\frac{(a^2-b^2)P'(x)}{D^2} +\frac{(a^3-3ab^2)P''(x)}{D^3}, $$
$$ B(x) = -\frac{bP(x)}{D} +\frac{2abP'(x)}{D^2} +\frac{(b^3-3a^2b)P''(x)}{D^3}. $$

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

$$ G(x)=e^{\lambda x} \left( \frac{P(x)}{\lambda} -\frac{P'(x)}{\lambda^2} +\frac{P''(x)}{\lambda^3} \right). $$

The product rule gives

$$ G'(x) = e^{\lambda x} \left[ P(x)-\frac{P'(x)}{\lambda}+\frac{P''(x)}{\lambda^2} +\frac{P'(x)}{\lambda}-\frac{P''(x)}{\lambda^2} +\frac{P'''(x)}{\lambda^3} \right]. $$

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

$$ \frac{1}{\lambda}=\frac{a-ib}{D},\qquad \frac{1}{\lambda^2}=\frac{(a^2-b^2)-2iab}{D^2},\qquad \frac{1}{\lambda^3} = \frac{(a^3-3ab^2)+i(b^3-3a^2b)}{D^3}. $$

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

$$ \begin{aligned} A &=\frac{P}{2}-\frac{(1-1)P'}{4} +\frac{(1-3)P''}{8}\\ &=\frac{2x^2-3x+1}{2}+0+\frac{(-2)(4)}{8}\\ &=x^2-\frac{3}{2}x+\frac{1}{2}-1\\ &=x^2-\frac{3}{2}x-\frac{1}{2}, \end{aligned} $$

For \(B\),

$$ \begin{aligned} B &=-\frac{P}{2}+\frac{2P'}{4} +\frac{(1-3)P''}{8}\\ &=-\frac{2x^2-3x+1}{2}+\frac{4x-3}{2}-1\\ &=-x^2+\frac{3}{2}x-\frac{1}{2} +2x-\frac{3}{2}-1\\ &=-x^2+\frac{7}{2}x-3. \end{aligned} $$

Therefore

$$ \int (2x^2-3x+1)e^x\cos x\,dx = e^x\left[ \left(x^2-\frac{3}{2}x-\frac{1}{2}\right)\cos x + \left(x^2-\frac{7}{2}x+3\right)\sin x \right]+C. $$

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,

$$ \begin{aligned} A &=\frac{2P}{5}-\frac{(4-1)P'}{25} +\frac{(8-6)P''}{125}\\ &=\frac{2(x^2+2x+1)}{5} -\frac{3(2x+2)}{25}+\frac{4}{125}\\ &=\frac{2}{5}x^2+\frac{14}{25}x+\frac{24}{125}. \end{aligned} $$

For the sine coefficient,

$$ \begin{aligned} B &=-\frac{P}{5}+\frac{4P'}{25} +\frac{(1-12)P''}{125}\\ &=-\frac{x^2+2x+1}{5} +\frac{4(2x+2)}{25}-\frac{22}{125}\\ &=-\frac{1}{5}x^2-\frac{2}{25}x-\frac{7}{125}. \end{aligned} $$

Thus

$$ \int (x^2+2x+1)e^{2x}\cos x\,dx = e^{2x}\left[ \left(\frac25x^2+\frac{14}{25}x+\frac{24}{125}\right)\cos x + \left(\frac15x^2+\frac{2}{25}x+\frac{7}{125}\right)\sin x \right]+C. $$

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

$$ \begin{aligned} A &=0-\frac{(0-4)(4x-1)}{16}+0 =x-\frac14,\\ B &=-\frac{2P}{4}+0+\frac{(8)(4)}{64} =-\frac{P}{2}+\frac12 =-x^2+\frac12x-1. \end{aligned} $$

Consequently,

$$ \int (2x^2-x+3)\cos(2x)\,dx = \left(x-\frac14\right)\cos(2x) +\left(x^2-\frac12x+1\right)\sin(2x)+C. $$

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

$$ \int (px^2+qx+r)\,dx = \frac{p}{3}x^3+\frac{q}{2}x^2+rx+C. $$

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:

$$ \frac{d}{dx}\left(\frac{e^x(\cos x-\sin x)}{2}\right) = -e^x\sin x, $$

which is not \(e^x\cos x\). With the correct plus sign,

$$ \frac{d}{dx}\left(\frac{e^x(\cos x+\sin x)}{2}\right) = e^x\cos x. $$

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.

Takeaway: For \(D=a^2+b^2>0\), reduce a quadratic \(P\) through \(P'\) and \(P''\), then combine the resulting coefficients as \(e^{ax}(A\cos(bx)-B\sin(bx))\). Differentiate that expression to verify the result.

Check Your Understanding

Use the coefficient formulas and check each proposed antiderivative by differentiation.

  1. For \(P(x)=x^2\), \(a=1\), and \(b=2\), find \(A(x)\) and \(B(x)\).
  2. Why does the formula require \(a\) and \(b\) not to be simultaneously zero?
  3. For \(a=0\) and \(b\ne0\), which of \(A\) and \(B\) may still depend on \(x\)?
  4. State the cosine and sine coefficients obtained by differentiating \(e^{ax}(A\cos(bx)-B\sin(bx))\).
  5. What is the third derivative of a quadratic polynomial, and why does that matter in the derivation?

Test yourself: Calculus II final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon