# Chain rule: Wikis

Note: Many of our articles have direct quotes from sources you can cite, within the Wikipedia article! This article doesn't yet, but we're working on it! See more info or our list of citable articles.

# Encyclopedia

In calculus, the chain rule is a formula for the derivative of the composite of two functions.

In intuitive terms, if a variable, y, depends on a second variable, u, which in turn depends on a third variable, x, then the rate of change of y with respect to x can be computed as the rate of change of y with respect to u multiplied by the rate of change of u with respect to x. Schematically,

$\frac {\mathrm dy}{\mathrm dx} = \frac {\mathrm dy} {\mathrm du} \cdot\frac {\mathrm du}{\mathrm dx}.\,\!$

## Informal discussion

For an explanation of notation used in this section, see Function composition.

The chain rule states that, under appropriate conditions,

$(f \circ g)'(x) = f'(g(x))g'(x),\,\!$

which in short form is written as

$(f \circ g)' = (f'\circ g) \cdot g'\,\!$.

Alternatively, in the Leibniz notation, the chain rule is

$\frac {\mathrm dy}{\mathrm dx} = \frac {\mathrm dy} {\mathrm du} \cdot\frac {\mathrm du}{\mathrm dx}.\,\!$

The chain rule can be applied to as many composed functions as needed:

$(f_1 \circ f_2 \circ f_3 \circ \cdots \circ f_n)'(x) = f'_1 \circ f_2 \circ f_3 \circ \cdots \circ f_n(x) \cdot f'_2 \circ f_3 \circ \cdots \circ f_n(x) \cdot f'_3 \circ \cdots \circ f_n(x) \cdot \,\cdots\, \cdot f'_n(x)$.

In integration, the counterpart to the chain rule is the substitution rule.

## Theorem

The chain rule in one variable may be stated more completely as follows.[1] Let g be a real-valued function on (a,b) which is differentiable at c ∈ (a,b); and suppose that f is a real-valued function defined on an interval I containing the range of g and suppose further that g(c) is an interior point of I. If f is differentiable at g(c), then

• $(f\circ g)(x)$ is differentiable at x = c, and
• $(f\circ g)'(c) = f'(g(c))g'(c).$

## Examples

### Example I

Suppose that a mountain climber ascends at a rate of 0.5 kilometers per hour. The temperature is lower at higher elevations; suppose the rate by which it decreases is 6 °C per kilometer. To calculate the decrease in air temperature per hour that the climber experiences, one multiplies 6 °C per kilometer by 0.5 kilometer per hour, to obtain 3 °C per hour. This calculation is a typical chain rule application.

### Example II

Consider the function f(x) = (x2 + 1)3. It follows from the chain rule that

\begin{align} f(x) & = (x^2+1)^3 \ u & = x^2+1 \ f(x) & = u^3 \ f'(x) & = 3u^2(u)' \ f'(x) & = 3(x^2+1)^2(x^2+1)' \ f'(x) & = 3(x^2+1)^2(2x) \ \end{align}

In order to differentiate the trigonometric function

$f(x) = \sin(x^2),\,$

one can write:

\begin{align} f(x) & = \sin(x^2) \ u & = x^2 \ f(x) & = \sin(u) \ f'(x) & = \cos(u)(u)' \ f'(x) & = \cos(x^2)(x^2)' \ f'(x) & = \cos(x^2)(2x) \ \end{align}

### Example III

Differentiate arctan(sin x).

$\frac{\mathrm d}{\mathrm dx}\arctan x = \frac{1}{1+x^2} \,\!$

Thus, by the chain rule,

