Finding the derivative of   $f(x) = g(x)\cdot h(x)$

Very often we need to find the derivative of a product of functions. We'll prove this rule below, but the simple statement in the box is what you need to remember:

To find the derivative of a product multiply the first function by the derivative of the second and add the product of the second function and the derivative of the first.

The product rule

The derivative of a product of functions f(x)·g(x) is the first function multiplied b the derivative of the second, plus the second multiplied by the derivative of the first.

$$\frac{d}{dx}\left[ f(x) \cdot g(x) \right] = f(x) \cdot \frac{d}{dx} g(x) + g(x) \cdot \frac{d}{dx} f(x)$$

Another way to state the rule, using shorthand for functions f(x) and g(x), is:

$$(fg)' = f'g + f g'$$

Derivation of the product rule

We begin the derivation of the product rule with the definition of the derivative of f(x)·g(x) (see The Derivative):

$$\frac{d}{dx} f(x) \cdot g(x) = \lim_{h\to 0} \, \frac{f(x + h) \cdot g(x + h) - f(x)\cdot g(x)}{h}$$

Now this is a difficult limit, in that we can't just substitute h = 0 because the function would blow up. So we have to do some kind of manipulation that eliminates h from at least some additive part of the denominator. One clever manipulation is to both add and subtract f(x + h)g(x) to the numerator, like this:

