The page you are reading is part of a draft (v2.0) of the "No bullshit guide to math and physics."

The text has since gone through many edits and is now available in print and electronic format. The current edition of the book is v4.0, which is a substantial improvement in terms of content and language (I hired a professional editor) from the draft version.

I'm leaving the old wiki content up for the time being, but I highly engourage you to check out the finished book. You can check out an extended preview here (PDF, 106 pages, 5MB).


Derivative rules

Taking derivatives is a simple task: you just have to lookup the appropriate formula in the table of derivative formulas. However the tables of derivatives usually don't have the formulas for composite functions. In this section, we will learn about some important rules for derivatives, so that you will know how to handle derivatives of composite functions.

Formulas

Linearity

The derivative of a sum of two functions is the sum of the derivatives: \[ \left[f(x) + g(x)\right]^\prime= f^\prime(x) + g^\prime(x), \] and for any constant $a$, we have \[ \left[a f(x)\right]^\prime= a f^\prime(x). \] The fact that the derivative operation obeys these two conditions means that derivatives are linear operations.

Product rule

The derivative of a product of two functions is obtained as follows: \[ \left[ f(x)g(x) \right]^\prime = f^\prime(x)g(x) + f(x)g^\prime(x). \]

Quotient rule

As a special case the product rule, we obtain the derivative rule for a fraction of two functions: \[ \frac{d}{dx}\left[ \frac{f(x)}{g(x)}\right]^\prime=\frac{f'(x)g(x)-f(x)g'(x)}{g(x)^2}. \]

Chain rule

If you have a situation with an inner function and outer function like $f(g(x))$, then the derivative is obtained in a two step process: \[ \left[ f(g(x)) \right]^\prime = f^\prime(g(x))g^\prime(x). \] In the first step you leave $g(x)$ alone and focus on taking the derivative of the outer function. Just copy over whatever $g(x)$ is inside the $f'$ expression. The second step is to multiply the resulting expression by the derivative of the inner function $g'(x)$.

In words, the chain rule tells us that the rate of change of a composite function can be calculated as the product of the rate of change of the components.

Example

\[ \frac{d}{dx}\left[ \sin(x^2)) \right] = \cos(x^2)[x^2]' = \cos(x^2)2x. \]

More complicated example

The chain rule also applies to functions of functions of functions $f(g(h(x)))$. To take the derivative, just start from the outermost function and then work your way towards $x$. \[ \left[ f(g(h(x))) \right]' = f'(g(h(x))) g'(h(x)) h'(x). \] Now let's try this \[ \frac{d}{dx} \left[ \sin( \ln( x^3) ) \right] = \cos( \ln(x^3) ) \frac{1}{x^3} 3x^2 = \cos( \ln(x^3) ) \frac{3}{x}. \] Simple right?

Examples

The above rules are all that you need to take the derivative of any function no matter how complicated. To convince you of this, I will now show you some examples of really hairy functions. Don't be scared by complexity: as long as you follow the rules, you will get the right answer in the end.

Example

Calculate the derivative of \[ f(x) = e^{x^2}. \] We just need the chain rule for this one: \[ \begin{align} f'(x) & = e^{x^2}[x^2]' \nl & = e^{x^2}2x. \end{align} \]

Example 2

