Preliminary Mathematics for online MSc programmes in Data AnalyticsUnit 2: Differentiation in 1D (minima and maxima)

Differentiation

Introduction to differentiation

We are often interested in the rate at which some variable is changing. For example, we may be interested in the rate at which the temperature is changing in a chemical reaction or in the rate at which the pressure in a vessel is changing. Rapid rates of change of a variable may indicate that a system is not operating normally and is approaching critical values.

Rates of change may be positive, zero, or negative. A positive rate of change means that the variable is increasing; a zero rate of change means that the variable is not changing; while a negative change of rate means that the variable is decreasing.

Consider the function f left parenthesis x right parenthesis equals minus x cubed plus x squared plus e Superscript x for x element of left bracket negative 1.5 comma 4 right bracket, shown below.

x f(x)= x 3 + x 2 + e x -1 0 1 2 3 4 0 1 2 3 4 5 6
Figure 1

Between x equals negative 2 and x equals negative 1, the function is decreasing rapidly. Across this interval the rate of change of the function f left parenthesis x right parenthesis is large and negative. Between x equals negative 1 and x equals negative 0.3 the function is still decreasing but not as rapidly as before. Across this interval the rate of change of the function f left parenthesis x right parenthesis is small and negative. There is a small interval, left parenthesis negative 0.3 comma negative 0.2 right parenthesis that the function seems to not change at all. Across that interval the rate of change is zero. Between x equals negative 0.2 and x equals 1.8 the function is increasing rapidly; the rate of change is large and positive.

It is often not sufficient to describe a rate of change as "large and positive" or "small and negative". A precise value is needed. The technique for calculating the rate of change of any function is called differentiation. Use of differentiation provides a precise value or expression for the rate of change of a function.

Average rate of change across an interval

We have already seen that a function can have different rates of change at different points on its graph. Let's first define and calculate the average rate of change of a function across an interval and later on we will also define the rate of change at a point. The figure below shows a function f left parenthesis x right parenthesis; two possible argument values, a and b, and their two respective outputs f left parenthesis a right parenthesis and f left parenthesis b right parenthesis.

x f(x) a b f(a) f(b) f(b)-f(a) b-a
Figure 2

Consider that x is increasing from a to b. The change in x is b minus a. As x increases from a to b, then the function f left parenthesis x right parenthesis increases from f left parenthesis a right parenthesis to f left parenthesis b right parenthesis. The change in f left parenthesis x right parenthesis is f left parenthesis b right parenthesis minus f left parenthesis a right parenthesis. Then the average rate of change of y across the interval is StartFraction change in y Over change in x EndFraction equals StartFraction f left parenthesis b right parenthesis minus f left parenthesis a right parenthesis Over b minus a EndFraction

Another way to think of the average rate of change of a function is by visualising it as the slope of a line that passes through two points on the function. This line, called a secant line, can be drawn on a graph of a function so that we can quantify the value of the slope of the line. A secant line passing through the points left parenthesis a comma f left parenthesis a right parenthesis right parenthesis and left parenthesis b comma f left parenthesis b right parenthesis right parenthesis has a vertical rise of f left parenthesis b right parenthesis minus f left parenthesis a right parenthesis and a horizontal run of b minus a. The slope of the line, between the points a and b, is StartFraction f left parenthesis b right parenthesis minus f left parenthesis a right parenthesis Over b minus a EndFraction (which is exactly the same as the average rate of change).

Example 1

Let's calculate the average rate of change of f left parenthesis x right parenthesis equals x squared across the following intervals

(a) x equals 1 to x equals 4 (b) x equals negative 2 to x equals 0

For the first interval the change in x is equal to 4 minus 1 equals 3. When x equals 1, f left parenthesis x right parenthesis equals 1; while when x equals 4 , f left parenthesis x right parenthesis equals 16. Thus, the change of f left parenthesis x right parenthesis is 16 minus 1 equals 15. So, the avarage rate of change across the interval left bracket 1 comma 4 right bracket is StartFraction 15 Over 3 EndFraction equals 5. What does this mean though? It means that across the interval left bracket 1 comma 4 right bracket, on average the f left parenthesis x right parenthesis value increases by 5 for every 1 unit increase in x.

x f(x)= x 2 -4 -2 0 2 4 0 5 10 15 20 16-1=15 4-1=3
Figure 3

This is a good time for you to try out the second interval. (The average rate of change turns out to be -2.)

Rate of change at a point

We often need to know the rate of change of a function at a point, and not simply an average rate of change across an interval. Let's assume that b is really close to a. To better reflect this is our notation, we will call what we used to call a, x, and what we used to call b, x plus h, with h being a very small number.

x f(x) x x+h f(x) f(x+h) δ y = f(x+h)-f(x) δ x =h
Figure 4

As mentioned earlier, the average rate of change of y across the interval left bracket x comma x plus h right bracket is

StartLayout 1st Row 1st Column StartFraction change in y direction Over change in x direction EndFraction 2nd Column equals StartFraction f left parenthesis x plus h right parenthesis minus f left parenthesis x right parenthesis Over x plus h minus x EndFraction 2nd Row 1st Column Blank 2nd Column equals StartFraction f left parenthesis x plus h right parenthesis minus f left parenthesis x right parenthesis Over h EndFraction EndLayout

What do you think would happen if we assumed that the distance, h, between the two points was made increasingly small (in Mathematics notation h right arrow 0)?

