✖

Derivative of a function

The derivative is a basic concept in differential calculus. It plays an important role in curve sketching, for example, and it is hated by students on the one hand, while on the other even a suitably trained monkey can work one out. This article only describes and explains the definition of the derivative and related concepts. You will find worked examples in the neighbouring articles: simple examples of derivatives and harder examples. The opposite process to differentiation is integration.

What is a derivative

Before we get to the definition of the derivative, let’s look at what a derivative actually gives us and what it can be useful for.

The derivative of a function gives us the slope (gradient) of the tangent. That is probably a lot of jargon at once, so let’s start from the beginning. Simply put, a tangent is a line that touches the graph at exactly one point. That is not a precise definition – for that, read the article on Wikipedia – but it is roughly good enough. Now look at the following figure:

Tangent to a function

The black curve is the graph of the function y = x2. The blue line is the tangent to this function at the point D(1, 1), marked in red. The angle α that the tangent makes with the x-axis – more precisely with the positive x-axis – is marked in green. Now let’s define the slope of the tangent. In this figure, the slope of the tangent is the tangent of the angle alpha. The tangent is a classic trigonometric function, which lets us work out angles and side lengths in a triangle, for example. So the slope of the tangent is the tangent of the angle that the tangent line makes with the positive x-axis. And we get this slope using derivatives.

We also distinguish between the derivative of a function at a point and the derivative of a function. The derivative of a function at a point is the slope of the tangent at that point. The derivative of a function is then another function, which gives the slope for a general input x. An example follows.

Motivation

So we can use the derivative to work out the slopes of tangents. What can that be good for? Look at the following figure:

Four different tangents to the function y=x^2

The figure again shows the function y = x2 and four marked tangents: two green and two blue. Notice that the function y = x2 is decreasing on the interval (−∞,0), while on the interval (0,∞) it is increasing. But what also holds for their tangents, or rather for the angle they make with the positive x-axis? The blue tangents, which pass through points in the interval where the function is increasing, make an angle of less than 90 degrees with the axis. The green tangents make an angle greater than 90 degrees with the axis. How does this show up in the slopes of the tangents?

For that we need to know how the tangent function behaves. From the following graph we learn that if the angle is less than 90 degrees, the value of the tangent is positive (the part highlighted in blue); conversely, if the angle is greater than 90 degrees but less than 180 degrees (that is, less than π radians), the value of the tangent is negative. What can we conclude? If the slope of the tangent at a given point (don’t forget that the slope is the tangent of the angle) is positive, the function is increasing at that point; if it is negative, the function is decreasing.

Tangent with the intervals where its value is positive and negative marked

Definition

Before we get to the definition of the derivative itself, we have a long way to go. And we will need the limit of a function. If you are not comfortable with limits, go back to them or just skip ahead to the formulae – the rest probably is not for you.

Before moving on to the slope of the tangent itself, we will stop at the slope of a chord (secant line), which is easier. A chord is a line that cuts the graph at two points. Now we will try to derive how to work out this slope. Look at the figure:

Chord of a function

There is the graph of the function x2 + 1 and a chord s, which cuts the graph at two points (0.5, 1.25) and (2, 5). These points are highlighted in blue. Since we are not very interested in the specific values, the graph marks them in general as a and b and f(a) and f(b). Here f(a) is the value of the function f at x = a. For example, the value of our function x2 + 1 at x = 2 is 22 + 1 = 5.

Now we want to work out the angle labelled alpha, that is, the angle that the chord makes with the x-axis. First we will modify the figure a little so that we get a triangle, which will be easier to work with.

Chord of a function with a highlighted triangle

What did we do? We joined the points where the chord meets the graph of the function y = x2 + 1 with a line segment and completed them into a right-angled triangle ABC. How does that help? The angle labelled β has the same size as the angle α (they are corresponding angles). And we know the lengths of the sides AB and BC. We have |AB| = b − a (it is simply the distance from a to b). Similarly, the length |BC| = f(b) − f(a). So how do we work out the size of the angle β, or rather α?

We need to know how to work out the tangent. The tangent is the ratio of the opposite side to the adjacent side, so the tangent of the angle alpha (beta) is equal to the ratio of the length of the side BC to the length of the side AB. Let’s write that down:

tan(β)=|BC||AB|=f(b)−f(a)b−a.

Since the slope is the tangent of the angle, this formula gives us the slope of the chord. But how does that help when we want the slope of the tangent? Imagine that we move the points A and C closer together until they coincide. The figure shows the approach:

Moving the chords closer

The closer we bring the upper point of intersection to the lower one, the closer the chord comes to being a tangent. The original chord (line) CA was far from being a tangent. When we move the point C closer to A, we get for example the chord C1A, which is already more like a tangent. The chord C2A is more like one still, and so on.

