## Product, Quotient and Power Rules of Differentiation

Several rules exist for finding the derivatives of functions with several components such as $x \space sin \space x$. With these rules and the chain rule, which will be explored later, any derivative of a function can be found (assuming they exist). There are five rules that help simplify the computation of derivatives, of which each will be explored in turn.

## Sum Rule¶

The most straightforward of the derivation rules is the sum rule, which is stated as:

$$\text{The derivative of} \space u(x) + v(x) \space \text{is} \space \frac{d}{dx} (u + v) = \frac{du}{dx} + \frac{dv}{dx}$$

## Rule of Linearity¶

The sum rule can be considered a case of a larger concept called linearity. For example, linearity can be seen in the derivative of the function: $\frac{d}{dx}5x - cos x = 5 + sin \space x$ and all other similar functions. This rule is known as the Rule of Linearity and follows from linear combinations. Where $a$ and $b$ are real numbers, the rule is stated as the following:

$$\text{The derivative of} \space au(x) + bv(x) \space \text{is} \space \frac{d}{dx}(au + bv) = a \frac{du}{dx} + b \frac{dv}{dx}$$

## Product Rule¶

The product rule helps deal with the frequently occurring situation of the product of two functions, such as $sin \space x + cos \space x$ and is stated as:

$$\text{The deriative of the product of two functions,} \space u(x)v(x) \space \text{is} \space \frac{d}{dx}(uv) = u \frac{dv}{dx} + v \frac{du}{dx}$$

.

The product rule can be extended to more than the product of two functions. For example, the derivative of the product of three functions would be:

$$\frac{d}{dx} \space (uvw) = uv \frac{dw}{dx} + uw \frac{dv}{dx} + vw \frac{du}{dx}$$

## Reciprocal Rule¶

The reciprocal rule is more or less a case of the powerful quotient rule. The case of the reciprocal rule helps us find the derivative of $\frac{1}{v(x)}$ much easier. We can state the rule as the following:

$$\text{The derivative of the function} \space \frac{1}{v(x)} \space \text{is} \space \frac{d}{dx} \space \frac{1}{v(x)} = \frac{\frac{-dv}{dx}}{v^2}$$

## Quotient Rule¶

The quotient rule is an important derivation technique that allows us to more efficiently find the deriative of $\frac{u(x)}{v(x)}$. We can state the quotient rule as follows:

$$\text{The derivative of} \space \frac{u(x)}{v(x)} \space \text{is} \space \frac{v \frac{du}{dx} - u \frac{dv}{dx}}{v^2}$$

Last but certainly not least is the power rule.

## Power Rule¶

The power rule gives us the ability to find the deriative of a function of the form $(u(x))^n$ and can be stated as:

$$\text{The deriative of} \space \Big[u(x) \Big]^n \space \text{is} \space n \Big[u(x) \Big ]^{n-1} \frac{du}{dx}$$

Okay! With those rules stated and out of the way, we are now able to solve the vast majority of derivatives we will ever encounter! We test our hand at using the rules to calculate the derivative of several functions with the following examples.

## Examples¶

The examples presented here are borrowed from Gilbert Strang's amazing book Calculus, which can be found for free in PDF form on the MIT OCW site. We also take advantage of the wonderful SymPy library for symbolic computation to check our answers to the example problems.

We import the functions from the SymPy library that we will require.

In [9]:
from sympy import symbols, diff, sin, cos, simplify, init_printing


The init_printing() function is used to output the results of SymPy in LaTeX.

In [10]:
init_printing()


First, initialize a symbol variable for $x$ to be used with SymPy's computation engine.

In [11]:
x = symbols('x')


Example 1: Find the derivative of $(x + 1)(x - 1)$

We could factor and take the derivative of the resulting polynomial without having to use the product rule:

$$(x + 1)(x - 1) = x^2 - x + x + 1 = x^2 + 1$$
$$\frac{d}{dx} x^2 + 1 = 2x$$

We can also find the deriative of the function with the product rule:

$$\frac{d}{dx} (uv) = u \frac{dv}{dx} + v \frac{du}{dx}$$
$$u = x + 1, \qquad v = x - 1$$
$$\frac{d}{dx} = (x + 1)(1) + (x - 1)(1) = 2x$$

Example 2: Find the derivative of $\frac{1}{1 + x} + \frac{1}{1 + sin \space x}$