If we assumed that, it would mean that the second point x plus h is really close to x. This is exactly what we will assume in order to find the rate of change at the point x. Let's say that we assumed that h right arrow 0. If we now focus again on the graph above and assume that h right arrow 0, the distance between the two points x and x plus h would get smaller and likewise the difference between their respective outputs, f left parenthesis x right parenthesis and f left parenthesis x plus h right parenthesis, would also get smaller. We can define those respective differences as delta x and delta y respectively. The term delta x reads as "delta x" and represents a small change in the x direction. In our case delta x equals x plus h minus x equals h and delta y equals f left parenthesis x plus h right parenthesis minus f left parenthesis x right parenthesis.

Thus, the rate of change at a point a is StartLayout 1st Row 1st Column StartFraction small change in y direction Over small change in x direction EndFraction 2nd Column equals limit Underscript delta x right arrow 0 Endscripts StartFraction delta y Over delta x EndFraction 2nd Row 1st Column Blank 2nd Column equals limit Underscript h right arrow 0 Endscripts StartFraction f left parenthesis x plus h right parenthesis minus f left parenthesis x right parenthesis Over h EndFraction EndLayout

Let's look at a couple of examples first and then focus on terminology and notation.

Example 2

One of the simplest functions to consider is a linear function. Let's assume that we have f left parenthesis x right parenthesis equals 2 x plus 3.

x f(x)=2x+3 x x+h f(x) f(x+h) δ y = f(x+h)-f(x) δ x =h
Figure 5

What should we do if we want to find the rate of change at any point of the function? (We want to essentially answer the question "What is the change in the y direction when the change in the x direction is small")

Let's use the definition we saw earlier and calculate the rate of change at any point x of the function (think of it as looking at the two points x and x plus h with h right arrow 0).

StartLayout 1st Row 1st Column StartFraction small change in y direction Over small change in x direction EndFraction 2nd Column equals limit Underscript delta x right arrow 0 Endscripts StartFraction delta y Over delta x EndFraction 2nd Row 1st Column Blank 2nd Column equals limit Underscript h right arrow 0 Endscripts StartFraction f left parenthesis x plus h right parenthesis minus f left parenthesis x right parenthesis Over x plus h minus x EndFraction 3rd Row 1st Column Blank 2nd Column equals limit Underscript h right arrow 0 Endscripts StartFraction 2 left parenthesis x plus h right parenthesis plus 3 minus left parenthesis 2 x plus 3 right parenthesis Over x plus h minus x EndFraction 4th Row 1st Column Blank 2nd Column equals limit Underscript h right arrow 0 Endscripts StartFraction 2 CrossOut h EndCrossOut Over CrossOut h EndCrossOut EndFraction 5th Row 1st Column Blank 2nd Column equals 2 EndLayout

Wait. The rate of change for the function f left parenthesis x right parenthesis at any point x is 2? What does that mean?

It means that the f left parenthesis x right parenthesis value increases by 2 h for every small increase, h, in x. So it doesn't matter which x value we are looking at (e.g. x equals 2 or x equals 58.5); the f left parenthesis x right parenthesis value will always increase by 2 for every small increase, h, in x (i.e. x equals 2 plus h or x equals 58.5 plus h where h right arrow 0).

For non-linear functions a one unit increase in the value of x leads to different increases in f left parenthesis x right parenthesis.

Example 3

Consider a quadratic function f left parenthesis x right parenthesis equals x squared.

Before we use the previous definition and calculate the rate of change at any point, let's try something else.

x f(x)= x 2 x x+h f(x) f(x+h) δ y = f(x+h)-f(x) δ x =h
Figure 6

What will happen to the f left parenthesis x right parenthesis values:

  • if x equals 1 and we increase it by 1 unit (i.e. x equals 2)? The f left parenthesis x right parenthesis values will increase by 3 (i.e. 2 squared minus 1 squared).

  • if x equals 2 and we increase it by 1 unit (i.e. x equals 3)? The f left parenthesis x right parenthesis values will increase by 5 (i.e. 3 squared minus 2 squared).

  • if x equals 3 and we increase it by 1 unit (i.e. x equals 4)? The f left parenthesis x right parenthesis values will increase by 7 (i.e. 4 squared minus 3 squared).

Thus, in a quadratic function a 1 unit increase in x leads to different increases in the f left parenthesis x right parenthesis values.

Let's now use the definition to find out what is happening in the f left parenthesis x right parenthesis values when x is increased by h with h right arrow 0 (instead of x being increased by 1).

StartLayout 1st Row 1st Column StartFraction small change in y direction Over small change in x direction EndFraction 2nd Column equals limit Underscript delta x right arrow 0 Endscripts StartFraction delta y Over delta x EndFraction 2nd Row 1st Column Blank 2nd Column equals limit Underscript h right arrow 0 Endscripts StartFraction f left parenthesis x plus h right parenthesis minus f left parenthesis x right parenthesis Over x plus h minus x EndFraction 3rd Row 1st Column Blank 2nd Column equals limit Underscript h right arrow 0 Endscripts StartFraction left parenthesis x plus h right parenthesis squared minus x squared Over x plus h minus x EndFraction 4th Row 1st Column Blank 2nd Column equals limit Underscript h right arrow 0 Endscripts StartFraction CrossOut x squared EndCrossOut plus 2 x h plus h squared CrossOut minus x squared EndCrossOut Over x plus h minus x EndFraction 5th Row 1st Column Blank 2nd Column equals limit Underscript h right arrow 0 Endscripts StartFraction CrossOut h EndCrossOut left parenthesis 2 x plus h right parenthesis Over CrossOut h EndCrossOut EndFraction 6th Row 1st Column Blank 2nd Column equals limit Underscript h right arrow 0 Endscripts left parenthesis 2 x plus h right parenthesis 7th Row 1st Column Blank 2nd Column equals 2 x EndLayout

