November 2003

Sometimes, mathematics may seem like a collection of procedures and techniques, rather than the beautiful consistent whole it really is. One such collection of rules tells us how to find the slope, or "gradient", at a specific point on a curve described by a function. This is better known as differentiation, and is one part of calculus.

This article is the first of a pair which aim to help students encountering calculus for the first time. You do not need to know how to differentiate in order to follow, so it could be used as an introduction to the subject. However, the second article, to appear in issue 28 of Plus, will assume you have encountered differentiation as such a set of rules.

We start by explaining a little about gradients. In particular, we look at which functions do, and which functions do not, have a well defined gradient. Next we calculate the gradients of the two functions and at every point. The message here is not that we want the answers, which, if you have encountered calculus before, you probably know are and respectively, but rather the method, which gives us a taste of limits. The topic of limits belongs to a subject known in mathematics as analysis. This is a central core underpinning much of the machinery of applied maths.

Differentiation: the mathematical magnifying glass.
Image freeimages.co.uk

In the next article we will briefly recap how to avoid the case-by-case arguments we have used here by manipulating the algebraic expressions with which we usually describe functions. This is differentiation as we know and love it! We will also think about how functions are built from component parts, and how we differentiate a function by considering these parts individually and how they are combined.

Slopes will never look the same again.
Image DHD Photo Gallery

Let's start with a simple example, by considering the straight line shown in figure 1 below. The gradient of the line is defined to be

 (1)
If we take any two distinct points and on the line, the gradient is defined as which doesn't depend on which points we take. Defining in this way, the equation of the line is where is the value of at the point where the line crosses the -axis.

Figure 1: The gradient of a straight line

But what should we do with curves that are not straight, such as the graph of the function , shown in Figure 2 below? Let's choose the point , and try to decide what it means for the curve to have a gradient at the point . What we'll do is draw a "tangent line", and find the gradient of this straight line. The gradient of the curve will be defined to be the gradient of this line. We risk a horrible circular argument here because we want to take a straight line which "has the same gradient as the function at that point". But since we haven't a clue what the gradient is yet, we can't! Instead, let's try to make some sense of what a tangent line could be.

Figure 2: Finding the gradient of y=x2 at x=3

So, imagine you have a magnifying glass or microscope and you take a closer look at the function around the point . Imagine you can increase the zoom and keep zooming in to get a closer look at the function around the point (3,9). If you do this, very soon the curve seems to straighten out. For very high magnifications, the curve actually looks like a straight line. We say that at the point the function appears to become straight under magnification. So, we attempt to define the gradient of at as the gradient of the straight line which appears under very high magnification.

A note of caution, though. It is very important indeed that you magnify in both the and directions equally and simultaneously. If, for example, you continually stretch the -axis, the function will eventually appear to become flat! This is very misleading.

As you may already know, the formal process of differentiation allows us to calculate the value of this gradient at any point on a function that appears to become straight under magnification, not just at say. In a moment we will demonstrate that the gradient of the curve at a point is , by examining a limiting argument.

Have a look at the graph below. This looks very complicated but it too appears to become straight under magnification. A small area around has been magnified twenty times. In fact, if we magnified the function further it would quickly appear to be locally straight, and we could decide how to draw a tangent line.

Figure 3: A "spiky" function which is actually smooth, and even appears to become straight under magnification

So just looking casually at the graph itself is not necessarily a good guide as to whether the function appears to become straight under magnification, or not. However many commonly encountered functions, such as polynomials, and also the functions , and , will appear to become straight under magnification. Simply applying the formal rules of calculus in a mechanical way, without giving much thought to what you are doing, is also fraught with danger. The very fact that calculus is so effective, and the wealth of functions to which calculus may be applied, sometimes lulls the careless into thinking that all functions appear to become straight under magnification.

## Some functions which do not become straight under magnification

An example of a function which does not appear to become straight under magnification at the point is , which is defined as

Figure 4: The graph of |x| at various magnifications

The graph of is shown above under different degrees of magnification. It always appears "kinked" around the point . We can never fit a straight tangent line to the curve at the point . However, away from the point , is straight. The gradient of the function away from is if and when , which is simply the algebraic sign of , sometimes written as sgn:

Figure 5: The function f(x) = |x|-|x-1|+|x-2|

There are many other functions which do not become straight under magnification. Simply adding together shifted versions of , such as , will allow us to produce many different functions with "kinks". For example, the graph of the function is shown to the left.

Figure 6: The function f(x)=x|x-2| + 1

And shown to the right is the function . This has a kink at , but is not made of straight line sections.

In addition, it is possible to produce functions with an infinite number of such bad points. In fact, the graph shown below is of a continuous function which has a "kink" at every point! More correctly, we cannot define the gradient at any point of the curve.

Figure 7: A function which does not become straight under high magnification anywhere

Examples such as this were ignored as monsters by some 19th century mathematicians who argued about whether they were even functions. However, these are what make mathematics surprising and interesting. In fact, such examples are much more common that experience applying calculus to textbook examples would lead us to believe. Importantly, such objects, known as fractals, turn out to be very useful for describing the shapes of physical objects such as mountains, coast lines, fractures, cracks and so on. This is perhaps the most famous example, and is constructed by adding together an infinite number of of saw-tooth-like functions.

Other examples are a little easier to handle algebraically, but it is harder to prove they are "monstrous". Two such examples are

 (1)