When does the chord become a tangent? When both points of intersection merge into one, that is, when for some point Cn we had Cn = A. At that moment the chord has become a tangent, which is what we wanted. The question is how to work out the slope, because we cannot simply subtract these two points, since they are the same:

tan(β)=f(a)−f(a)a−a=00.

This does not work, we cannot work it out this way. It was no accident that we only moved the points closer together. We will need a limit. We now want the slope of the tangent at the point (a, f(a)) and we have the slopes of all possible chords (we can already work those out). So we will gradually work out the slopes of chords that we move closer so that a tangent appears. So we will move b closer to a. We cannot move the points so that they are equal, but we can move them so that their difference tends to zero in the limit. Aha, a limit. So we will move b towards a until they are equal in the limit. In other words, we work out the limit as b tends to a. That is all, the formula looks like this:

tan(α)=limb→af(b)−f(a)b−a.

We call this limit the derivative of the function f(x) at the point x = a. Remember that the angle α is equal to the angle β. We do not usually use the variables a and b, but look for the derivative at the point x0 and approach it with the point x. We can then write:

tan(α)=limx→x0f(x)−f(x0)x−x0.

So far, as with continuity of a function, we have only defined the derivative at one point. If we have a function f(x) that is differentiable on an open interval I, then the values of this derivative define a function f′(x), which we call the derivative of the function.

We write the derivative using a prime, something like this:

(x2)′=2x,f′(x)=…f′(x0)=…

You may also come across another form of notation, using dx:

ddxf(x)=f′(x)

In the formula we have just used, we can therefore replace the tangent by the notation for the derivative:

f′(x0)=limx→x0f(x)−f(x0)x−x0.

We can also define the one-sided derivative from the right or from the left using one-sided limits. We will not deal with that now, it is not that important.

A slightly different definition

Another definition of the derivative of a function at a point looks like this:

f′(a)=limh→0f(a+h)−f(a)h.

How do we arrive at such a definition? We only need to change the figure we started from a little. We can write the distance from the point a to the point b as h = b − a. That means we can write the point b as a + h, because h is exactly the distance from a to b. The figure would look like this:

Another definition of the derivative

At the bottom we have the points a and a + h and on the y-axis f(a) and f(a + h). Now we again create a triangle and work out the tangent of the angle beta. The only difference is that we already have the length of the side AB, it is exactly h.

Finite and infinite derivatives

Derivatives can be finite or infinite too, just like limits of functions. What does that mean? A derivative is finite if its value at a point is equal to some real number. A derivative is infinite if it is equal to plus or minus infinity. How can we picture this geometrically? When is the slope “infinite”? Let’s start with an easier question – what does a tangent look like if its slope is equal to some large number? From the graph of the tangent function (see above) we can see that if the value of the tangent is large, the angle approaches 90 degrees (if we are moving in the interval (0, 180)).

We could conclude from this that if a function has an infinite derivative at a point, the tangent makes a right angle with the x-axis, that is, it is perpendicular to it. And indeed it does. What might the graph of such a function look like and at which point would the tangent be perpendicular to the x-axis? For example the function y=x3:

Tangent to the cube root of x at x=0

Basic properties

  • For a function to have a derivative at a point, it must be defined in some epsilon neighbourhood of that point. If there were no such neighbourhood, we could not work out the limits through which the derivative is defined.

  • The uniqueness of the existence (or non-existence) of limits implies that if a derivative exists at a point, it is unique. No function has several derivatives at one point. It has either one or none.

  • As with one-sided limits, if a function has a derivative at a point, then the derivatives from the left and from the right must be equal.

  • Sometimes we need the second derivative. It is nothing complicated: we simply differentiate the function once and then differentiate the result again. We write it with two primes: f''(x) = (f'(x))'.

  • An important property: if a function has a derivative at a point, then the function is continuous at that point. This again follows from the properties of limits. Watch out: the converse is not true. If a function is continuous at a given point, that does not mean it is differentiable there. A typical example is the function f(x) = |x|. Its graph has a sharp point and we cannot work out the slope of the tangent at that point. You can try working out the derivative from the left and from the right – they will be different.

    Graph of the function f(x)=|x|

  • Derivatives can also be used to work out some limits, using L’Hôpital’s rule.

The next article contains a list of formulae for working with derivatives. You will find some more on Wikipedia.

You can also look at worked examples of derivatives and then, if you like, at harder examples of derivatives.

If you need to check a derivative quickly, you can use a maths tool such as Wolfram|Alpha. Just type, for example, “derivative of x^2+6x” into its input box and Wolfram will work out the derivative of the function you entered.