So, the rate of change for the function f left parenthesis x right parenthesis at a point x is 2 x. This means that the f left parenthesis x right parenthesis value increases by 2 x for every small increase, h, in x. Thus, the rate of change along a quadratic function is changing constantly (according to the value of x we are looking at), the rate of change has to be computed separately at each possible value of x. The rate of change is thus a local phenomenon: it does not give us any information about the rate of change globally.

Note that the rate of change, 2 x, for the function f left parenthesis x right parenthesis is itself a function of x.

Terminology and notation

The process of finding the rate of change of a given function is called differentiation. The function is said to be differentiated. If f left parenthesis x right parenthesis identical to y (read "f left parenthesis x right parenthesis is equivalent to y") is a function of x we say that y is differentiated with respect to x. The rate of change of a function is also known as the derivative of the function.

There is a notation for writing down the derivative of a function. If the function is f left parenthesis x right parenthesis identical to y, we denote the derivative of y equals f left parenthesis x right parenthesis by

StartFraction normal d y Over normal d x EndFraction equals StartFraction normal d f left parenthesis x right parenthesis Over normal d x EndFraction equals f prime left parenthesis x right parenthesis equals limit Underscript delta x right arrow 0 Endscripts StartFraction delta y Over delta x EndFraction equals limit Underscript h right arrow 0 Endscripts StartFraction f left parenthesis x plus h right parenthesis minus f left parenthesis x right parenthesis Over h EndFraction

(read "dee y (by) dee x", "dee f of x dee x" and "f prime").

This is the point where you should start asking yourselves "Wait a minute, do I have to compute limit Underscript delta x right arrow 0 Endscripts StartFraction delta y Over delta x EndFraction every time I need to find the derivative of a function at a point x?". Thankfully, the answer is no.

Table of derivatives

Table 1 lists some of the common functions used in Mathematics and Statistics and their corresponding derivatives. The symbols k and n are constants while the symbol x represents a variable.

Function f left parenthesis x right parenthesisDerivative f prime left parenthesis x right parenthesis
constant0
x1
k xk
x Superscript nn x Superscript n minus 1
k x Superscript nk n x Superscript n minus 1
e Superscript xe Superscript x
e Superscript k xk e Superscript k x
a Superscript xlog left parenthesis a right parenthesis a Superscript x
log left parenthesis x right parenthesisStartFraction 1 Over x EndFraction
log left parenthesis k x right parenthesisStartFraction 1 Over x EndFraction
Example 4

Find the derivative of f left parenthesis x right parenthesis equals 3 x.

We note that 3 x is of the form k x where k equals 3. This means that f prime left parenthesis x right parenthesis equals 3.

Example 5

Find the derivative of f left parenthesis x right parenthesis equals 3.

This function is constant, hence its derivative is zero.

Example 6

Find the derivative of f left parenthesis x right parenthesis equals 6 x squared.

This function is of the form k x Superscript n with k equals 6 and n equals 2, hence its derivative is 12 x.

Example 7

Find the derivative of f left parenthesis x right parenthesis equals StartRoot x EndRoot.

We first rewrite the function as f left parenthesis x right parenthesis equals StartRoot x EndRoot equals x Superscript one half. This means that the function is of the form k x Superscript n with k equals 1 and n equals one half. This means that f prime left parenthesis x right parenthesis equals one half x Superscript negative one half Baseline equals StartFraction 1 Over 2 x Superscript one half Baseline EndFraction equals StartFraction 1 Over 2 StartRoot x EndRoot EndFraction.

Example 8

Find the derivative of f left parenthesis x right parenthesis equals StartFraction 3 Over x squared EndFraction.

We first rewrite the function as f left parenthesis x right parenthesis equals StartFraction 3 Over x squared EndFraction equals 3 x Superscript negative 2. This means that the function is of the form k x Superscript n with k equals 3 and n equals negative 2. This means that f prime left parenthesis x right parenthesis equals 3 left parenthesis negative 2 right parenthesis x Superscript negative 3 Baseline equals minus 6 x Superscript negative 3 Baseline equals minus StartFraction 6 Over x cubed EndFraction.

Example 9

Find the derivative of f left parenthesis x right parenthesis equals e Superscript 3 x.

This function is of the form e Superscript k x with k equals 3, hence its derivative is f prime left parenthesis x right parenthesis equals 3 e Superscript 3 x.

Ok, that is a good start but what do we do with functions like f left parenthesis x right parenthesis equals 2 x plus 3, g left parenthesis x right parenthesis equals x Superscript 5 Baseline log left parenthesis x right parenthesis and h left parenthesis x right parenthesis equals StartFraction x squared Over e Superscript x Baseline EndFraction?

The first function involves adding two functions (the first one being of the form k x while the second one is a constant function).

The second function, g left parenthesis x right parenthesis, involves multiplying two functions (x Superscript 5 and log left brace x right brace) while the last one, h left parenthesis x right parenthesis, involves dividing two functions (x squared and e Superscript x).

We need to introduce some simple rules to enable us to extend the range of functions that we can differentiate.

