Tutorials › AP Calculus › The Second Derivative Product Rule

Higher Derivatives and Motion · Tutorial 224 of 999

The Second Derivative Product Rule

Learn why the second derivative of a product has three terms, and use the rule to evaluate derivatives of familiar function products.

Intermediate 9 min read

What You'll Learn

  • Derive the second derivative product rule from the ordinary product rule
  • Identify the differentiability conditions needed to use the formula
  • Evaluate second derivatives of polynomial and trigonometric products
  • Apply the rule to products involving exponential functions
  • Check results by differentiating the product directly
  • Recognize and correct the error of omitting the middle term's factor of two

Why a Product Needs Three Terms

A product of two functions changes as either factor changes. To find its first derivative, the product rule accounts for both factors. To find its second derivative, we differentiate those two contributions again. Each differentiation creates additional terms, and one contribution appears twice.

This structure matters whenever a problem asks for the rate of change of a product’s first derivative, or simply asks for a second derivative of a product. Rather than repeatedly expanding the expression, we can use a formula that keeps track of the derivatives of each factor.

Key formula: If \(f\) and \(g\) are twice differentiable on an interval, then their product has second derivative $$ (fg)''=f''g+2f'g'+fg''. $$ All the functions and derivatives on the right are evaluated at the same input.

The middle term is not optional: it accounts for two equal contributions produced when the product rule is applied a second time.

Deriving the Second Derivative Product Rule

Suppose \(f\) and \(g\) are twice differentiable on an interval. Their product is \(h(x)=f(x)g(x)\). By the ordinary product rule, the first derivative is

$$ h'(x)=f'(x)g(x)+f(x)g'(x). $$

Differentiate each term on the right using the product rule again. In the first term, both \(f'\) and \(g\) may vary with \(x\), so its derivative is \(f''g+f'g'\). In the second term, both \(f\) and \(g'\) may vary, so its derivative is \(f'g'+fg''\). Adding these results gives

$$ \begin{aligned} h''(x) &=\frac{d}{dx}\bigl(f'(x)g(x)\bigr) +\frac{d}{dx}\bigl(f(x)g'(x)\bigr)\\ &=\bigl(f''(x)g(x)+f'(x)g'(x)\bigr) +\bigl(f'(x)g'(x)+f(x)g''(x)\bigr)\\ &=f''(x)g(x)+2f'(x)g'(x)+f(x)g''(x). \end{aligned} $$

This derivation explains the coefficient \(2\): the mixed product \(f'g'\) occurs once from differentiating \(f'g\), and once from differentiating \(fg'\). The two equal terms combine. The formula requires both factors to have second derivatives on the interval where it is used, so that the differentiations in the derivation are valid.

When to use it: Identify the two factors in a product, find each factor and its first two derivatives, and substitute them into \(f''g+2f'g'+fg''\). If the question asks for the value at one input, evaluate all six function values there before combining the terms.

A Reliable Calculation Process

The formula is short, but the bookkeeping can be delicate. In particular, \(f''g\) and \(fg''\) are not interchangeable with the middle term: each describes a different way the product’s rate of change can vary. A useful setup is to make a small value list at the specified input before substituting.

1
Name the factors.
Write the product as \(h=fg\), making clear which expression is \(f\) and which is \(g\).
2
Find the derivatives.
Compute \(f'\), \(f''\), \(g'\), and \(g''\), using the standard differentiation rules that apply to those functions.
3
Evaluate at the input.
Find \(f\), \(f'\), \(f''\), \(g\), \(g'\), and \(g''\) at the requested value of \(x\).
4
Substitute and check.
Use \(h''=f''g+2f'g'+fg''\), then verify the result when a direct differentiation is manageable.

Worked Examples

Worked Example: A Polynomial Times a Sine Function

Let \(h(x)=(x^2+1)\sin x\). Find \(h''\left(\frac{\pi}{2}\right)\).

Set \(f(x)=x^2+1\) and \(g(x)=\sin x\). Their derivatives are

$$ f'(x)=2x,\qquad f''(x)=2,\qquad g'(x)=\cos x,\qquad g''(x)=-\sin x. $$

