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.
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
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
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.
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.
Write the product as \(h=fg\), making clear which expression is \(f\) and which is \(g\).
Compute \(f'\), \(f''\), \(g'\), and \(g''\), using the standard differentiation rules that apply to those functions.
Find \(f\), \(f'\), \(f''\), \(g\), \(g'\), and \(g''\) at the requested value of \(x\).
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
At \(x=\frac{\pi}{2}\), the required values are
Substitute in the second derivative product rule:
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
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
The exponential derivatives use the chain rule for the exponent \(2x\). At zero, the values are
Therefore,
To check, differentiate \(h\) directly, keeping the exponential factor visible. The first derivative is
Differentiate this product once more:
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
Using these values in the rule gives
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\).
This is wrong because differentiating each term of \(h'=f'g+fg'\) produces a mixed term. The correct calculation includes both copies:
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.
- 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.
- For \(h(x)=(x+1)e^x\), find \(h''(0)\). Show the values of each factor and its first two derivatives at zero.
- For \(h(x)=\sin x\cos x\), use the product rule to find \(h''(0)\).
- In the derivation of the formula, where do the two copies of \(f'g'\) come from?
- A student writes \((fg)''=f''g+f'g'+fg''\). State the error and correct the formula.