\[ f(x) = \sin(x)e^{x^2}. \] We will need the product rule for this one: \[ \begin{align} f'(x) & = \cos(x)e^{x^2} + \sin(x)2xe^{x^2}. \end{align} \]

Example 3

\[ f(x) = \sin(x)e^{x^2}\ln(x). \] This is still the product rule, but now we will have three terms. In each term, we take the derivative of one of the functions and multiply by the other two: \[ \begin{align} f'(x) & = \cos(x)e^{x^2}\ln(x) + \sin(x)2xe^{x^2}\ln(x) + \sin(x)e^{x^2}\frac{1}{x}. \end{align} \]

Example 4

Ok let's go crazy now: \[ f(x) = \sin\!\left( \cos\!\left( \tan(x) \right) \right). \] We need a triple chain rule for this one: \[ \begin{align} f'(x) & = \cos\!\left( \cos\!\left( \tan(x) \right) \right) \left[ \cos\!\left( \tan(x) \right) \right]^\prime \nl & = -\cos\!\left( \cos\!\left( \tan(x) \right) \right) \sin\!\left( \tan(x) \right)\left[ \tan(x) \right]^\prime \nl & = -\cos\!\left( \cos\!\left( \tan(x) \right) \right) \sin\!\left( \tan(x) \right)\sec^2(x). \end{align} \]

Explanations

Proof of the product rule

By definition, the derivative of $f(x)g(x)$ is \[ \left( f(x)g(x) \right)' = \lim_{\epsilon \rightarrow 0} \frac{f(x+\epsilon)g(x+\epsilon)-f(x)g(x)}{\epsilon}. \] Consider the numerator of the fraction. If we add and subtract $f(x)g(x+\epsilon)$, we can factor the expression into two terms like this: \[ \begin{align} & f(x+\epsilon)g(x+\epsilon) \ \overbrace{-f(x)g(x+\epsilon) +f(x)g(x+\epsilon)}^{=0} \ - f(x)g(x) \nl & \ \ \ = [f(x+\epsilon)-f(x) ]g(x+\epsilon) + f(x)[ g(x+\epsilon)- g(x)], \end{align} \] thus the expression for the derivative of the product becomes \[ \left( f(x)g(x) \right)' = \left\{ \lim_{\epsilon \rightarrow 0} \frac{[f(x+\epsilon)-f(x) ]}{\epsilon}g(x+\epsilon) + f(x) \frac{[ g(x+\epsilon)- g(x)]}{\epsilon} \right\}. \] This looks almost exactly like the product rule formula, except that we have $g(x+\epsilon)$ instead of $g(x)$. This is not a problem, though, since we assumed that $f(x)$ and $g(x)$ are differentiable functions, which implies that they are continuous functions. For continuous functions, we have $\lim_{\epsilon \rightarrow 0}g(x+\epsilon) = g(x)$ and we obtain the final form of the product rule: \[ \left( f(x)g(x) \right)' = f'(x)g(x) + f(x)g'(x). \]

Proof of the chain rule

Before we begin the proof, I want to make a remark on the notation used in the definition of the derivative. I like the greek letter epsilon $\epsilon$ so I defined the derivative of $f(x)$ as \[ f'(x)=\lim_{\epsilon \rightarrow 0} \frac{f(x+\epsilon)-f(x)}{\epsilon}, \] but I could have used any other variable instead: \[ f'(x) \equiv \lim_{\delta \rightarrow 0} \frac{f(x+\delta)-f(x)}{\delta} \equiv \lim_{h \rightarrow 0} \frac{f(x+h)-f(x)}{h}. \] All that matters is that we divide by the same quantity that is added to $x$ in the numerator, and that this quantity goes to zero.

The derivative of $f(g(x))$ is \[ \left( f(g(x)) \right)' = \lim_{\epsilon \rightarrow 0} \frac{f(g(x+\epsilon))-f(g(x))}{\epsilon}. \] The trick is to define a new quantity \[ \delta = g(x+\epsilon)-g(x), \] and then substitute $g(x+\epsilon) = g(x) + \delta$ into the expression for the derivative as follows \[ \left( f(g(x)) \right)' = \lim_{\epsilon \rightarrow 0} \frac{f(g(x) + \delta)-f(g(x))}{\epsilon}. \] This is starting to look more like a derivative formula, but the quantity added in the input is different from the quantity by which we divide. To fix this we will multiply and divide by $\delta$ to obtain \[ \lim_{\epsilon \rightarrow 0} \frac{f(g(x) + \delta)-f(g(x))}{\epsilon}\frac{\delta}{\delta} = \lim_{\epsilon \rightarrow 0} \frac{f(g(x) + \delta)-f(g(x))}{\delta}\frac{\delta}{\epsilon}. \] We now use the definition of the quantity $\delta$ and rearrange the fraction as follows: \[ \left( f(g(x)) \right)' = \lim_{\epsilon \rightarrow 0} \frac{f(g(x) + \delta)-f(g(x))}{\delta}\frac{g(x+\epsilon)-g(x)}{\epsilon}. \] This is starting to look a lot like $f'(g(x))g'(x)$, and in fact it is: taking the limit $\epsilon \to 0$ implies that the quantity $\delta(\epsilon) \to 0$. This is because the function $g(x)$ is continuous: $\lim_{\epsilon \rightarrow 0} g(x+\epsilon)-g(x)=0$. And so the quantity $\delta$ is just as good as $\epsilon$ for taking a derivative. Thus, we have proved that: \[ \left( f(g(x)) \right)' = f'(g(x))g'(x). \]

Alternate notation

The presence of so much primes and brackets in the above expressions can make them difficult to read. This is why we sometimes use a different notation for derivatives. The three rules of derivatives in the alternate notation are as follows:

Linearity: \[ \frac{d}{dx}(\alpha f(x) + \beta g(x))= \alpha\frac{df}{dx} + \beta\frac{dg}{dx}. \] Product rule: \[ \frac{d}{dx}(f(x)g(x)) = \frac{df}{dx}g(x) + f(x)\frac{dg}{dx}. \] Chain rule: \[ \frac{d}{dx}\left( f(g(x)) \right) = \frac{df}{dg}\frac{dg}{dx}. \]

 
home about buy book