practicecalculus
Derivative rules

Product Rule for Derivatives: Formula, Examples and Proof

The product rule: the derivative of f·g is f'g + fg'. The formula, worked examples, the three-factor version, a short proof and common mistakes.

Derivative rules Updated 3 min read

At a glance

\frac{d}{dx}\,[f(x)\,g(x)] = f'(x)\,g(x) + f(x)\,g'(x)
Applies to
A product of two differentiable functions, both depending on x
In words
Derivative of the first times the second, plus the first times the derivative of the second
Three factors
(fgh)' = f'gh + fg'h + fgh'
Not needed when
One factor is a constant (use the constant multiple rule)
Integral version
Integration by parts
On this page
  1. The product rule formula
  2. Worked examples
  3. When to use the product rule
  4. Why the product rule works
  5. Common mistakes

The product rule tells you how to differentiate two functions multiplied together. The derivative of a product is not the product of the derivatives. Instead, you differentiate one factor at a time and add the results.

The product rule formula

If f and g are differentiable, then

\frac{d}{dx}\,[f(x)\,g(x)] = f'(x)\,g(x) + f(x)\,g'(x)

A common way to say it: derivative of the first times the second, plus the first times the derivative of the second. In shorthand, (fg)' = f'g + fg'.

For three factors the pattern continues, with one differentiated factor per term:

(fgh)' = f'gh + fg'h + fgh'

Worked examples

Example 1: a power times a trig function. Let f = x^2 and g = \sin x, so f' = 2x and g' = \cos x:

\frac{d}{dx}\,x^2\sin x = 2x\sin x + x^2\cos x

Example 2: a power times an exponential. With f = x and g = e^x:

\frac{d}{dx}\,x e^x = 1 \cdot e^x + x\,e^x = (x + 1)\,e^x

Example 3: a logarithm. With f = x and g = \ln x:

\frac{d}{dx}\,x\ln x = 1 \cdot \ln x + x \cdot \frac{1}{x} = \ln x + 1

Example 4: two polynomials, checked by expanding. For (3x + 1)(x^2 - 2):

3(x^2 - 2) + (3x + 1)(2x) = 3x^2 - 6 + 6x^2 + 2x = 9x^2 + 2x - 6

Expanding first gives 3x^3 + x^2 - 6x - 2, whose derivative is also 9x^2 + 2x - 6.

Example 5: three factors. For x\,e^x\sin x:

\frac{d}{dx}\,x e^x \sin x = e^x\sin x + x e^x\sin x + x e^x\cos x

When to use the product rule

Use it when two (or more) factors both depend on x:

Expression Use the product rule?
x^3\cos x Yes
e^x \ln x Yes
5\sin x No, 5 is a constant: constant multiple rule
\sin(x^2) No, that is a composition: chain rule
\frac{x^2}{x + 1} Use the quotient rule, or the product rule on x^2(x+1)^{-1}

Many derivatives need the product rule and the chain rule together. For x^2 e^{3x}, the product rule splits it up and the chain rule handles e^{3x}: the result is 2x e^{3x} + 3x^2 e^{3x}.

Why the product rule works

Start from the limit definition of the derivative and add and subtract f(x+h)g(x) in the numerator:

\frac{f(x+h)g(x+h) - f(x)g(x)}{h} = f(x+h)\,\frac{g(x+h) - g(x)}{h} + g(x)\,\frac{f(x+h) - f(x)}{h}

As h \to 0, f(x+h) \to f(x) because differentiable functions are continuous, and the two difference quotients become g'(x) and f'(x). That leaves f(x)g'(x) + g(x)f'(x).

Picture a rectangle with sides f and g. When both sides grow a little, the area gains a strip of size f'g along one side and a strip of size fg' along the other.

Common mistakes

  1. Multiplying the derivatives. \frac{d}{dx}\,x^2\sin x \ne 2x\cos x. You need two terms.
  2. Differentiating both factors in the same term. Each term has exactly one primed factor.
  3. Using it on a constant multiple. It works but wastes time. \frac{d}{dx}\,4x^3 is just 12x^2.
  4. Forgetting the chain rule inside a factor. In x\sin(2x), the derivative of \sin(2x) is 2\cos(2x), so the answer is \sin(2x) + 2x\cos(2x).

Integrating the product rule gives integration by parts. For more examples and a side-by-side comparison with the quotient rule, read the full guide to the product and quotient rules.

Practice it now

The product rule

Solve real problems on this topic with instant feedback, hints and a step-by-step walkthrough for every answer. Free, no sign-up needed to start.

Practice this lesson

Frequently asked questions

What is the product rule in calculus?

The product rule says \frac{d}{dx}[f(x)g(x)] = f'(x)g(x) + f(x)g'(x). You differentiate one factor at a time and add the two results.

Does order matter in the product rule?

No. Addition is commutative, so f'g + fg' and fg' + f'g are equal. Order only matters in the quotient rule, which has a subtraction.

How do you use the product rule with three functions?

Differentiate one factor at a time and add: (fgh)' = f'gh + fg'h + fgh'. Each term has exactly one differentiated factor.

When should I use the product rule instead of expanding?

Expand when the product is two short polynomials. Use the product rule when a factor is a trig, exponential or log function, or when expanding would be long.

Written by the PracticeCalculus team

We build interactive calculus lessons and write every page to be clear and correct. Spotted something off? Tell us and we will fix it.