Rules of differentiation

  • Differentiation is linear: For any functions f and g and any real numbers a and b, the derivative of the function h left parenthesis x right parenthesis equals a f left parenthesis x right parenthesis plus or minus b g left parenthesis x right parenthesis with respect to x is h prime left parenthesis x right parenthesis equals a f prime left parenthesis x right parenthesis plus or minus b g prime left parenthesis x right parenthesis

  • Product rule: For any functions f and g the derivative of a function h left parenthesis x right parenthesis equals f left parenthesis x right parenthesis g left parenthesis x right parenthesis with respect to x is h prime left parenthesis x right parenthesis equals f prime left parenthesis x right parenthesis g left parenthesis x right parenthesis plus f left parenthesis x right parenthesis g prime left parenthesis x right parenthesis period

  • Quotient rule: For any functions f and g the derivative of a function h left parenthesis x right parenthesis equals StartFraction f left parenthesis x right parenthesis Over g left parenthesis x right parenthesis EndFraction, where g left parenthesis x right parenthesis not equals 0, with respect to x is h prime left parenthesis x right parenthesis equals StartFraction f prime left parenthesis x right parenthesis g left parenthesis x right parenthesis minus f left parenthesis x right parenthesis g prime left parenthesis x right parenthesis Over g squared left parenthesis x right parenthesis EndFraction period

  • Chain rule: The derivative of the function of a composite function h left parenthesis x right parenthesis equals f left parenthesis g left parenthesis x right parenthesis right parenthesis with respect to x is h prime left parenthesis x right parenthesis equals f prime left parenthesis g left parenthesis x right parenthesis right parenthesis g prime left parenthesis x right parenthesis period What is a composite function you ask? It is a function that takes another function as its argument. So, instead of having a function f left parenthesis x right parenthesis that has x as its input, we have a function f which takes g left parenthesis x right parenthesis as its input. Thus, it becomes f left parenthesis g left parenthesis x right parenthesis right parenthesis.

Function h left parenthesis x right parenthesisDerivative h prime left parenthesis x right parenthesis
a f left parenthesis x right parenthesis plus b g left parenthesis x right parenthesisa f prime left parenthesis x right parenthesis plus b g prime left parenthesis x right parenthesis
a f left parenthesis x right parenthesis minus b g left parenthesis x right parenthesisa f prime left parenthesis x right parenthesis minus b g prime left parenthesis x right parenthesis
f left parenthesis x right parenthesis g left parenthesis x right parenthesisf prime left parenthesis x right parenthesis g left parenthesis x right parenthesis plus f left parenthesis x right parenthesis g prime left parenthesis x right parenthesis
StartFraction f left parenthesis x right parenthesis Over g left parenthesis x right parenthesis EndFractionStartFraction f prime left parenthesis x right parenthesis g left parenthesis x right parenthesis minus f left parenthesis x right parenthesis g prime left parenthesis x right parenthesis Over g squared left parenthesis x right parenthesis EndFraction
f left parenthesis g left parenthesis x right parenthesis right parenthesisf prime left parenthesis g left parenthesis x right parenthesis right parenthesis g prime left parenthesis x right parenthesis

Example 10

Find the derivative of h left parenthesis x right parenthesis equals 4 x Superscript 5 Baseline plus 5 x squared.

This function is of the form a f left parenthesis x right parenthesis plus b g left parenthesis x right parenthesis with a equals 4, f left parenthesis x right parenthesis equals x Superscript 5, b equals 5 and g left parenthesis x right parenthesis equals x squared. Hence, f prime left parenthesis x right parenthesis equals 5 x Superscript 4 and g prime left parenthesis x right parenthesis equals 2 x, which yields

h prime left parenthesis x right parenthesis equals a f prime left parenthesis x right parenthesis plus b g prime left parenthesis x right parenthesis equals 4 times 5 x Superscript 4 Baseline plus 5 times 2 x equals 20 x Superscript 4 Baseline plus 10 x

(We could have also used a equals 1, f left parenthesis x right parenthesis equals 4 x Superscript 5, b equals 1 and g left parenthesis x right parenthesis equals 5 x squared.)

Example 11

Find the derivative of h left parenthesis x right parenthesis equals 3 x minus 6 x Superscript 6.

This function is of the form a f left parenthesis x right parenthesis minus b g left parenthesis x right parenthesis with a equals 3, f left parenthesis x right parenthesis equals x, b equals 6 and g left parenthesis x right parenthesis equals x Superscript 6. Hence, f prime left parenthesis x right parenthesis equals 1 and g prime left parenthesis x right parenthesis equals 6 x Superscript 5, which yields

h prime left parenthesis x right parenthesis equals a f prime left parenthesis x right parenthesis minus b g prime left parenthesis x right parenthesis equals 3 times 1 minus 6 times 6 x Superscript 5 Baseline equals 3 minus 36 x Superscript 5

Example 12

Find the derivative of h left parenthesis x right parenthesis equals StartFraction 9 Over x squared EndFraction plus StartFraction 11 Over x EndFraction.

This function is of the form a f left parenthesis x right parenthesis plus b g left parenthesis x right parenthesis with a equals 9, f left parenthesis x right parenthesis equals x Superscript negative 2, b equals 11 and g left parenthesis x right parenthesis equals x Superscript negative 1. Hence, f prime left parenthesis x right parenthesis equals minus 2 x Superscript negative 3 and g prime left parenthesis x right parenthesis equals minus x Superscript negative 2, which yields

h prime left parenthesis x right parenthesis equals a f prime left parenthesis x right parenthesis plus b g prime left parenthesis x right parenthesis equals 9 times left parenthesis minus 2 x Superscript negative 3 Baseline right parenthesis plus 11 times left parenthesis minus x Superscript negative 2 Baseline right parenthesis equals minus StartFraction 18 Over x cubed EndFraction minus StartFraction 11 Over x squared EndFraction

Example 13

Find the derivative of h left parenthesis x right parenthesis equals x e Superscript x.

This function is of the form f left parenthesis x right parenthesis g left parenthesis x right parenthesis with f left parenthesis x right parenthesis equals x and g left parenthesis x right parenthesis equals e Superscript x. Hence, f prime left parenthesis x right parenthesis equals 1, g prime left parenthesis x right parenthesis equals e Superscript x and