$$= \lim_{h\to 0} \frac{f(x + h) g(x + h) \color{#E90F89}{+ f(x + h) g(x) - f(x + h) g(x)} - f(x)g(x)}{h}$$

Now we can rearrange that numerator like this. What we're doing is moving toward being able to identify individual derivatives of f(x) and g(x):

$$= \lim_{h\to 0} \frac{f(x + h)[g(x + h) - g(x)] + g(x)[f(x + h) - f(x)]}{h}$$

We can split the function into two limits of products. Remember that the limit of a product is the product of limits, and the limit of a sum is the sum of limits:

$$= \lim_{h\to 0} f(x + h) \left( \frac{g(x + h) - g(x)}{h} \right) + \lim_{h\to 0} g(x) \left( \frac{f(x + h) - f(x)}{h} \right)$$

Now here's our final statement. Starting from the right, we see the limit definition of f'(x), that g(x) does not depend in any way on x, and the limit definition of g'(x). Trickier is the final limit on the left, which I'll address below.

The limit of f(x + h) as h approaches zero is f(x) only if f is continuous and has a limit in of f(a) for x = a.

$$\lim_{h\to 0} f(x + h) = f(x)$$

Our result is the product rule:

$$\frac{d}{dx} f(x) \cdot g(x) = f(x) \cdot g'(x) + f'(x)\cdot g(x)$$

A reminder about continuity

In the derivation above, we relied on the continuity of a function. It's worth reconsidering that now.

The limit of f(x + h), as h → 0 is f(x) if f(x) is a "well-behaved" function. That means that it is continuous and differentiable everywhere, or at least in the part of the domain in which we're interested.

If, for example, f(x) has a hole at x (see graph at right), then the limit of f(x) as h → 0 would exist (because the one-sided limits from the left and right are the same), but the function is discontinuous, so it has neither a defined value nor a derivative at x.

Example 1

Find the derivative of   $f(x) = x^2 \, cos(x)$

Solution: Our function is a product of two functions, g(x) = x2 and h(x) = cos(x),

$$f(x) = x^2 \cdot cos(x)$$

The power rule give us:

which doesn't simplify all that much:

$$f'(x) = 1x \, cos(x) - x^2 \, sin(x)$$

This is a good example to compare the features of the graphs of a function and its derivative. Plotted here are the f(x) and f'(x) from our first example above.

First, notice that the two are plotted on separate axes. Resist the temptation to plot a function and its derivative on the same axes. They don't belong together and the result can be misleading. The derivative graph need not resemble the function graph.

The derivative graph is positive where the slope of f(x) is positive and negative where the slope of f(x) is negative. At the two local maxima and the local minimum, the derivative graph passes through zero because the derivative at a max. or min. is zero.

An inflection point is a point at which the curvature of a graph changes from concave upward to concave downward, or the reverse. They occur at maxima or minima in the derivative. We'll learn more about those when we study the second derivative.

Example 2

Find the derivative of   $f(x) = (x^2 - 3)(2x^3 - x)$

Solution: The function

$$f(x) = (x^2 - 3)(2x^3 - x)$$

is the product of two functions. We could call them g(x) = x2 - 3 and h(x) = (2x3 - x). To find the derivative, we use the pattern of the product rule: f'(x) = f(x)·g'(x) + g(x)·f'(x):

$$ \begin{align} f'(x) &= (2x^3 - x) \, \frac{d}{dx} (x^2 - 3) \\[5pt] &+ (x^2 - 3) \, \frac{d}{dx} (2x^3 - x) \end{align}$$

A little algebra gets us a simplified derivative:

$$ \begin{align} f'(x) &= (2x^3 - x)(2x) + (x^2 - 3)(6x^2 - 1) \\[5pt] &= 4x^4 - 2x^2 + 6x^4 -x^2 - 18x^2 + 3 \\[5pt] &= 10x^4 - 21x^2 + 3 \end{align}$$

A double check

We could check our work by multiplying the binomials of this function first:

$$ \begin{align} f(x) &= (x^2 - 3)(2x^3 - x) \\[5pt] &= 2x^5 - x^3 - 6x^3 + 3x \\[5pt] &= 2x^5 - 7x^3 + 3x \end{align}$$

Now the power rule derivative is easy to find:

$$f'(x) = 10x^4 - 21x^2 + 3$$

... and it's the same as what we found with the product rule – nice to confirm that the product rule works!

Practice problems

Find the derivative of each of the following functions. Where possible, calculate the derivative without using the product rule in order to check your answer.


$f(x) = \sqrt{x} \, (x - 1)$


$$ \begin{align} f'(x) &= \frac{1}{2} x^{-\frac{1}{2}} (x - 1) + x^{\frac{1}{2}} (1) \\[5pt] &= \frac{x - 1}{2 \sqrt{x}} + \sqrt{x} \end{align}$$


$f(x) = (x - 2)(2x + 3)$


$$ \begin{align} f'(x) &= (1)(2x + 3) + (x - 2)(2) \\[5pt] &= 2x + 3 + 2x - 4 \\[5pt] &= 4x - 1 \end{align}$$

With these polynomial functions, you can also just multiply the binomials and take the derivative straight away. The results are the same:

$$ \begin{align} f(x) &= (x - 2)(2x + 3) \\[5pt] &= 2x^2 - x - 6 \\[5pt] \color{#E90F89}{\longrightarrow} f'(x) &= 4x - 1 \end{align}$$


$f(x) = (2x^3 + 3)(x^4 - 2x)$


$$ \begin{align} f'(x) &= (6x^2)(x^4 - 2x) + (2x^3 + 3)(4x^3 - 2) \\[5pt] &= 6x^6 - 12x^3 + 8x^6 - 4x^3 + 12x^3 - 6 \\[5pt] &= 14x^6 - 4x^3 - 6 \end{align}$$

With these polynomial functions, you can also just multiply the binomials and take the derivative straight away. The results are the same:

$$ \begin{align} f(x) &= 2x^7 - 4x^4 + 3x^4 - 6x \\[5pt] &= 2x^7 - x^4 - 6x \\[5pt] \color{#E90F89}{\longrightarrow} f'(x) &= 14x^6 - 4x^3 - 6 \end{align}$$


$f(x) = (1 + x + x^2)(2 - x^3)$


$$ \begin{align} f'(x) &= (1 + 2x)(2 - x^3) + (1 + x + x^2)(-3x^2) \\[5pt] &= 2 - x^3 + 4x - 2x^4 - 3x^2 - 3x^3 - 3x^4 \\[5pt] &= -5x^4 - 4x^3 - 3x^2 + 4x + 2 \end{align}$$

With these polynomial functions, you can also just multiply the binomials and take the derivative straight away. The results are the same:

$$ \begin{align} f(x) &= 2 - x^3 + 2x - x^4 + 2x^2 - x^5 \\[5pt] \color{#E90F89}{\longrightarrow} f'(x) &= -5x^4 - 4x^3 - 3x^2 + 4x + 2 \end{align}$$


$f(x) = (x^3 - 2x)(x^{-3} + x^{-2})$


$$ \begin{align} f'(x) &= (3x^2 - 2)(x^{-3} + x^{-2}) + (x^3 - 2x)(-3x^{-4} - 2x^{-3}) \\[5pt] &= 3x^{-1} + 3 - 2x^{-3} - 2x^{-2} - 3x^{-1} - 2 + 6x^{-3} + 4x^{-2} \\[5pt] &= 1 + 2x^{-2} + 4x^{-3} \end{align}$$

With these polynomial functions, you can also just multiply the binomials and take the derivative straight away. The results are the same:

$$ \begin{align} f(x) &= 1 + x - 2x^{-2} - 2x^{-1} \\[5pt] \color{#E90F89}{\longrightarrow} f'(x) &= 1 + 2x^{-2} + 4x^{-3} \end{align}$$


$f(x) = sin(x)\cdot cos(x)$


$$ \begin{align} f'(x) &= cos(x) cos(x) + sin(x) (-sin(x)) \\[5pt] &= cos^2 (x) - sin^2 (x) \end{align}$$


$f(x) = x^{-4} sin(x)$


$$ \begin{align} f'(x) &= -4x^{-5} \cdot sin(x) + x^{-4} \cdot cos(x) \\[5pt] &= \frac{cos(x)}{x^4} - \frac{4 sin(x)}{x^5} \end{align}$$


$f(x) = (1 + x)\cdot cos(x)$


$$ \begin{align} f'(x) &= (1) cos(x) + (1 + x)(-sin(x)) \\[5pt] &= cos(x) - sin(x) - x \cdot sin(x) \end{align}$$


$f(x) = x(2x^2 - 1)\cdot sin(x)$


First multiply the x by the binomial:

$$ \begin{align} f(x) &= x(2x^2 - 1) sin(x) \\[5pt] &= (2x^3 - x) \cdot sin(x) \end{align}$$

Now the derivative

$$f'(x) = (6x^2 - 1) \cdot sin(x) + (2x^3 - x) \cdot cos(x)$$


$f(x) = (x^2 - 1)^3$


First square the binomial to get a product of two functions:

$$f(x) = (x^2 - 1) = (x^4 - 2x^2 + 1)(x^2 - 1)$$

Now take the derivative using the product rule:

$$ \begin{align} f'(x) &= (4x^3 - 4x)(x^2 - 1) + (x^4 - 2x^2 + 1)(2x) \\[5pt] &= 4x^5 - 4x^3 - 4x^3 + 4x + 2x^5 - 4x^3 + 2x \\[5pt] &= 6x^5 - 12x^3 + 6x \\[5pt] &= 6x(x^4 - 2x^2 + 1) \\[5pt] &= 6x(x^2 - 1)^2 \end{align}$$

This one is better done using the chain rule, but you may not have studied that yet.

Video examples

Here are eight examples (four videos) of product-rule derivatives. Enjoy! (OK, maybe that's overdoing it. I do hope they're helpful, though).

Example 1

The first example shows that the product rule yields the same result as the power rule when both can be used.

Minutes of your life: 0:00

Example 2

Two examples involving products of polynomial, exponential and trigonometric functions.

Minutes of your life: 0:00

Example 3

These are two trickier product rule derivatives. One contains a negative exponent, showing how the product rule can be used to find the derivative of a quotient of functions.

Minutes of your life: 0:00

Example 4

In one of these two examples, we show how the product rule can be used with the chain rule to find the derivative of a quotient. In the other, we use the product rule twice.

Minutes of your life: 0:00

Creative Commons License   optimized for firefox by Dr. Jeff Cruzan is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. © 2012, Jeff Cruzan. All text and images on this website not specifically attributed to another source were created by me and I reserve all rights as to their use. Any opinions expressed on this website are entirely mine, and do not necessarily reflect the views of any of my employers. Please feel free to send any questions or comments to