MAT1001 Differential Calculus: Lecture Notes
Chapter 3 Differentiation
You take a function of \(x\) and you call it \(y\).
Take any \(x_{0}\) that you care to try.
You make a little change and call it \(\Delta x\).
The corresponding change in \(y\) is what you find next.
The Derivative Song by Tom Lehrer
3.1 Differentiation from first principles
In the previous chapter, we encountered the derivative of a function at a point in eq. (2.17) and its interpretation as the tangent to a curve at the point \(a\). With a small amount of rewriting, setting \(x=a+h\) for \(x\) “near” \(a\), this becomes
\(\seteqnumber{0}{3.}{0}\)\begin{align*} f'(a)&=\lim _{x\to a}\frac {f(x)-f(a)}{x-a}\\ &=\lim _{h\to 0}\frac {f(a+h)-f(a)}{a+h-a}\\ &=\lim _{h\to 0}\frac {f(a+h)-f(a)}{h}. \end{align*} This is still an expression for the tangent to a curve at a specific point \(x=a\). However, if we are interested in the gradient at an arbitrary point \(x\), then we can rewrite it as
\(\seteqnumber{0}{3.}{0}\)\begin{equation} f'(x)=\lim _{h\to 0}\frac {f(x+h)-f(x)}{h}. \label {eq: derivative definition} \end{equation}
The formula in eq. (3.1) is the definition of the derivative of the function \(f(x)\). Not that only functions where the derivative exists for all points are called differentiable. There is a range of notation1 and terminology used to denote derivative. The notation used above, \(f'(x)\) is known as the Lagrange or Euler notation2. The other very common notation is due to Leibniz where we write
\(\seteqnumber{0}{3.}{1}\)\begin{equation} \frac {\ud f}{\ud x}=\lim _{h\to 0}\frac {f(x+h)-f(x)}{h}, \label {eq: Leibniz definition} \end{equation}
this notation is particularly useful when we learn about integration as in certain contexts we can treat the derivative like a fraction.
1 We will only use the two most common notations in this course. However, another notation that you may see in books is \(f_{x}(x)\), where the subscript shows what we are differentiating with respect to. This notation shows up a lot if we have functions of more than one variable where we need to make it clear which variable we are differentiating with respect to. In the assessed part of this course we will only care about functions of one variable so do not need this notation.
2 In an example of Sigler’s law of eponymy, this is most commonly called Lagrange’s notation even though it was first used by Euler. It is also quite close to the original notation that Newton used when he discovered calculus and referred to it as the method of fluxions.
-
Mathematical Diversion 3.1. In eq. (3.2) it looks like the right hand side is a fraction. This is not true, other than in certain very specific circumstances, we will not see \(\ud f\) or \(\ud x\) appearing on their own. In Newton’s approach the Newton quotient is sometimes written as
\(\seteqnumber{0}{3.}{2}\)\begin{equation*} \frac {\Delta f}{\Delta x}=\frac {f(x)-f(a)}{x-a}, \end{equation*}
which does make sense as a fraction. The limit where this becomes the derivative is when the change in \(x\), \(\Delta x=x-a\), goes to zero. In this limit if we really had a fraction it would look like \(0/0\), which is one of the nonsense expressions that we mentioned earlier. The power of calculus is that it enables us to make sense of this limit, but what we loose is the ability to treat it as a fraction. When we discuss integration and differential equations later on in the module we will return to this idea.
If we use eq. (3.1) to calculate the derivative of a function this is called differentiation by first principles. As you might expect, when the function
\(f(x)\) becomes more complicate calculating the derivative in this way becomes more complicated as well. Fortunately, there are certain standard rules and techniques that we can learn to simplify matters. With a little work all of these can be proved from the definition
of the derivative, some of these proofs will be given here but others are left as an exercise to the interested reader.
As a warm up we will use eq. (3.1) to calculate the derivative of a straight line.
-
Example 3.1. Consider \(f(x)=mx+c\) and calculate the derivative from first principles:
\(\seteqnumber{0}{3.}{2}\)\begin{align*} f'(x) &=\lim _{h\to 0}\frac {f(x+h)-f(x)}{h}\\ &=\lim _{h\to 0}\frac {m(x+h)+c-(mx+c)}{h}\\ &=\lim _{h\to 0}\frac {mx+mh+c-mx-c}{h}\\ &=\lim _{h\to 0}m\frac {h}{h}\\ &=\lim _{h\to 0}m=m. \end{align*} So derivative of a straight lime is a constant, the gradient of the line. We already knew this, but it is a good consistency check to ensure that our definition of the derivative is working as expected.
-
Example 3.2. Consider the function \(f(x)=4x^2 -6x +2\), using eq. (3.1) we calculate its derivative as follows:
\(\seteqnumber{0}{3.}{2}\)\begin{align*} f'(x) &=\lim _{h\to 0}\frac {f(x+h)-f(x)}{h}\\ &=\lim _{h\to 0}\frac {4(x+h)^2 -6(x+h) +2)-(4x^2 -6x +2)}{h}\\ &=\lim _{h\to 0}\frac {4(x^{2}+2xh+h^{2})-6x-6h+2-4x^{2}+6x-2}{h}\\ &=\lim _{h\to 0}\frac {8xh+4h^{2}}{h}\\ &=\lim _{h\to 0}\left (8x+4h\right )=8x. \end{align*} Notice that since the curve is no longer a straight line the derivative , and thus the gradient of the tangent to the curve, depends where the point is along the curve.
Remember that if the limit in eq. (3.1) does not exist at a particular value of \(x\), then the derivative does not exist. In other words, the definition of the derivative only makes sense for functions which satisfy the condition of differentiability.
-
Example 3.3. Consider the function
\(\seteqnumber{0}{3.}{2}\)\begin{equation*} g(x)=\frac {1}{x+1}, \end{equation*}
and calculate its derivative. Note that this function has a discontinuity at \(x=-1\) so it will not be differentiable at that point.
Calculating \(g'(x)\) is good practice as we need to be careful when we have fractions.
\(\seteqnumber{0}{3.}{2}\)\begin{align*} g'(x) &=\lim _{h\to 0}\frac {g(x+h)-g(x)}{h}\\ &=\lim _{h\to 0}\frac {1}{h}\left (\frac {1}{x+h+1}-\frac {1}{x+1}\right )\\ &=\lim _{h\to 0}\frac {1}{h}\left (\frac {x+1}{(x+h+1)(x+1)}-\frac {x+h+1}{(x+1)(x+h+1)}\right )\\ &=\lim _{h\to 0}\frac {1}{h}\left (\frac {x+1-x-h-1}{(x+h+1)(x+1)}\right )\\ &=\lim _{h\to 0}\frac {1}{h}\left (\frac {-h}{(x+h+1)(x+1)}\right )\\ &=\lim _{h\to 0}\frac {-1}{(x+h+1)(x+1)}\\ &=-\frac {1}{(x+1)^{2}}. \end{align*}
We can also calculate the derivatives of some of the special functions from first principles.
-
Example 3.4. Consider \(f(x)=\sin (x)\), this is a continuous function so we can hope that the derivative exists. Note that we can use the addition formula for \(\sin (x)\) to expand \(\sin (x+h)\) as
\(\seteqnumber{0}{3.}{2}\)\begin{equation*} \sin (x+h)=\sin (x)\cos (h)+\sin (h)\cos (x). \end{equation*}
Thus eq. (3.1) becomes
\(\seteqnumber{0}{3.}{2}\)\begin{align*} f'(x) &=\lim _{h\to 0}\frac {f(x+h)-f(x)}{h}\\ &=\lim _{h\to 0}\frac {\sin (x+h)-\sin (x)}{h}\\ &=\lim _{h\to 0}\frac {\sin (x)\cos (h)+\sin (h)\cos (x)-\sin (x)}{h}\\ &=\lim _{h\to 0}\left (\sin (x)\frac {\cos (h)-1}{h}+\cos (x)\frac {\sin (h)}{h}\right )\\ &=\sin (x)\lim _{h\to 0}\frac {\cos (h)-1}{h}+\cos (x)\lim _{h\to 0}\frac {\sin (h)}{h}\\ &=\cos (x), \end{align*} where we have used the trig limits from eqs. (2.11) and (2.12)
-
Example 3.6. Consider \(f(x)=e^{x}\), its derivative is
\(\seteqnumber{0}{3.}{2}\)\begin{align*} f'(x) &=\lim _{h\to 0}\frac {f(x+h)-f(x)}{h}\\ &=\lim _{h\to 0}\frac {e^{x+h}-e^{x}}{h}\\ &=\lim _{h\to 0}\frac {e^{x}e^{h}-1}{h}\\ &=e^{x}\lim _{h\to 0}\frac {e^{h}-1}{h}\\ &=e^{x}. \end{align*} Where we use eq. (2.13) to evaluate the limit in the final line. This result that the derivative of \(e^{x}\) is equal to \(e^{x}\), is sometimes taken to be a definition of the exponential function.
The other standard derivative that you need to know is the derivative of the natural logarithm.
-
Example 3.7. Consider \(f(x)=\ln (x)\), we calculate its derivative as
\(\seteqnumber{0}{3.}{2}\)\begin{align*} f'(x) &=\lim _{h\to 0}\frac {f(x+h)-f(x)}{h}\\ &=\lim _{h\to 0}\frac {\ln (x+h)-\ln (x)}{h}\\ &=\lim _{h\to 0}\frac {1}{h}\ln \left (\frac {x+h}{x}\right )\\ &=\lim _{h\to 0}\frac {1}{h}\ln \left (1+\frac {h}{x}\right ), \end{align*} now we can let \(\epsilon =h/x\) which is tending to zero as \(h\) tends to zero. Thus the derivative becomes
\(\seteqnumber{0}{3.}{2}\)\begin{align*} f'(x) &=\lim _{\epsilon \to 0}\frac {1}{x\epsilon }\ln \left (1+\epsilon \right )\\ &=\frac {1}{x}\lim _{\epsilon \to 0}\frac {\ln \left (1+\epsilon \right )}{\epsilon }\\ &=\frac {1}{x}, \end{align*} where we have made use of eq. (2.14)
Using the first principles definition to calculate derivatives is hard work and involves careful manipulation of limits. You will be please to know that we will only use it in certain relatively simple cases. For more complicated expressions we can use a range of other techniques and formulas. Eventually you will internalise some of the standard derivative expressions or use a formula sheet like that in chapter 12.
3.2 Differentiation techniques
Properties of the derivative
In this section we will see the various formulae and rules in both the Lagrange and Leibniz notation so you should be familiar with both and use the notation that you feel most comfortable with.
The first thing that we need is to know is how to differentiate the sum of two functions and the product of a function with a number. The proof of these results will be given in chapter 11. These formulae are:
\(\seteqnumber{0}{3.}{2}\)
\begin{align}
\frac {\ud }{\ud x}\left (f(x)+g(x)\right ) &=\frac {\ud f(x)}{\ud x}+\frac {\ud g(x)}{\ud x}, \label {eq: derivative of sum}\\ \frac {\ud }{\ud x}\left (f(x)-g(x)\right ) &=\frac {\ud f(x)}{\ud x}-\frac {\ud g(x)}{\ud x}, \label
{eq: derivative of difference}\\ \frac {\ud }{\ud x}\left (cf(x)\right ) &=c\frac {\ud f(x)}{\ud x},\label {eq: derivative scalar multiplication}
\end{align}
where \(c\) is any number.
In the Lagrange/Euler notation these formulae are:
\(\seteqnumber{0}{3.}{5}\)\begin{align} \left (f(x)+g(x)\right )' &=f'(x)+g'{x}, \label {eq: derivative of sum 2}\\ \left (f(x)-g(x)\right )'&=f'(x)-g'(x), \label {eq: derivative of difference 2}\\ \left (cf(x)\right )' &=cf'(x). \label {eq: derivative scalar multiplication 2} \end{align}
These are useful formulae that we will frequently use in calculations as it enables us to split up the functions that we are differentiating into smaller tractable parts. The other shortcuts that we have is that the derivative of a constant is zero,
\(\seteqnumber{0}{3.}{8}\)\begin{equation} \frac {\ud c}{\ud x}=0, \label {eq: derivative of constant} \end{equation}
and that the derivative of a monomial is
\(\seteqnumber{0}{3.}{9}\)\begin{equation} \frac {\ud }{\ud x}\left (x^{n}\right )=nx^{n-1}. \label {eq: monomial derivative} \end{equation}
Sometimes the second formula is referred to as the power rule, and is one of the most important rules that you can learn as it enables you to differentiate any polynomial.
The formula in eq. (3.9), which says that the derivative of a constant is zero makes sense since the derivative measures the rate of change of a function. A
constant is, by definition, not changing so its rate of change is zero.
We can now use these rules to calculate some example derivatives.
-
Example 3.8. Consider the function
\(\seteqnumber{0}{3.}{10}\)\begin{equation*} f(x)=15x^{20}-3x^{5}+2x+4. \end{equation*}
We calculate its derivative as follows:
\(\seteqnumber{0}{3.}{10}\)\begin{align*} \frac {\ud f}{\ud x} &=\frac {\ud }{\ud x}\left (15x^{20}-2x^{5}+2x+4\right )\\ &=15\frac {\ud }{\ud x}\left (x^{20}\right )-2\frac {\ud }{\ud x}\left (x^{5}\right )+2\frac {\ud }{\ud x}\left (x\right )+\frac {\ud }{\ud x}\left (4\right )\\ &=15 \times 20 x^{19}-2\times 5 x^{4}+2 +0\\ &=300 x^{19}-10x^{4}+2. \end{align*}
-
Example 3.9. Consider the function
\(\seteqnumber{0}{3.}{10}\)\begin{equation*} g(x)=\frac {6}{x^{2}}-4x^{2}+2x. \end{equation*}
Its derivative is calculated as follows
\(\seteqnumber{0}{3.}{10}\)\begin{align*} \frac {\ud g}{\ud x} &=\frac {\ud }{\ud x}\left (\frac {6}{x^{2}}-4x^{2}+2x\right )\\ &=6\frac {\ud }{\ud x}\left (x^{-2}\right )-4\frac {\ud }{\ud x}\left (x^{4}\right )+2\frac {\ud }{\ud x}\left (x\right )\\ &=6\times (-2) x^{-3}-4\times 4 x^{3}+2\\ &=-\frac {12}{x^{3}}-16x^{3}+2. \end{align*}
Product rule
So far we have not discussed differentiating the product of two functions, unless you count \(x^{a+b}=x^{a}x^{b}\). A very useful formula is the Leibniz or product rule which tells us how to differentiate the product of two functions. The product rule is
\(\seteqnumber{0}{3.}{10}\)\begin{equation} \frac {\ud }{\ud x}\left (f(x)g(x)\right )=\frac {\ud f}{\ud x}g(x)+f(x)\frac {\ud g}{\ud x}. \label {eq: product rule} \end{equation}
You may think that it is disappointing that the derivative of a product is not just the product of the derivatives. However, you will come to appreciate the product rule as you make use of it. It will become particularly useful once we have discussed more about how to differentiate trig functions and exponentials.
-
Example 3.11. For the product of two functions \(\sqrt {x^{3}}\sin (x)\) we find the derivative as follows. Let \(f(x)=\sqrt {x^{3}}\) and \(g(x)=\sin (x)\) and calculate the individual derivatives to be
\(\seteqnumber{0}{3.}{11}\)\begin{equation*} f'(x)=(x^{\frac {3}{2}})'=\frac {3}{2}x^{\frac {3}{2}-1}=\frac {3}{2}\sqrt {x}, \qquad g'(x)=(\sin (x))'=\cos (x). \end{equation*}
Then we use product rule to calculate
\(\seteqnumber{0}{3.}{11}\)\begin{align*} \left (\sqrt {x^{3}}\sin (x)\right )' &=\left (f(x)g(x)\right )'\\ &=f'(x)g(x)+f(x)g'(x)\\ &=\frac {3}{2}\sqrt {x}\sin (x)+\sqrt {x^{3}}\cos (x). \end{align*}
-
Example 3.12. We can use the product rule to calculate the derivative of \(f(x)=\sin ^{2}(x)\). In this case the two functions are the same so we can evaluate the derivative as follows
\(\seteqnumber{0}{3.}{11}\)\begin{align*} f'(x) &=\left (\sin ^{2}(x)\right )'\\ &=2\sin (x)\left (\sin (x)\right )'\\ &=2\sin (x)\cos (x)\\ &=\cos (2x), \end{align*} where we have used one of the trig double angle identities in the last line.
Note that the product rule applies if we have the product of more than two functions, we just have to iterate it for each pair of functions.
Quotient rule
If instead of a product of functions we have the ratio of two functions then there is a rule for that, the quotient rule3. In Leibniz notation the quotient rule is
\(\seteqnumber{0}{3.}{11}\)\begin{equation} \frac {\ud }{\ud x}\left (\frac {f(x)}{g(x)}\right )=\frac {\frac {\ud f}{\ud x}g(x)-f(x)\frac {\ud g}{\ud x}}{g^{2}(x)}. \label {eq: quotient rule} \end{equation}
Remember that in most circumstances you can use either the product rule or the quotient rule, it depends how you want to approach the problem.
3 You may be looking at these two formula and thinking that we could just use the product rule with \(f(x)\) and \((g(x))^{-1}\). If you do this you will get an answer that looks just like the quotient rule. There are some technical differences between this approach and the quotient rule we give here, but as we are not mathematicians here we do not need to worry about them.
-
Example 3.14. Consider the function
\(\seteqnumber{0}{3.}{12}\)\begin{equation*} F(x)=\frac {\sin (x)}{e^{x}}. \end{equation*}
Note that we could use the product rule on \(e^{-x}\sin (x)\) but will instead use the quotient rule here. Spilt \(F(x)\) into the two functions \(f(x)=\sin (x)\) and \(g(x)=e^{x}\), applying the quotient rule eq. (3.12) gives
\(\seteqnumber{0}{3.}{12}\)\begin{align*} \frac {\ud }{\ud x}\left (\frac {f(x)}{g(x)}\right )&=\frac {\frac {\ud f}{\ud x}g(x)-f(x)\frac {\ud g}{\ud x}}{g^{2}(x)}\\ &=\frac {e^{x}\cos (x)-\sin (x)e^{x}}{e^{2x}}\\ &=e^{-x}\left (\cos (x)-\sin (x)\right ). \end{align*}
-
\(\seteqnumber{0}{3.}{12}\)
\begin{equation*} F(x)=\frac {1}{\sin ^{2}(x)}, \end{equation*}
and split it into two functions \(f(x)=1\) and \(g(x)=\sin ^{2}(x)\), which have derivatives
\(\seteqnumber{0}{3.}{12}\)\begin{equation*} \frac {\ud f}{\ud x}=0, \qquad \frac {\ud g}{\ud x}=2\sin (x)\cos (x)=\sin (2x). \end{equation*}
The quotient rule thus gives that
\(\seteqnumber{0}{3.}{12}\)\begin{align*} \frac {\ud }{\ud x}\left (\frac {f(x)}{g(x)}\right )&=\frac {\frac {\ud f}{\ud x}g(x)-f(x)\frac {\ud g}{\ud x}}{g^{2}(x)}\\ &=\frac {0-2\sin (x)\cos (x)}{\sin ^{4}(x)}\\ &=-2\frac {\cot (x)}{\sin ^{2}(x)}\\ &=-2\cot (x)\csc ^{2}(x). \end{align*}
Derivatives of trig functions
Armed with the quotient rule we can now give the derivatives of the six trig functions
\(\seteqnumber{0}{3.}{12}\)\begin{align} \frac {\ud }{\ud x}\sin (ax)&=a\cos (ax),\label {eq: sine derivative}\\ \frac {\ud }{\ud x}\cos (ax)&=-a\sin (ax),\label {eq: cos derivative}\\ \frac {\ud }{\ud x}\tan (ax)&=a\sec ^{2}(ax),\label {eq: tan derivative}\\ \frac {\ud }{\ud x}\cot (ax)&=-a\csc ^{2}(ax),\label {eq: cot derivative}\\ \frac {\ud }{\ud x}\sec (ax)&=a\sec (ax)\tan (ax), \label {eq: sec derivative}\\ \frac {\ud }{\ud x}\csc (ax)&=-a\csc (ax)\cot (ax).\label {eq: csc derivative} \end{align}
We have seen how to prove two of these and can now calculate the derivative of \(\tan (x)\) the other three will be left as exercises.
-
Example 3.16. Consider \(f(x)=\tan (x)\), which can be expressed as
\(\seteqnumber{0}{3.}{18}\)\begin{equation*} f(x)=\tan (x)=\frac {\sin (x)}{\cos (x)}. \end{equation*}
Using the quotient rule we have that
\(\seteqnumber{0}{3.}{18}\)\begin{align*} \frac {\ud }{\ud x}\tan (x) &=\frac {\ud }{\ud x}\left (\frac {\sin (x)}{\cos (x)}\right )\\ &=\frac {1}{(\cos (x))^{2}}\left (\cos (x)\frac {\ud }{\ud x}\sin (x)-\sin (x)\frac {\ud }{\ud x}\cos (x)\right )\\ &=\frac {1}{\cos ^{2}(x)}\left (\cos (x)\cos (x)-\sin (x)(-\sin (x))\right )\\ &=\frac {1}{\cos ^{2}(x)}\left (\cos ^{2}(x)+\sin ^{2}(x)\right )\\ &=\frac {1}{\cos ^{2}(x)}\\ &=\sec ^{2}(x). \end{align*} Where we have used the identity that \(\cos ^{2}(x)+\sin ^{2}(x)=1\) and the definition of \(\sec (x)=1/\cos (x)\).
Chain rule
If we have a function of a function, e.g. \(f(x)=\exp \left (x^{2}+x\right )\) or \(g(x)=\cos \left (x+c\right )\), none of the rules that we have given so far will work. We could go back to first principles, which is exactly what we did when calculating the
derivative of \(1/(x+1)\), but this would mean that we had to do lots of long and tricky calculations. Fortunately this is not necessary.
Consider the function
\(\seteqnumber{0}{3.}{18}\)\begin{equation} f(x)=\sqrt {4x+2}, \label {eq: function of a function1} \end{equation}
we can write this as the composition of two functions if we think of \(g(x)=\sqrt {x}\) and \(h(x)=4x+2\),
\(\seteqnumber{0}{3.}{19}\)\begin{equation*} f(x)=\left (g\circ h\right )(x)=g(h(x))=g\left (4x+2\right )=\sqrt {4x+2}. \end{equation*}
The chain rule is the, fairly, simple method to differentiate such compositions of functions. As long as both functions are differentiable, we have that if \(f(x)=(g\circ h)(x)\) then
\(\seteqnumber{0}{3.}{19}\)\begin{equation} f'(x)=g'(h(x))g'(x). \label {eq: chain rule 1} \end{equation}
An alternative way of writing the chain rule, that is easier to understand in Leibniz notation, works when \(y=f(u)\) and \(u=g(x)\) then
\(\seteqnumber{0}{3.}{20}\)\begin{equation} \frac {\ud y}{\ud x}=\frac {\ud y}{\ud u}\frac {\ud u}{\ud x}. \label {eq: chain rule 2} \end{equation}
This second way of phrasing the chain rule makes it look like we are treating the derivative like a fraction, we are not, it is just a coincidence that the formula looks like this.
Armed with the chain rule, eq. (3.20) we can return to eq. (3.19) and calculate its derivative
-
Example 3.18. Consider the function
\(\seteqnumber{0}{3.}{21}\)\begin{equation*} f(x)=\sqrt {4x+2}, \end{equation*}
and let \(g(x)=\sqrt {x}\) and \(h(x)=4x+2\). The rules we already know about differentiation tell us that
\(\seteqnumber{0}{3.}{21}\)\begin{equation*} g'(x)=\frac {1}{2\sqrt {x}}, \qquad h'(x)=4. \end{equation*}
Thus applying the chain rule gives
\(\seteqnumber{0}{3.}{21}\)\begin{align*} f'(x) &=g'(h(x))h'(x)\\ &=g'(4x+2)(4)\\ &=\frac {4}{2\sqrt {4x+2}}\\ &=\frac {2}{\sqrt {4x+2}}. \end{align*}
While we have kept tract of the function composition here, this is not how we proceed in general, particularly since this can become very complicated if we have a matryoshka doll like set up with many nested functions. Usually we will just think about an inside
and outside function and then differentiate the outside function using the rules that we already know for powers, trig, exponential, or logarithmic functions, then multiply this by the derivative of the inside function.
This may still sound quite complicated, and as is always the case in mathematics, the best way to get to grips with the concept is by solving lots of examples.
-
Example 3.20. Consider the function
\(\seteqnumber{0}{3.}{21}\)\begin{equation*} f(x)=\left (2x^{2}+\cos (x)\right )^{2}. \end{equation*}
Its derivative is given by
\(\seteqnumber{0}{3.}{21}\)\begin{align*} f'(x) &=2\left (2x^{2}+\cos (x)\right )\left (2x^{2}+\cos (x)\right )'\\ &=2\left (2x^{2}+\cos (x)\right )\left (4x-\sin (x)\right ) \end{align*}
3.3 Multiple derivatives
So far we have only talked about calculating the derivative once. However, for a function \(f(x)\) its derivative is also a function \(f'(x)\) which we could differentiate again. The notation for taking the second derivative is
\(\seteqnumber{0}{3.}{21}\)\begin{equation*} f''(x)=\frac {\ud ^{2}f}{\ud x^{2}}. \end{equation*}
We can keep doing this and the notation for the \(n'\)th derivative is
\(\seteqnumber{0}{3.}{21}\)\begin{equation*} f^{(n)}=\frac {\ud ^{n}f}{\ud x^{n}}. \end{equation*}
-
Example 3.22. Consider the function \(f(x)=2x^{3}+4x\), its second derivative is
\(\seteqnumber{0}{3.}{21}\)\begin{align*} \frac {\ud ^{2}f}{\ud x^{2}} &=\frac {\ud }{\ud x}\left (\frac {\ud f}{\ud x}\right )\\ &=\frac {\ud }{\ud x}\left (6x^{2}+4\right )\\ &=12x. \end{align*} The third derivative is
\(\seteqnumber{0}{3.}{21}\)\begin{align*} \frac {\ud ^{3}f}{\ud x^{3}} &=\frac {\ud }{\ud x}\left (\frac {\ud ^{2}f}{\ud x^{2}}\right )\\ &=\frac {\ud }{\ud x}\left (12x\right )\\ &=12. \end{align*}
We will not do much with second, or higher, derivatives, other than when discussing optimisation problems in chapter 7. However, you may come across them in your future studies so it is worth having some exposure to them.
3.4 Applications of differentiation
So, now we have met the derivative and learnt some rules for using it. Some of you reading this are likely to be saying “Ok, we can calculate derivatives. So what‽” Well, now we will look at a few applications of differentiation.
Finding critical points
A critical point of a function \(f(x)\) is a point \(a\) where the derivative, \(f'(a)\), vanishes. Sometimes critical points are called stationary points4.
4 This is because of the main examples of a first derivative is speed being the derivative of the position in mechanics. In this case a vanishing derivative means that the speed is zero so the object is stationary.
-
Mathematical Diversion 3.2. Strictly speaking there are a couple of extra points to consider. First we need that at the point \(a\) we have that \(f(a)\) exists. Then \(a\) is a critical point if either \(f'(a)=0\) or \(f'(a)\) does not exist. In [Dawkins, 2025a] there is a discussion of this emphasising the fact that the point \(a\) needs to be in the domain of the function \(f\).
If we have a function like \(f(x)=4x^{2}+3x-2\) we can ask, does it have critical points, if so what are they and what does the function look like near them. The way that we answer the first two parts of this is to calculate the the derivative of the function, set it to zero,
and then solve the algebraic equation that we get. In other words, finding a critical point boils down to solving an algebraic equation. The easiest way to understand this is by considering an explicit example.
-
Example 3.23. Consider the function
\(\seteqnumber{0}{3.}{21}\)\begin{equation*} f(x)=4x^{2}+3x-2. \end{equation*}
We find its critical points by calculating \(f'(x)\) and setting it to zero. The derivative is
\(\seteqnumber{0}{3.}{21}\)\begin{align*} \frac {\ud f}{\ud x} &=\frac {\ud }{\ud x}\left (4x^{2}+3x-2\right )\\ &=8x+3. \end{align*} Setting this equal to zero gives
\(\seteqnumber{0}{3.}{21}\)\begin{align*} 8x+3&=0\\ x=-\frac {3}{8}. \end{align*}
This polynomial is plotted in fig. 3.1 with its critical point marked and its derivative plotted in green. Notice that the critical point corresponds to the minimum of the function.
This is a general observation, critical points are related to where a function changes direction or stops moving. One way to understand this is that the derivative measures how “fast” a function is changing, it is the rate of change of the function.
As a check to see that this makes sense consider the plots of sine and cosine in fig. 2.6. Notice that when sine has its maxima and minima cosine is zero and the other way around. Recall that cosine is the
derivative of sine, and that the derivative of cosine is minus sine, so the maxima and minima are critical points.
We need to be aware that not all critical points are maxima or minima. Even if the function does not change direction at a point, its derivative can still vanish there. These are called points of inflection, sometimes they are called saddle points as for
functions of more than one variable they often have the shape of a saddle. See fig. 3.2 for an example of a point of inflection.
The other point to be aware of is that we are detecting critical, which can be local maxima or minima rather than just the global maxima and minima. For example if \(f(x)=x^{3}/2 +4x^{2}/5\), which is plotted in fig. 3.3, then we find the critical points as follows:
\(\seteqnumber{0}{3.}{21}\)\begin{align*} 0 &=f'(x)\\ &=\frac {3}{2}x^{2}+\frac {8}{5}x\\ &=x^{2}+\frac {16}{15}x. \end{align*} This is a quadratic equation which we solve either by using the quadratic formula or by extracting a common factor as follows,
\(\seteqnumber{0}{3.}{21}\)
\begin{align*}
0 &=x^{2}+\frac {16}{15}x\\ &=x\left (x+\frac {16}{15}\right ),
\end{align*}
so the critical points are at \(x=0\) and \(x=-16/15\simeq -1.067\). By inspecting the graph we see that \(x=0\) is a local minima and \(x=-16/15\) is a local maxima. They are local since for \(x<-1.6\) \(f(x)\) is below \(f(x)\), and similarly for positive \(x\)
\(f(x)\) reaches values larger than at \(x=-16/15\). The true maxima and minima are only reached asymptotically.
Above we worked out whether a critical point was a maxima or a minima by consulting the graph. However, we can do this systematically without sketching the graph, which is handy since maxima and minima are useful to know before sketching a function. There are two ways to do this:
-
1. After finding a critical point \(a\) substitute it into the function to find its value \(f(a)\), then pick two values of \(x\), one just less than \(a\), \(a_{-}\) and the other just bigger than \(a\), \(a_{+}\). Then substitute these into \(f(a)\).
-
• If \(f(a)\) is larger than both \(f(a_{-})\) and \(f(a_{+})\) then \(a\) is a local maxima.
-
• If \(f(a)\) is lower than both \(f(a_{-})\) and \(f(a_{+})\) the \(a\) is a local minima.
-
• If we find that \(f(a_{-})>f(a)> f(a_{+})\) or \(f(a_{+})>f(a)> f(a_{-})\) then \(a\) is a point of inflection.
-
-
2. The other approach involves calculating the second derivative. If the derivative tells you about the rate of change of the function, then the second derivative tells you about the rate of change of the derivative.
-
• If the derivative is decreasing at a critical point \(a\), e.g. \(f''(a)<0\) then the point is a maxima.
-
• If \(f''(a)>0\) is the \(a\) is a local minima.
-
• If \(f''(a)=0\) then \(a\) could be a a maxima, minima, or point of inflection and we need to examine the sign of \(f'(x)\) on either side of \(a\).
-
In this module you can follow whichever approach you want if you are asked to identify the critical values.
-
Example 3.24. Consider the function
\(\seteqnumber{0}{3.}{21}\)\begin{equation*} f(x)=x^{3}-3x, \end{equation*}
we find and classify the critical points as follows. For the critical points we find the derivative
\(\seteqnumber{0}{3.}{21}\)\begin{equation*} f'(x)=\left (x^{3}-3x\right )^{'}=3x^{2}-3, \end{equation*}
and set it to zero,
\(\seteqnumber{0}{3.}{21}\)\begin{align*} 0&=3x^{2}-3\\ &=x^{2}-1,\\ x^{2}=1,\\ x&=\pm 1. \end{align*} So there are two critical points. To find the nature of the critical points we need the second derivative
\(\seteqnumber{0}{3.}{21}\)\begin{equation*} f''(x)=\left (3x^{2}-3\right )^{'}=6x. \end{equation*}
At the critical points this is
\(\seteqnumber{0}{3.}{21}\)\begin{align*} f''(1)&=6,\\ f''(-1)&=-6. \end{align*} So \(f''(1)\) is positive meaning that \(x=1\) is a minimum, while \(f''(-1)\) is positive so \(x=-1\) is a maxima. When we plot the graph in fig. 3.4 we see that these are only local minima and maxima.
Linear approximations
Now we are going to look at how to approximate functions using their tangent lines. This is called the linear approximation to the function, and can be good near the point that the line is tangent to. However, the approximation will get worse and worse the
further away we go from the point5. There is a nice, if brief, discussion of linear approximation in [Dawkins, 2025a] which we draw on for the discussion here.
For a function \(f(x)\), its tangent line at \(x=a\) is given by the line
\(\seteqnumber{0}{3.}{21}\)\begin{equation} L(x)=f(a)+f'(a)\left (x-a\right ). \label {eq: linear approximation} \end{equation}
For \(f(x)=x^{2}/2+1/2\) the function and its linear approximation at \(x=1\) are plotted in fig. 3.5. We see that near the point \(x=1\) the tangent line is a good approximation to the full
function as the graphs almost lie on top of each other.
This means that if we want to find the values of \(f(x)\) near the point \(a\) we can use eq. (3.22) instead of the full function. You may think that this does not
seem very useful since we can fairly easily work out the value of \(f(x)\) for many of the functions that we have considered in this module. The main advantage comes when we have to work out lots of values of a function, such as if we are simulating something on a
computer. Every time the function is evaluated this takes time and it is much quicker to use an approximation than to use the full function.
5 We could make the approximation better by using higher order derivative terms, but the approximation would no longer be linear and would now be via a polynomial. Considering this would lead us to the Taylor or Maclaurin series of a function. You may have met this in A-level maths if not we may meet this in chapter 7 depending on which of the advanced topics we have time for.
-
Example 3.26. Consider \(f(x)=\sin (x)\), its linear approximation at \(x=0\) is given by eq. (3.22). To calculate this we need that
\(\seteqnumber{0}{3.}{22}\)\begin{equation*} f'(x)=\cos (x), \end{equation*}
so we can calculate \(f'(0)=1\). This means that eq. (3.22) becomes
\(\seteqnumber{0}{3.}{22}\)\begin{align*} L(x) &=\sin (0)+\cos (0)\left (x-0\right )\\ &=0+1\left (x\right )\\ &=0. \end{align*} So for small angles we can use the approximation that \(\sin (x)\simeq x\). This is an incredibly useful approximation, particularly if you are interested in studying the physics of pendulums.
If we repeated the above calculation for \(\cos (x)\) we would find that \(L(x)=1\) at \(x=0\).