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 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.
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
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 magnificationAn 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
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
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
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,
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.
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.
- Redraw Figure 8 showing the situation when and small.
- Sketch on the same axes and compare
- and its derivative sgn,
- and its derivative ,
- and its derivative ,
- 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 .
- Apply formula (2) to the function
- Adapt the diagram in Figure 10 and try to work through the argument given to show that
- Give an example of
- a function with a "kink" at .
- a function with "kinks" at , , and .
- Sketch, using a computer, the functions
About the author
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.
the graph of y=|x|-|x-1|+|x+2| is not like Figure 5.
If we choose x= 0 the value of y is 1. But in figure 5, for x = 0 value of y is 0.
Thans for pointing that out!
Thans for pointing that out! We have replaced the picture with a correct one.