$\frac{\mathrm d}{\mathrm dx}\arctan f(x) = \frac{f'(x)}{1+f^2(x)}\,\! ,$

and in particular,

$\frac{\mathrm d}{\mathrm dx}\arctan(\sin x) = \frac{\cos x}{1+\sin^2 x}\,\! .$

### Example IV

An illuminating exercise is to compute the derivatives of functions that one already knows, but use the chain rule instead.

Example 4.1
$\,\frac{\mathrm d}{\mathrm dx} x = 1$

Rewriting x as $\,\mathrm e^{\ln(x)}$, we have

$\,\frac{\mathrm d}{\mathrm dx} \mathrm e^{\ln(x)} = \mathrm e^{\ln(x)}\frac{\mathrm d}{\mathrm dx}{\ln(x)} = \mathrm e^{\ln(x)}\frac{1}{x} = x\cdot \frac{1}{x} = 1$
Example 4.2
$\,\frac{\mathrm d}{\mathrm dx} x = 1$

Rewriting x as $\,\ln(\mathrm e^x)$, we have

$\,\frac{\mathrm d}{\mathrm dx} \ln(\mathrm e^x) = \frac{1}{\mathrm e^x}\frac{\mathrm d}{\mathrm dx}\mathrm e^x = \frac{1}{\mathrm e^x}\mathrm e^x = 1$
Example 4.3
$\,\frac{\mathrm d}{\mathrm dx} x^6 = 6x^5$

Rewriting $\, x^6$ as $\, ({x^2})^{3}$, we have

$\,\frac{\mathrm d}{\mathrm dx} {(x^2)}^{3} = 3(x^2)^2 \cdot \frac{\mathrm d}{\mathrm dx}x^2 = 3(x^2)^2 \cdot 2x = 6x^4 \cdot x = 6x^5$
Example 4.4
$\,\frac{\mathrm d}{\mathrm dx} x = 1$

Rewriting x as $\,\arccos(\cos(x))$, we have

$\,\frac{\mathrm d}{\mathrm dx} \arccos(\cos(x)) = {-1 \over \sqrt{1 - \cos^2(x)}} \frac{\mathrm d}{\mathrm dx} \cos(x) = {+1 \over \sqrt{1 - \cos^2(x)}}\cdot \sin(x) \cdot \frac{\mathrm dx}{\mathrm dx} = {1 \over \sqrt{ \sin^2(x)}} \cdot \sin(x) = {1 \over \sin(x)} \cdot \sin(x) = 1$

In this example, one has to be careful about the domain and range, but we can pretend we are considering only a microscopic portion of the graph.

## Chain rule for several variables

The chain rule works for functions of more than one variable.[2] Consider the function z = f(xy) where xg(t) and yh(t), and g(t) and h(t) are differentiable with respect to t, then

${\ \mathrm dz \over \mathrm dt}={\partial z \over \partial x}{\mathrm dx \over \mathrm dt}+{\partial z \over \partial y}{\mathrm dy \over \mathrm dt}\,\!$.

Suppose that each argument of zf(uv) is a two-variable function such that uh(xy) and v = g(xy), and that these functions are all differentiable. Then the chain rule would look like:

${\partial z \over \partial x}={\partial z \over \partial u}{\partial u \over \partial x}+{\partial z \over \partial v}{\partial v \over \partial x}\,\!$,
${\partial z \over \partial y}={\partial z \over \partial u}{\partial u \over \partial y}+{\partial z \over \partial v}{\partial v \over \partial y}\,\!$.

If we consider

$\vec r = (u,v)$

above as a Cartesian vector function, we can use vector notation to write the above equivalently as the dot product of the gradient of f and a derivative of $\vec r$:

$\frac{\partial z}{\partial x}=\vec \nabla f(u,v) \cdot \frac{\partial \vec r}{\partial x}.$

More generally, for functions of vectors to vectors, the chain rule says that the Jacobian matrix of a composite function is the product of the Jacobian matrices of the two functions:

$\frac{\partial(z_1,\ldots,z_m)}{\partial(x_1,\ldots,x_p)} = \frac{\partial(z_1,\ldots,z_m)}{\partial(y_1,\ldots,y_n)} \frac{\partial(y_1,\ldots,y_n)}{\partial(x_1,\ldots,x_p)}\,\!$.
Example

Given $\,u = x^2 + 2y$ where $\,x = r\sin(t)$ and $\,y = \sin^2(t)$, determine the value of ${\partial u \over \partial r}$ and ${\partial u \over \partial t}$ using the chain rule.

${\partial u \over \partial r}=\frac{\partial u}{\partial x}\frac{\partial x}{\partial r}+\frac{\partial u}{\partial y}\frac{\partial y}{\partial r} = \left(2x\right)\left(\sin(t)\right)+\left(2\right)\left(0\right)=2r\sin^2(t)$

and

${\partial u \over \partial t}=\frac{\partial u}{\partial x}\frac{\partial x}{\partial t}+\frac{\partial u}{\partial y}\frac{\partial y}{\partial t} = \left(2x\right)\left(r\cos(t)\right)+\left(2\right)\left(2\sin(t)\cos(t)\right)=$
$2\left(r\sin(t)\right)r\cos(t)+4\sin(t)\cos(t) = 2\left(r^2+2\right)\sin(t)\cos(t).$

## Proof of the chain rule

Let f and g be functions and let x be a number such that f is differentiable at g(x) and g is differentiable at x. Then by the definition of differentiability,

$g(x+\delta)-g(x)= \delta g'(x) + \epsilon(\delta)\delta \,\!$

where ε(δ) → 0 as δ → 0. Similarly,

$f(g(x)+\alpha) - f(g(x)) = \alpha f'(g(x)) + \eta(\alpha)\alpha \,\!$

where η(α) → 0 as α → 0. Define also[3] that

$\eta(0) = 0 \,\!$

Now

 $f(g(x+\delta))-f(g(x))\,\!$ $= f(g(x) + \delta g'(x)+\epsilon(\delta)\delta) - f(g(x)) \,\!$ $= \alpha_\delta f'(g(x)) + \eta(\alpha_\delta)\alpha_\delta \,\!$

where

$\alpha_\delta = \delta g'(x) + \epsilon(\delta)\delta. \,\!$

Observe that as δ → 0, αδ / δg′(x) and αδ → 0, and thus η(αδ) → 0. It follows that

$\frac{f(g(x+\delta))-f(g(x))}{\delta} \to g'(x)f'(g(x))\mbox{ as } \delta \to 0\,\!$.

To prove the multivariate chain rule, we will deal with the case of functions of two variables; a similar proof can be constructed for functions of three or more variables. Let x(t), y(t) be differentiable functions of t and assume f(x, y) has a gradient. If we set $\,\Delta x = x(t + h) - x(t)$ and $\,\Delta y = y(t + h) - y(t)$, then we have:

 $f'(x(t), y(t)) = \lim_{h\rightarrow 0} \frac{f(x(t + h), y(t + h)) - f(x(t), y(t))}{h}\,\!$ $= \lim_{h\rightarrow 0} \frac{f(x + \Delta x, y + \Delta y) - f(x, y + \Delta y) + f(x, y + \Delta y) - f(x, y)}{h}\,\!$ $= \lim_{h\rightarrow 0} \frac{f(x + \Delta x, y + \Delta y) - f(x, y + \Delta y)}{h} + \lim_{h\rightarrow 0} \frac{f(x, y + \Delta y) - f(x, y)}{h}\,\!$.

When x is constant, we can regard $\,f(x, y)$ as a function $\,f_{x}(y)$ of $\,y$. Thus the limit on the right is equal to the derivative of $\,f_{x}(y(t))$, which by the single variable chain rule is $\,\frac{\partial f}{\partial y} \frac{\mathrm dy}{\mathrm dt}\,\!$.

To calculate the limit on the left, regard $\,f(x, y + \Delta y)$ as a function $\,f_{y + \Delta y}(x)$ of $\,x$. By the mean value theorem, we can select a real number $\,c \in [x, x + \Delta x]$ such that the numerator on the left limit is equal to $\,\Delta x \frac{\mathrm df_{y + \Delta y}}{\mathrm dx}(c)\,\!$. So the left limit is equal to $\lim_{h\rightarrow 0}\frac{\Delta x}{h}\frac{\mathrm df_{y + \Delta y}}{\mathrm dx}(c)$, which equals $\frac{\partial f}{\partial x} \frac{\mathrm dx}{dt}.\,\!$

Thus, it follows that

$f'(x(t), y(t)) = \frac{\partial f}{\partial x}\frac{\mathrm dx}{\mathrm dt} + \frac{\partial f}{\partial y}\frac{\mathrm dy}{\mathrm dt} = \nabla f(x, y) \cdot (x', y')\,\!$.

## The fundamental chain rule

The chain rule is a fundamental property of all definitions of derivatives and is therefore valid in much more general contexts. For instance, if E, F and G are Banach spaces (which includes Euclidean space) and f : EF and g : FG are functions, and if x is an element of E such that f is differentiable at x and g is differentiable at f(x), then the derivative (the Fréchet derivative) of the composition g o f at the point x is given by

$\mbox{D}_x\left(g \circ f\right) = \mbox{D}_{f\left(x\right)}\left(g\right) \circ \mbox{D}_x\left(f\right).$

Note that the derivatives here are linear maps and not numbers. If the linear maps are represented as matrices (namely Jacobians), the composition on the right hand side turns into a matrix multiplication.

A particularly clear formulation of the chain rule can be achieved in the most general setting: let M, N and P be Ck manifolds (or even Banach-manifolds) and let

f : MN and g : NP

be differentiable maps. The derivative of f, denoted by df, is then a map from the tangent bundle of M to the tangent bundle of N, and we may write

$\mbox{d}\left(g \circ f\right) = \mbox{d}g \circ \mbox{d}f.$

In this way, the formation of derivatives and tangent bundles is seen as a functor on the category of C manifolds with C maps as morphisms.

## Tensors and the chain rule

See tensor field for an advanced explanation of the fundamental role the chain rule plays in the geometric nature of tensors.

## Higher derivatives

Faà di Bruno's formula generalizes the chain rule to higher derivatives. The first few derivatives are

$\frac{\mathrm d (f \circ g) }{\mathrm dx} = \frac{\mathrm df}{\mathrm dg}\frac{\mathrm dg}{\mathrm dx}$
$\frac{\mathrm d^2 (f \circ g) }{\mathrm d x^2} = \frac{\mathrm d^2 f}{\mathrm d g^2}\left(\frac{\mathrm dg}{\mathrm dx}\right)^2 + \frac{\mathrm df}{\mathrm dg}\frac{\mathrm d^2 g}{\mathrm dx^2}$
$\frac{\mathrm d^3 (f \circ g) }{\mathrm d x^3} = \frac{\mathrm d^3 f}{\mathrm d g^3} \left(\frac{\mathrm dg}{\mathrm dx}\right)^3 + 3 \frac{\mathrm d^2 f}{\mathrm d g^2} \frac{\mathrm dg}{\mathrm dx} \frac{\mathrm d^2 g}{\mathrm d x^2} + \frac{\mathrm df}{\mathrm dg} \frac{\mathrm d^3 g}{\mathrm d x^3}$
$\frac{\mathrm d^4 (f \circ g) }{\mathrm d x^4} =\frac{\mathrm d^4 f}{\mathrm dg^4} \left(\frac{\mathrm dg}{\mathrm dx}\right)^4 + 6 \frac{\mathrm d^3 f}{\mathrm d g^3} \left(\frac{\mathrm dg}{\mathrm dx}\right)^2 \frac{\mathrm d^2 g}{\mathrm d x^2} + \frac{\mathrm d^2 f}{\mathrm d g^2} \left\{ 4 \frac{\mathrm dg}{\mathrm dx} \frac{\mathrm d^3 g}{\mathrm dx^3} + 3\left(\frac{\mathrm d^2 g}{\mathrm dx^2}\right)^2\right\} + \frac{\mathrm df}{\mathrm dg}\frac{\mathrm d^4 g}{\mathrm dx^4}.$

## References

1. ^ Apostol, Tom (1974). Mathematical analysis (2nd ed. ed.). Addison Wesley. Theorem 5.5.
2. ^ "The Multivariable Chain Rule". Retrieved 2009-11-06.
3. ^ To see that this is needed, suppose for example that g is a constant function.

# Wikibooks

Up to date as of January 23, 2010
(Redirected to Calculus/More Differentiation Rules article)

### From Wikibooks, the open-content textbooks collection

 ← Differentiation Calculus Higher Order Derivatives → More Differentiation Rules

## Chain Rule

We know how to differentiate regular polynomial functions. For example:

$\frac{d}{dx}(3x^3 - 6x^2 + x) = 9x^2 - 12x + 1$
$f(x)=(x^2+5)^2 \, \!$
$f(x)=x^4 + 10x^2 + 25 \, \!$
$f '(x) = 4x^3 + 20x \, \!$

However, there is a useful rule known as the chain method rule. The function above (f(x) = (x2 + 5)2) can be consolidated into two nested parts f(x) = u2, where u = m(x) = (x2 + 5). Therefore:

if
$g(u) = u^2 \, \!$ and
$u = m(x)=x^2+5 \, \!$

Then:

$f(x) = g(m(x)) \, \!$

Then

$f '(x) = g '(m (x))m'(x) \, \!$

The chain rule states that if we have a function of the form y(u(x)) (i.e. y can be written as a function of u and u can be written as a function of x) then:

$\frac{dy}{dx} = \frac{dy}{du} \cdot \frac{du}{dx}$

 Chain Rule If a function F(x) is composed to two differentiable functions g(x) and m(x), so that F(x)=g(m(x)), then F(x) is differentiable and, $F '(x)= g'(m(x))m'(x) \, \!$

We can now investigate the original function:

$\frac{dy}{du} = 2u$
$\frac{du}{dx} = 2x$

Therefore

$\frac{dy}{dx} = \frac{dy}{du} \cdot \frac{du}{dx} = 2u\cdot 2x = 2(x^2+5)(2x) = 4x^3 + 20x$

This can be performed for more complicated equations. If we consider:

$\frac{d}{dx} \sqrt{1 + x^2}$

and let $y = \sqrt{u}$ and u=1+x2, so that $\frac{dy}{du} = \frac{1}{2 \sqrt{u}}$ and $\frac{du}{dx} = 2x$, then, by applying the chain rule, we find that

$\frac d {dx} \sqrt{1 + x^2} = \frac {1} {2 \sqrt {1 + x^2}}\cdot 2x = \frac {x} \sqrt {1 + x^2}$

So, in just plain words, for the chain rule you take the normal derivative of the whole thing (make the exponent the coefficient, then multiply by original function but decrease the exponent by 1) then multiply by the derivative of the inside.

## Product and Quotient Rules

When we wish to differentiate a more complicated expression such as:

$h(x) = (x^2+5)^5 \cdot (x^3 + 2)^3$

our only way (up to this point) to differentiate the expression is to expand it and get a polynomial, and then differentiate that polynomial. This method becomes very complicated and is particularly error prone when doing calculations by hand. It is advantageous to find the derivative of h(x) using just the functions f(x) = (x2+5)5 and g(x) = (x3 + 2)3 and their derivatives.

 Derivatives of products (Product rule) $\frac{d}{dx}\left[ f(x) \cdot g(x) \right] = f'(x) \cdot g(x)+f(x) \cdot g'(x)\,\!$

What this rule basically means is that if one has a function that is the product of two functions, then all one has to do is differentiate the first function, multiply it by the other undifferentiated function, add that to the first function undifferentiated multiplied by the differentiated second function. For example, if one were to take the function

$H(x) = (x+2)^3 \cdot 2(x+1)^2$

its derivative would not be

${\color{red}3(x+2)^2 \cdot 4(x+1)}$

$3(x+2)^2 \cdot 2(x+1)^2 + (x+2)^3 \cdot 4(x+1)$

Another way of approaching this is if one were to have a function that was a product of the two functions A and B

$h(x) = A \cdot B$

Its derivative would be

$h'(x) = A' \cdot B + A \cdot B'$

### Proof

Proving this rule is relatively straightforward, first let us state the equation for the derivative:

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

We will then apply one of the oldest tricks in the book—adding a term that cancels itself out to the middle:

$\frac{d}{dx} \left[ f(x) \cdot g(x) \right] = \lim_{h \to 0} \frac{ f(x+h)\cdot g(x+h) \mathbf{- f(x) \cdot g(x+h) + f(x) \cdot g(x+h)} - f(x) \cdot g(x)}{h}$

Notice that those terms sum to zero, and so all we have done is add 0 to the equation.

Now we can split the equation up into forms that we already know how to solve:

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

Looking at this, we see that we can separate the common terms out of the numerators to get:

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

Which, when we take the limit, becomes:

$\frac{d}{dx} \left[ f(x) \cdot g(x) \right] = f(x) \cdot g'(x) + g(x) \cdot f'(x)$, or the mnemonic "one D-two plus two D-one"

This can be extended to 3 functions:

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

For any number of functions, the derivative of their product is the sum, for each function, of its derivative times each other function.

### Application, proof of the power rule

The product rule can be used to give a proof of the power rule for whole numbers. The proof proceeds by mathematical induction. We begin with the base case n = 1. If f1(x) = x then from the definition is easy to see that

$f_1'(x) = \lim _{ h \rightarrow 0} \frac {x+h - x} h = 1$

Next we suppose that for fixed value of N, we know that for fN(x) = xN, fN'(x) = NxN − 1. Consider the derivative of fN + 1(x) = xN + 1,

$f_{N+1}'(x) = ( x \cdot x^N) ' = (x)' x^N + x\cdot(x^N)'= x^N + x\cdot N\cdot x^{N-1} = (N+1)x^N.$

We have shown that the statement $f_n'(x)=n\cdot x^{n-1}$ is true for n = 1 and that if this statement holds for n = N, then it also holds for n = N + 1. Thus by the principle of mathematical induction, the statement must hold for $n=1, 2, \dots$.

### Quotient rule

For quotients, where one function is divided by another function, the equation is more complicated but it is simply a special case of the product rule.

$\frac{f(x)}{g(x)} = f(x) \cdot g(x)^{-1}$

Then we can just use the product rule and the chain rule:

$\frac{d}{dx} \frac{f(x)}{g(x)} = f'(x) \cdot g(x)^{-1} - f(x) \cdot g'(x) \cdot g(x)^{-2}$

We can then multiply through by 1, or more precisely: g(x)2 / g(x)2, which cancels out into 1, to get:

$\frac{d}{dx} \frac{f(x)}{g(x)} = \frac{f'(x) \cdot g(x)}{g(x)^2} - \frac{ f(x) \cdot g'(x) }{g(x)^{2}}$

This leads us to the so-called "quotient rule":

 Derivatives of quotients (Quotient Rule) $\frac{d}{dx} \left[{f(x)\over g(x)}\right] = \frac{f'(x) \cdot g(x) - f(x) \cdot g'(x)}{g(x)^2}\,\!$

Which some people remember with the mnemonic "low D-high minus high D-low (over) square the low and away we go!"

### Examples

The derivative of (4x − 2) / (x2 + 1) is:

\begin{align} \frac{d}{dx}\left[\frac{(4x - 2)}{x^2 + 1}\right] &= \frac{(x^2 + 1)(4) - (4x - 2)(2x)}{(x^2 + 1)^2} \ &= \frac{(4x^2 + 4) - (8x^2 - 4x)}{(x^2 + 1)^2} \ &= \frac{-4x^2 + 4x + 4}{(x^2 + 1)^2} \end{align}

Remember: the derivative of a product/quotient is not the product/quotient of the derivatives. (That is, differentiation does not distribute over multiplication or division.) However one can distribute before taking the derivative. That is $\frac{d}{dx}\left((a+b)\times(c+d)\right) = \frac{d}{dx}\left(ac+ad+bc+bd\right)$

## Implicit Differentiation

Generally, one will encounter functions expressed in explicit form, that is, y = f(x) form. You might encounter a function that contains a mixture of different variables. Many times it is inconvenient or even impossible to solve for y. A good example is the function $y^2 + 2yx + 3 = 5x \,$. It is too cumbersome to isolate y in this function. One can utilize implicit differentiation to find the derivative. To do so, consider y to be a nested function that is defined implicitly by x. You need to employ the chain rule whenever you take the derivative of a variable with respect to a different variable: i.e., $\frac{d}{dx}$ (the derivative with respect to x) of x is 1; $\frac{d}{dx}$ of y is $\frac{dy}{dx}$.

Remember:

$\frac{dy}{dx} = \frac{dy}{du} \cdot \frac{du}{dx}$

Therefore:

$\frac{d}{dx} (y^3) = \frac{d}{dy} (y^3) \frac{dy}{dx}=3y^2 \cdot \frac{dy}{dx} \$

### Examples

Example 1
$xy \,=1$

can be solved as:

$y=\frac{1}{x}$

then differentiated:

$\frac{dy}{dx}=-\frac{1}{x^2}$

However, using implicit differentiation it can also be differentiated like this:

$\frac{d}{dx}[xy]=\frac{d}{dx}[1]$

use the product rule:

$x\frac{dy}{dx}+y=0$

solve for $\frac{dy}{dx}$:

$\frac{dy}{dx}=-\frac{y}{x}$

Note that, if we substitute $y=\frac{1}{x}$ into $\frac{dy}{dx}=-\frac{y}{x}$, we end up with $\frac{dy}{dx}=-\frac{1}{x^2}$ again.

Example 2

Find the derivative of y2 + x2 = 25 with respect to x.

You are seeking $dy \over dx$.

Take the derivative of each side of the equation with respect to x.

$\frac{d (y^2 + x^2)}{dx} = \frac{d(25)}{dx}$
$2y \cdot \frac{dy}{dx} + 2x = 0$
$2y \cdot \frac{dy}{dx} = -2x$
$\frac{dy}{dx} = -\frac{x}{y}$

## Exponential, logarithmic, and trigonometric functions

### Exponential

To determine the derivative of an exponent requires use of the symmetric difference equation for determining the derivative:

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

First we will solve this for the specific case of an exponent with a base of e and then extend it to the general case with a base of a where a is a positive real number.

First we set up our problem using f(x) = ex:

$\frac{d}{dx} e^x = \lim_{h \to 0} \frac{e^{x+h} - e^{x-h}}{2h}$

Then we apply some basic algebra with powers (specifically that ab + c = ab ac):

$\frac{d}{dx} e^x = \lim_{h \to 0} \frac{e^{x} e^{h} - e^{x} e^{-h} }{2h}$

Treating ex as a constant with respect to what we are taking the limit of, we can use the limit rules to move it to the outside, leaving us with:

$\frac{d}{dx} e^x = e^x \cdot \lim_{h \to 0} \frac{e^{h} - e^{-h} }{2h}$

A careful examination of the limit reveals a hyperbolic sine:

$\frac{d}{dx} e^x = e^x \cdot \lim_{h \to 0} \frac{\sinh(h)}{h}$

The limit of $\sinh(h) \over h$ as h approaches 0 is equal to 1 (using L'Hopital's rule), leaving us with:

 Derivative of the exponential function $\frac{d}{dx}e^x = e^x\,\!$

in which f'(x) = f(x).

Now that we have derived a specific case, let us extend things to the general case. Assuming that a is a positive real constant, we wish to calculate:

$\frac{d}{dx}a^x$

One of the oldest tricks in mathematics is to break a problem down into a form that we already know we can handle. Since we have already determined the derivative of ex, we will attempt to rewrite ax in that form.

Using that eln(c) = c and that ln(ab) = b · ln(a), we find that:

$a^x = e^{x \cdot \ln(a)}$

Thus, we simply apply the chain rule:

$\frac{d}{dx}e^{x \cdot \ln(a)} = \left[ \frac{d}{dx} x\cdot \ln(a) \right] e^{x \cdot \ln(a)}$

In which we can solve for the derivative and substitute back with ex · ln(a) = ax to get:

 Derivative of the exponential function $\frac{d}{dx}a^x = \ln\left(a\right)a^x\,\!$

### Logarithms

Closely related to the exponentiation is the logarithm. Just as with exponents, we will derive the equation for a specific case first (the natural log, where the base is e), and then work to generalize it for any logarithm.

First let us create a variable y such that:

$y = \ln\left(x\right)$

It should be noted that what we want to find is the derivative of y or $\frac{dy}{dx}$.

Next we will put both sides to the power of e in an attempt to remove the logarithm from the right hand side:

ey = x

Now, applying the chain rule and the property of exponents we derived earlier, we take the derivative of both sides:

$\frac{dy}{dx} \cdot e^y = 1$

This leaves us with the derivative:

$\frac{dy}{dx} = \frac{1}{e^y}$

Substituting back our original equation of x = ey, we find that:

 Derivative of the Natural Logarithm $\frac{d}{dx}\ln\left(x\right) = \frac{1}{x}\,\!$

If we wanted, we could go through that same process again for a generalized base, but it is easier just to use properties of logs and realize that:

$\log_b(x) = \frac{\ln(x)}{\ln(b)}$

Since 1 / ln(b) is a constant, we can just take it outside of the derivative:

$\frac{d}{dx}\log_b(x) = \frac{1}{\ln(b)} \cdot \frac{d}{dx} \ln(x)$

Which leaves us with the generalized form of:

 Derivative of the Logarithm $\frac{d}{dx}\log_b\left(x\right) = \frac{1}{x\ln\left(b\right)}\,\!$

### Trigonometric Functions

Sine, Cosine, Tangent, Cosecant, Secant, Cotangent. These are functions that crop up continuously in mathematics and engineering and have a lot of practical applications. They also appear in more advanced mathematics, particularly when dealing with things such as line integrals with complex numbers and alternate representations of space like spherical and cylindrical coordinate systems.

We use the definition of the derivative, i.e.,

$f'(x) = \lim_{h \to 0}\frac{f(x+h)-f(x)}{h}$,

to work these first two out.

Let us find the derivative of sin x, using the above definition.

 $f(x) = \sin{x} \, \!$ $f'(x) = \lim_{h \to 0}{\sin(x+h)-\sin{x} \over h}$ Definition of derivative $= \lim_{h \to 0}{\cos(x)\sin(h)+\cos(h)\sin(x) - sin(x) \over h}$ trigonometric identity $= \lim_{h \to 0}{\cos(x)\sin(h)+(\cos(h) - 1)\sin(x) \over h}$ factoring $= \lim_{h \to 0}{\cos(x)\sin(h) \over h}$ $+\lim_{h \to 0}{(\cos(h) - 1)\sin(x) \over h}$ separation of terms $= \cos{x} \, \! \times 1 + \sin{x} \, \! \times 0$ application of limit $= \cos{x} \, \!$ solution

Now for the case of cos x

 $f(x) = \cos{x} \, \!$ $f'(x) = \lim_{h \to 0}{\cos(x+h)-\cos{x} \over h}$ Definition of derivative $= \lim_{h \to 0}{\cos(x)\cos(h)-\sin(h)\sin(x) - cos(x) \over h}$ trigonometric identity $= \lim_{h \to 0}{\cos(x)(\cos(h) - 1)-\sin(x)\sin(h) \over h}$ factoring $=\lim_{h \to 0}{\cos(x)(\cos(h) - 1) \over h}$ $- \lim_{h \to 0}{\sin(x)\sin(h) \over h}$ separation of terms $= \cos{x} \, \! \times 0 - \sin{x} \, \! \times 1$ application of limit $= -\sin{x} \, \!$ solution

Therefore we have established

 Derivative of Sine and Cosine $\frac{d}{dx} \sin(x) = \cos(x)\,\!$ $\frac{d}{dx} \cos(x) = -\sin(x)\,\!$

To find the derivative of the tangent, we just remember that:

$\tan(x) = \frac{\sin(x)}{\cos(x)}$

which is a quotient. Applying the quotient rule, we get:

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

Then, remembering that cos2(x) + sin2(x) = 1, we simplify:

 $\frac{\cos^2(x) + \sin^2(x)}{\cos^2(x)}$ $=\frac{1}{\cos^2(x)}$ $=\sec^2(x)\,$
 Derivative of the Tangent $\frac{d}{dx} \tan(x) = \sec^2(x)\,\!$

For secants, we just need to apply the chain rule to the derivations we have already determined.

$\sec(x) = \frac{1}{\cos(x)}$

So for the secant, we state the equation as:

$\sec(x) = \frac{1}{u}$
u(x) = cos(x)

Take the derivative of both equations, we find:

$\frac{d}{dx} \sec(x) = \frac{-1}{u^2} \cdot \frac{du}{dx}$
$\frac{du}{dx} = -\sin(x)$

Leaving us with:

$\frac{d}{dx} \sec(x) = \frac{\sin(x)}{\cos^2(x)}$

Simplifying, we get:

 Derivative of the Secant $\frac{d}{dx} \sec(x) = \sec(x) \tan(x)\,\!$

Using the same procedure on cosecants:

$\csc(x) = \frac{1}{\sin(x)}$

We get:

 Derivative of the Cosecant $\frac{d}{dx} \csc(x) = -\csc(x) \cot(x)\,\!$

Using the same procedure for the cotangent that we used for the tangent, we get:

 Derivative of the Cotangent $\frac{d}{dx} \cot(x) = -\csc^2(x) \,\!$

### Inverse Trigonometric Functions

Arcsine, arccosine, arctangent. These are the functions that allow you to determine the angle given the sine, cosine, or tangent of that angle.

y = arcsin(x)

To find dy/dx we first need to break this down into a form we can work with:

x = sin(y)

Then we can take the derivative of that:

$1 = \cos(y) \cdot \frac{dy}{dx}$

...and solve for dy / dx:

$\frac{dy}{dx} = \frac{1}{\cos(y)}$

At this point we need to go back to the unit triangle. Since y is the angle and the opposite side is sin(y) (which is equal to x), the adjacent side is cos(y) (which is equal to the square root of 1 minus x2, based on the Pythagorean theorem), and the hypotenuse is 1. Since we have determined the value of cos(y) based on the unit triangle, we can substitute it back in to the above equation and get:

 Derivative of the Arcsine $\frac{d}{dx} \arcsin(x) = \frac{1}{\sqrt{1-x^2}}\,\!$

We can use an identical procedure for the arccosine and arctangent:

 Derivative of the Arccosine $\frac{d}{dx} \arccos(x) = \frac{-1}{\sqrt{1-x^2}}\,\!$ Derivative of the Arctangent $\frac{d}{dx} \arctan(x) = \frac{1}{1+x^2}\,\!$

### Logarithmic differentiation

We can use the properties of the logarithm, particularly the natural log, to differentiate more difficult functions, such a products with many terms, quotients of composed functions, or functions with variable or function exponents. We do this by taking the natural logarithm of both sides, re-arranging terms using the logarithm laws below, and then differentiating both sides implicitly, before multiplying through by y.

 $\log\left(\frac{a}{b}\right) = \log(a) - \log(b)$ $\log(a^n) = n\log(a)\,\!$ $\log(a) + \log(b) = \log(ab)\,\!$

See the examples below.

Example 1
 Suppose we wished to differentiate $y = \frac{(6x^2+9)^2}{\sqrt{3x^3-2}}$ We take the natural logarithm of both sides \begin{align} \ln(y) & = \ln\Bigg(\frac{(6x^2+9)^2}{\sqrt{3x^3-2}}\Bigg) \ & = \ln(6x^2+9)^2 - \ln(3x^3-2)^{\frac{1}{2}} \ & = 2\ln(6x^2+9) - \frac{1}{2}\ln(3x^3-2) \ \end{align} Differentiating implicitly \begin{align} \frac{1}{y} \frac{dy}{dx} & = 2 \times \frac{12x}{6x^2+9} - \frac{1}{2} \times \frac{9x^2}{3x^3-2} \ & = \frac{24x}{6x^2+9} - \frac{\frac{9}{2}x^2}{3x^3-2} \ & = \frac{24x(3x^3-2) - \frac{9}{2}x^2(6x^2+9)}{(6x^2+9)(3x^3-2)} \ \end{align} Multiplying by y $\frac{dy}{dx} = \frac{(6x^2+9)^2}{\sqrt{3x^3-2}} \times \frac{24x(3x^3-2) - \frac{9}{2}x^2(6x^2+9)}{(6x^2+9)(3x^3-2)}$
Example 2
 Let us differentiate a function $y=x^x\,\!$ Taking the natural logarithm of left and right \begin{align} \ln y & = \ln(x^x) \ & = x\ln(x) \ \end{align} We then differentiate both sides, recalling the product rule \begin{align} \frac{1}{y} \frac{dy}{dx} & = \ln(x) + x\frac{1}{x} \ & = \ln(x) + 1 \ \end{align} Multiplying by the original function y $\frac{dy}{dx} = x^x(\ln(x) + 1)$
Example 3
 Take a function $y=x^{6\cos(x)}\,\!$ Then \begin{align} \ln y & = \ln(x^{6\cos(x)})\,\! \ & = 6\cos(x)\ln(x)\,\! \ \end{align} We then differentiate $\frac{1}{y} \frac{dy}{dx} = -6\sin(x)\ln(x)+\frac{6\cos(x)}{x}$ And finally multiply by y $\frac{dy}{dx} = x^{6\cos(x)}\Bigg(-6\sin(x)\ln(x)+\frac{6\cos(x)}{x}\Bigg)$

## Exercises

Given the above rules, practice differentiation on the following.

1. $\frac{d}{dx}[(x^3 + 5)^{10}] \, \!$
2. $\frac{d}{dx}[x^3 + 3x] \, \!$
3. $\frac{d}{dx}[(x+4)\cdot (x+2)\cdot (x-3)]$
4. $\frac{d}{dx}[\frac{x+1}{3x^2}]$
5. $\frac{d}{dx}[3\cdot x^3]$
6. $\frac{d}{dx}[\sin x \cdot x^4]$
7. $\frac{d}{dx}[2^x]$
8. $\frac{d}{dx}[e^{x^2}]$
9. $\frac{d}{dx}[ e^{2^x} ]$
10. $\frac{d}{dx}[ (6x)^{\cos(x) + 1} ]$