Product rule

Differentiate each factor in turn, leaving the other one alone.

\[\left(fg\right)' = f'g + fg'\]

What it says

The derivative of a product is not the product of the derivatives. Think of a rectangle with sides \(f\) and \(g\): growing \(f\) by a sliver adds a strip of area \(f'g\), growing \(g\) adds a strip \(fg'\), and the tiny corner where both grow is negligible in the limit. The two strips are the two terms.

The rule is symmetric, so it does not matter which factor you call \(f\). It extends to three or more factors by differentiating one at a time: \(\left(fgh\right)' = f'gh + fg'h + fgh'\) — one term per factor.

Before using it, check whether one factor is a constant. If it is, the constant multiple rule is shorter and produces one term instead of two.

When it applies

  • Two or more expressions that each contain the variable are multiplied together.
  • A polynomial times a transcendental function, such as \(x^{2}e^{x}\).
  • Not needed when a factor is constant, or when multiplying out first is easier.

Five worked examples

Every line is the step the calculator would show, in the order it applies them. Each graph is live: hover it to read both curves and see the tangent whose slope is the derivative, drag to pan, scroll to zoom.

Example 1
\[\frac{d}{dx}\left[x^{2} \sin\left(x\right)\right]\]
  1. Take \(f = x^{2}\) and \(g = \sin x\).

    \[\frac{d}{dx}\left[x^{2}\sin x\right] = \frac{d}{dx}\left[x^{2}\right]\sin x + x^{2}\,\frac{d}{dx}\left[\sin x\right]\]
  2. Power rule and trigonometric rule.

    \[= 2x\sin x + x^{2}\cos x\]
Answer
\[2 x \sin\left(x\right) + x^{2} \cos\left(x\right)\]

An oscillation whose swing grows like \(x^{2}\), with f′ swinging wider still and crossing zero at every crest and trough of f. Both terms of the rule are visible in the shape: \(2x\sin x\) opens out the envelope, \(x^{2}\cos x\) keeps the wave in step.

Each term keeps one factor untouched. That is the signature of the product rule.

Open x^2 sin(x) in the calculator
Example 2
\[\frac{d}{dx}\left[x e^{x}\right]\]
  1. With \(f = x\) and \(g = e^{x}\).

    \[= 1 \cdot e^{x} + x \cdot e^{x}\]
  2. Factor if you like a tidy answer.

    \[= e^{x}\left(1 + x\right)\]
Answer
\[e^{x} + x e^{x}\]

f dips to a minimum at \(x = -1\) and rises steeply after it, with f′ exactly zero there and negative to its left.

Because \(e^{x}\) is its own derivative, both terms end up carrying it.

Open x e^x in the calculator
Example 3
\[\frac{d}{dx}\left[\left(x + 1\right) \left(x - 3\right)\right]\]
  1. Product rule with \(f = x + 1\) and \(g = x - 3\).

    \[= 1 \cdot \left(x - 3\right) + \left(x + 1\right)\cdot 1\]
  2. Collect.

    \[= 2x - 2\]
Answer
\[2 x - 2\]

An upward parabola with roots at \(-1\) and \(3\), and the line \(2x - 2\) for its derivative, crossing zero at the vertex.

Multiplying out first gives \(x^{2} - 2x - 3\), whose derivative is also \(2x - 2\). For polynomials, expanding is usually quicker.

Open (x+1)(x-3) in the calculator
Example 4
\[\frac{d}{dx}\left[\sqrt{x} \ln\left(x\right)\right]\]
  1. Take \(f = \sqrt{x}\), \(g = \ln x\).

    \[= \frac{1}{2\sqrt{x}}\ln x + \sqrt{x}\cdot\frac{1}{x}\]
  2. Simplify the second term using \(\frac{\sqrt{x}}{x} = \frac{1}{\sqrt{x}}\).

    \[= \frac{\ln x}{2\sqrt{x}} + \frac{1}{\sqrt{x}}\]
Answer
\[\frac{\ln\left(x\right)}{2 \sqrt{x}} + \frac{1}{\sqrt{x}}\]

Only for \(x > 0\). f drops into a shallow trough just right of the origin, where f′ passes through zero, then climbs steadily.

Both factors needed their own rule — power rule for the root, logarithm rule for \(\ln\).

Open sqrt(x) ln(x) in the calculator
Example 5
\[\frac{d}{dx}\left[x^{2} e^{x} \sin\left(x\right)\right]\]
  1. Three factors, so three terms: differentiate one at a time.

    \[= \frac{d}{dx}\left[x^{2}\right]e^{x}\sin x + x^{2}\frac{d}{dx}\left[e^{x}\right]\sin x + x^{2}e^{x}\frac{d}{dx}\left[\sin x\right]\]
  2. Fill in each derivative.

    \[= 2xe^{x}\sin x + x^{2}e^{x}\sin x + x^{2}e^{x}\cos x\]
Answer
\[2 x e^{x} \sin\left(x\right) + x^{2} e^{x} \sin\left(x\right) + x^{2} e^{x} \cos\left(x\right)\]

Three factors give a fast-growing oscillation, and f′ turns over wherever f reaches a peak.

The engine reaches the same place by nesting two product rules; the one-term-per-factor pattern is the shortcut.

Open x^2 e^x sin(x) in the calculator

Watch out for

  • \(\left(fg\right)' \neq f'g'\). The single most common error in a first calculus course.
  • Do not differentiate both factors in the same term — each term leaves one factor alone.
  • If one factor is constant, use the constant multiple rule instead; the product rule would just add a term that is zero.