h prime left parenthesis x right parenthesis equals f prime left parenthesis x right parenthesis g left parenthesis x right parenthesis plus f left parenthesis x right parenthesis g prime left parenthesis x right parenthesis equals 1 times e Superscript x Baseline plus x times e Superscript x Baseline equals e Superscript x Baseline plus x e Superscript x Baseline equals left parenthesis 1 plus x right parenthesis e Superscript x

Example 14

Find the derivative of h left parenthesis x right parenthesis equals x log left parenthesis x right parenthesis.

This function is of the form f left parenthesis x right parenthesis g left parenthesis x right parenthesis with f left parenthesis x right parenthesis equals x and g left parenthesis x right parenthesis equals log left parenthesis x right parenthesis. Hence, f prime left parenthesis x right parenthesis equals 1, g prime left parenthesis x right parenthesis equals 1 divided by x and

h prime left parenthesis x right parenthesis equals f prime left parenthesis x right parenthesis g left parenthesis x right parenthesis plus f left parenthesis x right parenthesis g prime left parenthesis x right parenthesis equals 1 times log left parenthesis x right parenthesis plus x times StartFraction 1 Over x EndFraction equals log left parenthesis x right parenthesis plus 1

Example 15

Find the derivative of h left parenthesis x right parenthesis equals StartFraction x squared minus 1 Over x cubed EndFraction.

This function is of the form StartFraction f left parenthesis x right parenthesis Over g left parenthesis x right parenthesis EndFraction with f left parenthesis x right parenthesis equals x squared minus 1 and g left parenthesis x right parenthesis equals x cubed. Hence, f prime left parenthesis x right parenthesis equals 2 x, g prime left parenthesis x right parenthesis equals 3 x squared and

StartLayout 1st Row 1st Column h prime left parenthesis x right parenthesis 2nd Column equals StartFraction f prime left parenthesis x right parenthesis g left parenthesis x right parenthesis minus f left parenthesis x right parenthesis g prime left parenthesis x right parenthesis Over g left parenthesis x right parenthesis squared EndFraction equals StartFraction 2 x times x cubed minus left parenthesis x squared minus 1 right parenthesis times 3 x squared Over left parenthesis x cubed right parenthesis squared EndFraction 2nd Row 1st Column Blank 2nd Column equals StartFraction 2 x Superscript 4 Baseline minus 3 x Superscript 4 Baseline plus 3 x squared Over x Superscript 6 Baseline EndFraction equals StartFraction x squared left parenthesis minus x squared plus 3 right parenthesis Over x Superscript 6 Baseline EndFraction 3rd Row 1st Column Blank 2nd Column equals StartFraction 3 minus x squared Over x Superscript 4 Baseline EndFraction EndLayout

Example 16

Find the derivative of h left parenthesis x right parenthesis equals StartFraction e Superscript x Baseline plus x Over x squared EndFraction.

This function is of the form StartFraction f left parenthesis x right parenthesis Over g left parenthesis x right parenthesis EndFraction with f left parenthesis x right parenthesis equals e Superscript x Baseline plus x and g left parenthesis x right parenthesis equals x squared. Hence, f prime left parenthesis x right parenthesis equals e Superscript x Baseline plus 1, g prime left parenthesis x right parenthesis equals 2 x and

StartLayout 1st Row 1st Column h prime left parenthesis x right parenthesis 2nd Column equals StartFraction f prime left parenthesis x right parenthesis g left parenthesis x right parenthesis minus f left parenthesis x right parenthesis g prime left parenthesis x right parenthesis Over g left parenthesis x right parenthesis squared EndFraction equals StartFraction left parenthesis e Superscript x Baseline plus 1 right parenthesis times x squared minus 2 x times left parenthesis e Superscript x Baseline plus x right parenthesis Over left parenthesis x squared right parenthesis squared EndFraction 2nd Row 1st Column Blank 2nd Column equals StartFraction x squared e Superscript x Baseline plus x squared minus 2 x e Superscript x Baseline minus 2 x squared Over x Superscript 4 Baseline EndFraction equals StartFraction x squared e Superscript x Baseline minus x squared minus 2 x e Superscript x Baseline Over x Superscript 4 Baseline EndFraction 3rd Row 1st Column Blank 2nd Column equals StartFraction x e Superscript x Baseline minus x minus 2 e Superscript x Baseline Over x cubed EndFraction EndLayout

Example 17

Find the derivative of h left parenthesis x right parenthesis equals left parenthesis x cubed plus x right parenthesis Superscript 7.

We could first expand the power, but this would be extremely time-consuming. It is a lot easier to view h left parenthesis x right parenthesis equals f left parenthesis g left parenthesis x right parenthesis right parenthesis with f left parenthesis x right parenthesis equals x Superscript 7 and g left parenthesis x right parenthesis equals left parenthesis x cubed plus x right parenthesis.

The formula for the derivative of h left parenthesis x right parenthesis is h prime left parenthesis x right parenthesis equals f prime left parenthesis g left parenthesis x right parenthesis right parenthesis g prime left parenthesis x right parenthesis, i.e. we have to first differentiate both f left parenthesis x right parenthesis and g left parenthesis x right parenthesis yielding f prime left parenthesis x right parenthesis equals 7 x Superscript 6 and g prime left parenthesis x right parenthesis equals 3 x squared plus 1.