Here we take advantage of the reciprocal rule, $\frac{d}{dx} \space \frac{1}{v(x)} = \frac{\frac{-dv}{dx}}{v^2}$. Starting with $\frac{1}{1 + x}$:

$$\frac{d}{dx} \space \frac{1}{1 + x} = \frac{-1}{(1 + x)^2}$$

Then the second piece of the function, $\frac{1}{1 + sin \space x}$

$$\frac{d}{dx} \space \frac{1}{1 + sin \space x} = \frac{-cos \space x}{(1 + sin \space x)^2}$$

Then putting the two pieces together gives us the derivative of the function:

$$\frac{d}{dx} \frac{1}{1 + x} + \frac{1}{1 + sin \space x} = \frac{-1}{(1 + x)^2} - \frac{cos \space x}{(1 + sin \space x)^2}$$

We can verify this result using SymPy:

In [12]:
diff(1 / (1 + x) + 1 / (1 + sin(x)))

Out[12]:
$$- \frac{\cos{\left (x \right )}}{\left(\sin{\left (x \right )} + 1\right)^{2}} - \frac{1}{\left(x + 1\right)^{2}}$$

Example 3: Find the derivative of $(x - 1)(x - 2)(x - 3)$

We can find the derivative using the product rule, $\frac{d}{dx} \space (uvw) = uv \frac{dw}{dx} + uw \frac{dv}{dx} + vw \frac{du}{dx}$

$$u = (x - 1), \qquad v = (x - 2), \qquad w = (x - 3)$$
$$\frac{d}{dx} (uvw) = (x - 1)(x - 2)(1) + (x - 1)(x - 2)(1) + (x - 2)(x - 3)(1)$$

Though not necessary, finish by factoring and simplifying the derivative.

$$x^2 - 2x - x + 2 + x^2 - 3x - x + 3 + x^2 - 3x - 2x + 6$$
$$3x^2 - 12x + 11$$

Verifying with SymPy:

In [14]:
diff((x - 1) * (x - 2) * (x - 3))

Out[14]:
$$\left(x - 3\right) \left(x - 2\right) + \left(x - 3\right) \left(x - 1\right) + \left(x - 2\right) \left(x - 1\right)$$

We can also check to see if our simplifying of the function was accurate using SymPy's simplify function.

In [15]:
simplify(diff((x - 1) * (x - 2) * (x - 3)))

Out[15]:
$$3 x^{2} - 12 x + 11$$

Example 4: Find the derivative of $\frac{x^3 + 1}{x + 1} + \frac{cos \space x}{sin \space x}$

Using the sum rule, we can find the derivatives of each piece and then add the derivatives together. Starting with $\frac{x^3 + 1}{x + 1}$, we apply the quotient rule:

$$\frac{d}{dx} \space \frac{u(x)}{v(x)} = \frac{v \frac{du}{dx} - u \frac{dv}{dx}}{v^2}$$
$$u = x^3 + 1, \qquad v = x + 1$$
$$\frac{d}{dx} \space \frac{x^3 + 1}{x + 1} = \frac{(x + 1)(3x^2) - (x^3 + 1)(1)}{(x + 1)^2} = 2x - 1$$

We'll take the easy way out on factoring the above derivative and use SymPy:

In [18]:
simplify(((x + 1) * (3 * x ** 2) - (x ** 3 + 1)) / (x + 1) ** 2)

Out[18]:
$$2 x - 1$$

Then we find the derivative of the second piece of the equation, $\frac{\cos{x}}{\sin{x}}$. Again, we take advantage of the quotient rule:

$$u = \cos{x}, \qquad v = \sin{x}$$
$$\frac{d}{dx} \frac{\cos{x}}{\sin{x}} = \frac{(\sin{x})(-\sin{x}) - (\cos{x})(\sin{x})}{(\sin{x})(\sin{x})}$$
$$\frac{d}{dx} \frac{\cos{x}}{\sin{x}} = \frac{-\sin^2{x} - \cos^2{x}}{\sin^2{x}}$$

With the Pythagorean identity, $\sin^2{x} + \cos^2{x} = 1$, we can simplify the derivative to:

$$-\frac{1}{\sin^2{x}} = -\csc^2{x}$$

Adding the two pieces of the equation together using the sum rule gives us the deriative:

$$2x - 1 - \frac{1}{\sin{x}} = 2x - 1 - \csc{x}$$