and You might like to use a computer to approximate these functions by plotting the first few terms in each series. For the first of these functions you start by plotting then plot then and so on. You will soon see an intricately detailed function evolve.

## Calculating gradients of some simple functions

So far, we have done very little mathematical calculation or problem solving, and only discussed what happens when we look at the graphs of curves under magnification. Now we will try to calculate the gradient of a curve by manipulating the formula for the curve itself. We will calculate from first principles the gradient at every point of the two very familiar basic functions: and . Although you may already know the answers - and respectively - we are really interested in the method for finding them. Then we explain what goes wrong when we try to apply this method to the function at .

Figure 8: Calculating the gradient of a general function

To the left is the graph of a function , and the point at which we want to try to define the gradient. One way to think about the gradient is to draw a straight line connecting the points and on the curve. We may calculate the gradient of this straight line using equation (1): it is equal to This quantity is the change in divided by the change in , and this gradient is

Since we are interested in functions that appear to be straight under very high magnification, we are most interested in what happens when and are close together. This happens for very small positive and negative . The gradient of the line in the diagram above will then be very close to the gradient of the function, which now appears straight. Note that the diagram only shows the situation for and also when is quite large. You will have to imagine for yourself what happens when is small, or when . Here we can’t set as that would mean dividing by zero, which makes no sense.

### The function x2

Let us consider the concrete example . Calculating the formula

 (2)

gives

If is very small - positive or negative - we may approximate as . If we think about what happens as gets very small indeed, in the limit we have the slope of the tangent line. By a limiting argument, which can be made watertight mathematically, we say that the function does indeed become straight under magnification because we can make sense of the slope of the chord, in the limit when is very small indeed. The limiting slope of the chord defines the slope of the tangent. In this case the limit is . Therefore, we say the gradient of the tangent line is , although in this case we knew that already.

### The function sin(x)

Figure 9: The definition of the trigonometrical functions sin(x) and cos(x)

Next we attempt to deal with the function . Recall that if is an angle in a right angle triangle with hypotenuse , is the length of the opposite side, as shown to the left, which in our case is the length of the vertical side of the triangle.

Before we calculate the gradient of we need to think for a moment about angles, and more particularly about the units with which we measure angles. Recall that given a circle of radius , the circumference is . If we have a fraction of a whole circle we have arc length . Generally we don't talk about fractions of a circle, but rather an angle measured with some system of units. Two common methods are to use degrees, or radians. If we use an angle , the arc length will be , where is a constant that depends on the units of angle you use. If we use radians, then , which is the whole point of using radians! Therefore, if we have an angle measured in radians, the arc length is simply .

To calculate the gradient on the curve of , we need to evaluate

To do this we examine the diagram below, which gives us a clue as to how to estimate .

Figure 10: Calculating sin(x+h)

Here we have taken r=1. Each occurrence of the angle x is marked with a . Next we approximate the hypotenuse of the small triangle with right angle at , as the arc length of the circle, which is . For small values of , which we need to consider when finding the gradient, this is a very good approximation indeed. Therefore, since we have taken the radius , we have

and so Therefore the gradient of is equal to . Recall, the constant depends on the units we use to measure the angle. If we use radians then . This is the reason for adopting radians in mathematics, rather then degrees which are very convenient for more practical measuring purposes. Although does not appear in this formula, we assumed that was small in order to estimate the hypotenuse as the arc length. This allows us to calculate the gradient of the curve at the point .

### The function |x|

The diagrams in Figure 4 show convincingly that is not locally straight at . What happens if we try to calculate the quantity in formula (2) in this case? Well,

If , then and so this quantity equals . On the other hand, for all , , so this quantity equals . Thus as we approach from the positive direction the gradient appears to be , and from the negative direction the gradient appears to be . Since these do not agree, we cannot define the gradient at in a meaningful way. This confirms that is indeed not straight under magnification at .

In the next article we will continue this discussion and examine some formal rules which drastically reduce the effort necessary to calculate the gradient. We will also think about about how functions are built up in different ways, and how these rules are applied in much more complex situations.

## Exercises

The following exercises are suggestions of things you could work on to test whether you can adapt the arguments above to a new situation. There are no answers here to encourage you to work on them yourself.

1. Redraw Figure 8 showing the situation when and small.
2. Sketch on the same axes and compare
• and its derivative sgn,
• and its derivative ,
• and its derivative ,
3. Apply formula (2) to the following functions and simplify them as far as possible. Try to write your answer in the form , where depends only on , not on .
• ,
• ,
• .
What happens when becomes very small? What can you say about ?
4. Apply formula (2) to the function Write your answer as a single fraction. What happens when becomes very small?
5. Adapt the diagram in Figure 10 and try to work through the argument given to show that Instead of approximating for very small , you might need to use for very small .
6. Give an example of
• a function with a "kink" at .
• a function with "kinks" at , , and .
7. Sketch, using a computer, the functions If possible, sketch for larger . Try, in your mind's eye, to relate these partial sums to the infinite sum

Chris Sangwin is a member of staff in the School of Mathematics and Statistics at the University of Birmingham. He is a Research Fellow in the Learning and Teaching Support Network centre for Mathematics, Statistics, and Operational Research. His interests lie in mathematical Control Theory.

Chris would like to thank Mr Martin Brown, of Thomas Telford School, for his helpful advice and encouragement during the writing of this article.