Next we need to find f prime left parenthesis g left parenthesis x right parenthesis right parenthesis, i.e. we have to use the value of g left parenthesis x right parenthesis as the input to f prime left parenthesis x right parenthesis. We do this by replacing every occurence of x in f prime left parenthesis x right parenthesis by g left parenthesis x right parenthesis equals x cubed plus x:

f prime left parenthesis g left parenthesis x right parenthesis right parenthesis equals 7 left parenthesis g left parenthesis x right parenthesis right parenthesis Superscript 6 Baseline equals 7 left parenthesis x cubed plus x right parenthesis Superscript 6

Thus,

h prime left parenthesis x right parenthesis equals f prime left parenthesis g left parenthesis x right parenthesis right parenthesis g prime left parenthesis x right parenthesis equals 7 left parenthesis x cubed plus x right parenthesis Superscript 6 Baseline left parenthesis 3 x squared plus 1 right parenthesis

Example 18

Find the derivative of h left parenthesis x right parenthesis equals log left parenthesis x squared plus x plus 1 right parenthesis.

We will again use the chain rule and write h left parenthesis x right parenthesis equals f left parenthesis g left parenthesis x right parenthesis right parenthesis with f left parenthesis x right parenthesis equals log left parenthesis x right parenthesis and g left parenthesis x right parenthesis equals x squared plus x plus 1. Then f prime left parenthesis x right parenthesis equals StartFraction 1 Over x EndFraction and g prime left parenthesis x right parenthesis equals 2 x plus 1 and thus

StartLayout 1st Row 1st Column h prime left parenthesis x right parenthesis 2nd Column equals f prime left parenthesis g left parenthesis x right parenthesis right parenthesis g prime left parenthesis x right parenthesis equals StartFraction 1 Over g left parenthesis x right parenthesis EndFraction g prime left parenthesis x right parenthesis 2nd Row 1st Column Blank 2nd Column equals StartFraction 1 Over x squared plus x plus 1 EndFraction times left parenthesis 2 x plus 1 right parenthesis equals StartFraction 2 x plus 1 Over x squared plus x plus 1 EndFraction EndLayout

Higher-order derivatives

So far we have only looked at the first derivative. The derivative of f prime left parenthesis x right parenthesis is known as the second derivative and denoted as

f double prime left parenthesis x right parenthesis equals StartFraction normal d f left parenthesis x right parenthesis Over normal d x EndFraction equals left parenthesis f prime left parenthesis x right parenthesis right parenthesis Superscript prime Baseline period

While the first derivative contains information about the rate of change, which corresponds to the slope of a function, the second derivative contains information about the curvature.

Example 19

Find the first and second derivative of f left parenthesis x right parenthesis equals x Superscript 4 Baseline plus 2 x.

The first derivative is f prime left parenthesis x right parenthesis equals 4 x cubed plus 2. To find the second derivative, we differentiate the first derivative once more.

f double prime left parenthesis x right parenthesis equals left parenthesis f prime left parenthesis x right parenthesis right parenthesis prime equals left parenthesis 4 x cubed plus 2 right parenthesis prime equals 12 x squared

Approximating functions using derivatives

We can use derivatives to approximate functions. We have already seen that the derivative f prime left parenthesis x 0 right parenthesis gives the slope of the function f left parenthesis x right parenthesis at x equals x 0.

x -1 0 1 x 0 =2 3 4 0 1 2 3 4 5 6 f(x)= x 3 + x 2 + e x g(x)= f ( x 0 ) + f ' ( x 0 ) ( x x 0 )
Figure 7

The line that corresponds to the slope at x 0 equals 2 is actually a function itself. The purple line in the figure above is graph of the function

g left parenthesis x right parenthesis equals f left parenthesis x 0 right parenthesis plus f prime left parenthesis x 0 right parenthesis left parenthesis x minus x 0 right parenthesis period

This function provides a local approximation to the function f left parenthesis x right parenthesis around x equals x 0. The approximation g left parenthesis x right parenthesis touches the function f left parenthesis x right parenthesis at x equals x 0 so that both functions take the same value and have the same slope at x equals x 0.

Can we do a better job at approximating the function f left parenthesis x right parenthesis? The answer is yes: we can include a term involving the second derivative, so that we also match the curvature in x equals x 0.

h left parenthesis x right parenthesis equals f left parenthesis x 0 right parenthesis plus f prime left parenthesis x 0 right parenthesis left parenthesis x minus x 0 right parenthesis plus one half f double prime left parenthesis x minus x 0 right parenthesis left parenthesis x minus x 0 right parenthesis squared

x -1 0 1 x 0 =2 3 4 0 1 2 3 4 5 6 f(x)= x 3 + x 2 + e x h(x)= f ( x 0 ) + f ' ( x 0 ) ( x x 0 ) + 1 2 f '' ( x 0 ) ( x x 0 ) 2
Figure 8

We can keep adding higher-order derivatives in order to improve the approximation, which is known as Taylor series (or Maclaurin series) approximation.

Tasks
Task 1

Find the derivative of f left parenthesis x right parenthesis equals x cubed plus 8?

Show answer

We can differentiate the two terms independently of each other with the second term having a derivative of zero. Thus,

f prime left parenthesis x right parenthesis equals 3 x squared

Task 2

Find the derivative of f left parenthesis x right parenthesis equals minus StartFraction 1 Over x cubed EndFraction?

Show answer

VideoVideo model answersDuration0:39

We first rewrite

f left parenthesis x right parenthesis equals minus StartFraction 1 Over x cubed EndFraction equals minus x Superscript negative 3

and then take the derivative.

f prime left parenthesis x right parenthesis equals minus left parenthesis negative 3 right parenthesis x Superscript negative 4 Baseline equals StartFraction 3 Over x Superscript 4 Baseline EndFraction