At \(x=\frac{\pi}{2}\), the required values are

$$ \begin{aligned} f\left(\frac{\pi}{2}\right)&=\frac{\pi^2}{4}+1, & f'\left(\frac{\pi}{2}\right)&=\pi, & f''\left(\frac{\pi}{2}\right)&=2,\\ g\left(\frac{\pi}{2}\right)&=1, & g'\left(\frac{\pi}{2}\right)&=0, & g''\left(\frac{\pi}{2}\right)&=-1. \end{aligned} $$

Substitute in the second derivative product rule:

$$ \begin{aligned} h''\left(\frac{\pi}{2}\right) &=f''\left(\frac{\pi}{2}\right)g\left(\frac{\pi}{2}\right) +2f'\left(\frac{\pi}{2}\right)g'\left(\frac{\pi}{2}\right) +f\left(\frac{\pi}{2}\right)g''\left(\frac{\pi}{2}\right)\\ &=(2)(1)+2(\pi)(0)+\left(\frac{\pi^2}{4}+1\right)(-1)\\ &=2-\frac{\pi^2}{4}-1\\ &=1-\frac{\pi^2}{4}. \end{aligned} $$

Check by differentiating the product directly. The first derivative is \(h'(x)=2x\sin x+(x^2+1)\cos x\). Differentiating its two terms gives

$$ \begin{aligned} h''(x) &=2\sin x+2x\cos x+2x\cos x-(x^2+1)\sin x\\ &=2\sin x+4x\cos x-(x^2+1)\sin x. \end{aligned} $$

At \(x=\frac{\pi}{2}\), this is \(2+0-\left(\frac{\pi^2}{4}+1\right)=1-\frac{\pi^2}{4}\), agreeing with the formula.

Worked Example: A Polynomial Times an Exponential

Let \(h(x)=(x^2-3x)e^{2x}\). Find \(h''(0)\).

Choose \(f(x)=x^2-3x\) and \(g(x)=e^{2x}\). Then

$$ f'(x)=2x-3,\qquad f''(x)=2,\qquad g'(x)=2e^{2x},\qquad g''(x)=4e^{2x}. $$

The exponential derivatives use the chain rule for the exponent \(2x\). At zero, the values are

$$ f(0)=0,\quad f'(0)=-3,\quad f''(0)=2,\qquad g(0)=1,\quad g'(0)=2,\quad g''(0)=4. $$

Therefore,

$$ \begin{aligned} h''(0) &=f''(0)g(0)+2f'(0)g'(0)+f(0)g''(0)\\ &=(2)(1)+2(-3)(2)+(0)(4)\\ &=2-12+0\\ &=-10. \end{aligned} $$

To check, differentiate \(h\) directly, keeping the exponential factor visible. The first derivative is

$$ \begin{aligned} h'(x) &=(2x-3)e^{2x}+(x^2-3x)(2e^{2x})\\ &=e^{2x}\bigl((2x-3)+2x^2-6x\bigr)\\ &=e^{2x}(2x^2-4x-3). \end{aligned} $$

Differentiate this product once more:

$$ \begin{aligned} h''(x) &=2e^{2x}(2x^2-4x-3)+e^{2x}(4x-4)\\ &=e^{2x}\bigl(4x^2-8x-6+4x-4\bigr)\\ &=e^{2x}(4x^2-4x-10). \end{aligned} $$

Substitution gives \(h''(0)=e^0(0-0-10)=-10\), as before.

Worked Example: A Product of Trigonometric Functions

Let \(h(x)=\sin x\cos x\). Find \(h''\left(\frac{\pi}{4}\right)\).

Take \(f(x)=\sin x\) and \(g(x)=\cos x\). Their first and second derivatives are \(f'(x)=\cos x\), \(f''(x)=-\sin x\), \(g'(x)=-\sin x\), and \(g''(x)=-\cos x\). At \(x=\frac{\pi}{4}\), sine and cosine are both \(\frac{\sqrt{2}}{2}\). Thus

$$ \begin{aligned} f&=\frac{\sqrt{2}}{2},& f'&=\frac{\sqrt{2}}{2},& f''&=-\frac{\sqrt{2}}{2},\\ g&=\frac{\sqrt{2}}{2},& g'&=-\frac{\sqrt{2}}{2},& g''&=-\frac{\sqrt{2}}{2}. \end{aligned} $$

Using these values in the rule gives

$$ \begin{aligned} h''\left(\frac{\pi}{4}\right) &=\left(-\frac{\sqrt{2}}{2}\right)\left(\frac{\sqrt{2}}{2}\right) +2\left(\frac{\sqrt{2}}{2}\right)\left(-\frac{\sqrt{2}}{2}\right) +\left(\frac{\sqrt{2}}{2}\right)\left(-\frac{\sqrt{2}}{2}\right)\\ &=-\frac12-1-\frac12\\ &=-2. \end{aligned} $$

Check using the identity \(\sin x\cos x=\frac12\sin(2x)\). Differentiating twice gives \(h''(x)=-2\sin(2x)\). At \(x=\frac{\pi}{4}\), \(h''=-2\sin(\frac{\pi}{2})=-2\), confirming the result.

A Common Mistake: Losing the Factor of Two

A frequent error is to remember the first and last terms but include \(f'g'\) only once. The next calculation makes the effect of that omission clear. Let \(h(x)=x^2e^x\), and evaluate its second derivative at \(x=1\). With \(f=x^2\), \(g=e^x\), at \(x=1\) we have \(f=1\), \(f'=2\), \(f''=2\), and \(g=g'=g''=e\).

$$ \begin{aligned} \text{Incorrect: } h''(1) &\overset{\text{wrong}}{=}f''g+f'g'+fg''\\ &=(2)e+(2)e+(1)e\\ &=5e. \end{aligned} $$

This is wrong because differentiating each term of \(h'=f'g+fg'\) produces a mixed term. The correct calculation includes both copies:

$$ \begin{aligned} h''(1) &=f''g+2f'g'+fg''\\ &=(2)e+2(2)(e)+(1)e\\ &=2e+4e+e\\ &=7e. \end{aligned} $$

Check directly: \(h'(x)=e^x(x^2+2x)\), so \(h''(x)=e^x(x^2+4x+2)\). Hence \(h''(1)=e(1+4+2)=7e\). The factor of two represents the two mixed terms in the derivation; it is not an adjustment added by convention.

Using the Rule Efficiently

At a specified input, it is often faster to evaluate each factor and its derivatives at that input than to simplify a general expression for \(h''(x)\) first. This is especially helpful when the input makes a trigonometric value zero or makes an exponential equal to one. It also makes the calculation easier to audit: each term in the formula has a visible source.

Before finalizing a result, check that:

  • Both factors have been differentiated twice correctly.
  • The middle term is \(2f'g'\), with both first derivatives evaluated at the requested input.
  • The values of \(f\) and \(g\), not just their derivatives, are included in the first and last terms.
  • All terms use the same input, and the final arithmetic follows from the displayed substitutions.

The product rule for the second derivative is a direct consequence of applying the ordinary product rule twice. Its three-term form is a compact way to organize that repeated differentiation, whether the factors are polynomials, trigonometric functions, exponential functions, or combinations of these.

Check Your Understanding

For each question, identify the factors and keep the middle term in the second derivative product rule.

  1. If \(h(x)=x^3\cos x\), write a formula for \(h''(x)\) using the second derivative product rule. Do not expand or simplify the result.
  2. For \(h(x)=(x+1)e^x\), find \(h''(0)\). Show the values of each factor and its first two derivatives at zero.
  3. For \(h(x)=\sin x\cos x\), use the product rule to find \(h''(0)\).
  4. In the derivation of the formula, where do the two copies of \(f'g'\) come from?
  5. A student writes \((fg)''=f''g+f'g'+fg''\). State the error and correct the formula.

Test yourself: AP Calculus practice exams

Ready to check what you know? Work an AP-style practice exam, then open the full solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers all of AP Calculus AB & BC: 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