Task 3

Let f and g be functions that are differentiable everywhere.

Suppose that f left parenthesis 2 right parenthesis equals 3, g left parenthesis 2 right parenthesis equals 2, f prime left parenthesis 2 right parenthesis equals negative 3, and g prime left parenthesis 2 right parenthesis equals negative 2.

Use this information to determine the value of h prime left parenthesis 2 right parenthesis, where h equals f left parenthesis g left parenthesis x right parenthesis right parenthesis.

Show answer

VideoVideo model answersDuration1:20

Using the chain rule for h left parenthesis x right parenthesis equals f left parenthesis g left parenthesis x right parenthesis right parenthesis gives h prime left parenthesis x right parenthesis equals f prime left parenthesis g left parenthesis x right parenthesis right parenthesis g prime left parenthesis x right parenthesis. Thus

h prime left parenthesis 2 right parenthesis equals f prime left parenthesis g left parenthesis 2 right parenthesis right parenthesis g prime left parenthesis 2 right parenthesis equals f prime left parenthesis 2 right parenthesis times left parenthesis negative 2 right parenthesis equals negative 3 times left parenthesis negative 2 right parenthesis equals 6

Task 4

The slope of the curve f left parenthesis x right parenthesis equals x squared minus 8 x plus 7 is zero at which value(s) of x?

Show answer

We first need to find f prime left parenthesis x right parenthesis equals 2 x minus 8. Setting f prime left parenthesis x right parenthesis equals 0 and solving for x yields x equals 4.

Task 5

What is the derivative of f left parenthesis x right parenthesis equals StartFraction e Superscript x Baseline Over e Superscript x Baseline plus 1 EndFraction?

Show answer

VideoVideo model answersDuration2:00

f left parenthesis x right parenthesis is of the form StartFraction g left parenthesis x right parenthesis Over h left parenthesis x right parenthesis EndFraction. Using the quotient rule gives the derivative f prime left parenthesis x right parenthesis equals StartFraction g prime left parenthesis x right parenthesis h left parenthesis x right parenthesis minus g left parenthesis x right parenthesis h prime left parenthesis x right parenthesis Over h left parenthesis x right parenthesis squared EndFraction.

StartLayout 1st Row 1st Column f prime left parenthesis x right parenthesis 2nd Column equals StartFraction left parenthesis e Superscript x Baseline right parenthesis prime left parenthesis e Superscript x Baseline plus 1 right parenthesis minus e Superscript x Baseline left parenthesis e Superscript x Baseline plus 1 right parenthesis Superscript prime Baseline Over left parenthesis e Superscript x Baseline plus 1 right parenthesis squared EndFraction 2nd Row 1st Column Blank 2nd Column equals StartFraction e Superscript x Baseline left parenthesis e Superscript x Baseline plus 1 right parenthesis minus e Superscript x Baseline e Superscript x Baseline Over left parenthesis e Superscript x Baseline plus 1 right parenthesis squared EndFraction 3rd Row 1st Column Blank 2nd Column equals StartFraction e Superscript 2 x Baseline plus e Superscript x Baseline minus e Superscript 2 x Baseline Over left parenthesis e Superscript x Baseline plus 1 right parenthesis squared EndFraction 4th Row 1st Column Blank 2nd Column equals StartFraction e Superscript x Baseline Over left parenthesis e Superscript x Baseline plus 1 right parenthesis squared EndFraction EndLayout

Task 6

What is the derivative of f left parenthesis x right parenthesis equals x squared e Superscript 3 x?

Show answer

Using the product rule,

StartLayout 1st Row 1st Column f left parenthesis x right parenthesis 2nd Column equals x squared e Superscript 3 x Baseline 2nd Row 1st Column f prime left parenthesis x right parenthesis 2nd Column equals 2 x e Superscript 3 x Baseline plus x squared 3 e Superscript 3 x Baseline 3rd Row 1st Column Blank 2nd Column equals x e Superscript 3 x Baseline left parenthesis 2 plus 3 x right parenthesis EndLayout


Self help


Maximum and minimum values

Local and global extrema

The maximum and minimum values of a function are often very important. For example, we may want to know what value a parameter needs to take so that an algorithm performs best, as measured by an objective function.

It is important to distinguish between two types of maxima and minima.

  • Local maxima (minima) are points at which the function takes larger (smaller) values than in its vicinity.
  • Global maxima (minima) are points at which the function takes its largest (smallest) value.

If it is clear from the context, local maxima (minima) are often just referred to as maxima (minima), without prefixing them by the word "local".

Differentiation and stationary points

Differentiation can be used to find the maximum and minimum values of a function. Since the derivative provides information about the slope (or gradient) of the graph of a function we can use it to locate points on a graph where the slope is zero. We will see that such points are often associated with the largest or smallest values of the function, at least in their immediate locality.

Example 20

Consider the function f left parenthesis x right parenthesis equals x cubed minus 3 x. We may be interested in finding its maximum and minimum values.

x f ( x ) = x 3 3 x -3 -2 -1 0 1 2 3 -15 -10 -5 0 5 10 15
Figure 9

We can see in the graph that the slope of the function is 0 in x almost equals negative 1 and x almost equals 1. Such points at which the slope to the graph is horizontal, thus zero, are called stationary points. You can also say that the rate of change of a function at stationary points is zero.

At the local maximum at x almost equals negative 1 the function takes a larger value than in its vicinity. Note that this is not a global maximum, as the function takes larger values for large x (as f left parenthesis x right parenthesis right arrow plus normal infinity as x right arrow plus normal infinity). At the local minimum at x almost equals 1 the function takes a smaller value than in its vicinity. Again, this is not a global minimum as the function takes smaller values for small x (as f left parenthesis x right parenthesis right arrow negative normal infinity as x right arrow negative normal infinity).

You can probably notice by looking at the graph that the curve actually turns at the stationary points. As an example, let's focus on the local maximum at x almost equals negative 1. We can see that the curve goes up right before it reaches the local maximum and then it goes down. The exact opposite happens at the local minimum. Thus, these stationary points are also referred to as turning points.

Drawing a graph of a function as above will reveal its behaviour, but if we want to know the precise location of such points we need to turn to algebra and differential calculus.

We have seen that the local maximum and local minimum are stationary points, i.e. we can find their exact location by solving the equation f prime left parenthesis x right parenthesis equals 0.

Solving 0 equals f prime left parenthesis x right parenthesis equals 3 x squared minus 3 equals 3 left parenthesis x squared minus 1 right parenthesis equals 3 left parenthesis x plus 1 right parenthesis left parenthesis x minus 1 right parenthesis

yields the roots x equals negative 1 and x equals 1, which correspond to the local maximum and minimum, respectively.

All turning points are stationary points; but not all stationary points are turning points. Can you draw a graph of a function that has a stationary point that is not a turning point? (Hint: Try to create a graph that around a specific point it has a slope of zero but the behaviour of the curve is the same around that point.)

Distinguishing between stationary points

Think about what happens to the slope of the graph from Example 20 as we travel through the minimum turning point, from left to right, that is as x increases. To the left of the local minimum, right before x equals 1, the slope is negative; then the slope becomes zero, and right after the minimum point the slope becomes positive. In other words, the slope f prime left parenthesis x right parenthesis is increasing as x increases. In other words, the second derivative f double prime left parenthesis x right parenthesis is positive.

To summarise, if we want to find maximum or minimum values we can:

  1. locate the position of stationary points, let's say x 1 comma x 2, by looking for points where f prime left parenthesis x right parenthesis equals 0, and

  2. calculate the second derivative at those values (i.e. f double prime left parenthesis x 1 right parenthesis comma f double prime left parenthesis x 2 right parenthesis).

If the second derivative is positive, then the stationary point is a minimum. If the second derivative is negative, then the stationary point is a maximum.

It is possible for second derivative (at a stationary point) to be equal to zero; in that case we do not have sufficient information about what kind of stationary point it is.


Tasks
Task 7

Can you find the stationary points of the following functions and distinguish between them?

(a) f left parenthesis x right parenthesis equals x squared minus x
(b) f left parenthesis x right parenthesis equals 2 plus 3 x minus x cubed (c) f left parenthesis x right parenthesis equals 3 x Superscript 4 Baseline minus 4 x cubed
(d) f left parenthesis x right parenthesis equals x Superscript 4 Baseline minus 2 x squared plus 3

Show answer

VideoVideo model answersDuration2:34

(a) f prime left parenthesis x right parenthesis equals 2 x minus 1. Setting f prime left parenthesis x right parenthesis equals 0 yields x equals one half. f double prime left parenthesis x right parenthesis equals 2 greater than 0, thus there is a local (and also global) minimum at x equals one half.

(b) f prime left parenthesis x right parenthesis equals 3 minus 3 x squared equals 3 left parenthesis 1 minus x squared right parenthesis equals 3 left parenthesis 1 plus x right parenthesis left parenthesis 1 minus x right parenthesis. As we have factorised the f prime left parenthesis x right parenthesis already, we know that it is zero for x equals negative 1 and x equals 1.

Taking the second derivative gives f double prime left parenthesis x right parenthesis equals minus 6 x. As f double prime left parenthesis negative 1 right parenthesis equals 6 greater than 0, there is a local minimum at x equals negative 1. As f double prime left parenthesis 1 right parenthesis equals negative 6, there is a local maximum at x equals 1.

(c) f prime left parenthesis x right parenthesis equals 12 x cubed minus 12 x squared equals 12 x squared left parenthesis x minus 1 right parenthesis. f prime left parenthesis x right parenthesis is thus zero for x equals 0 and x equals 1.

f double prime left parenthesis x right parenthesis equals 36 x squared minus 24 x, thus f double prime left parenthesis 0 right parenthesis equals 0 and f double prime left parenthesis 1 right parenthesis equals 12 greater than 0. Hence there is a local minimum at x equals 1. We don't know yet about x equals 0. Taking the third derivative gives f triple prime left parenthesis x right parenthesis equals 72 x minus 24 and thus f triple prime left parenthesis 0 right parenthesis equals negative 24 not equals 0, thus there is a saddle point at x equals 0.

We can confirm this by plotting the function.

x f ( x ) = 3 x 4 4 x 3 -1.0 -0.5 0.0 0.5 1.0 1.5 0 2 4 6
Figure 10

(d) f prime left parenthesis x right parenthesis equals 4 x cubed minus 4 x equals 4 x left parenthesis x squared minus 1 right parenthesis equals x left parenthesis x plus 1 right parenthesis left parenthesis x minus 1 right parenthesis, hence the derivative is zero for x equals negative 1, x equals 0 and x equals 1.

The second derivative is f double prime left parenthesis x right parenthesis equals 12 x squared minus 4 yielding f double prime left parenthesis negative 1 right parenthesis equals 8 greater than 0 (local minimum at x equals negative 1), f double prime left parenthesis 0 right parenthesis equals negative 4 less than 0 (local maximum at x equals 0) and f double prime left parenthesis 1 right parenthesis equals 8 greater than 0 (local minimum at x equals 1).

Self help