# 10.1 Definition of the derivative

For a single-variable function, e.g. $f(x)$, the derivative tells us the "gradient" at any given point on a function. It can also be thought of as a ratio which specifies how much the value of $f(x)$ changes when we change $x$.

Another way to think about the gradient is to think about the slope that the
tangent ^{1}^{1}
1
A tangent to a curve is a straight line which touches the
curve at only a single point. to the curve at a given point would have. This is
the same as the gradient at that point.

For example, in the curve below, the straight line (in grey) is a tangent to the curve at the point $x=1$.

The derivative gives us a formula for the gradient of a tangent to the curve at any point on the curve ^{2}^{2}
2
Technically, the derivative of some functions are not defined for the whole function, but that’s not relevant here.. It initially looks difficult to compute this. A good approach is to attempt to approximate this.

First, let’s think about what we’re trying to find. The gradient of a straight line which goes through the points $(x_{1},y_{1})$ and $(x_{2},y_{2})$ is given by the formula below. ^{3}^{3}
3
This is explained further up in the document. TODO: actually explain this

$\displaystyle m$ | $\displaystyle=\frac{\Delta y}{\Delta x}$ | (10.1) | ||

$\displaystyle=\frac{y_{2}-y_{1}}{x_{2}-x_{1}}$ | (10.2) |

Because we don’t know how to find the gradient at one point on the curve, a good way to approximate this is to find the gradient of the curve using points which are close to each other.

Let’s pick some points and work out the corresponding gradients.

$x_{1}$ | $f(x_{1})$ | $x_{2}$ | $f(x_{2})$ | $h$ | gradient |

1 | -4 | 1.1 | -3.49 | 0.1 | 5.1 |

1 | -4 | 1.01 | -3.9499 | 0.01 | 5.01 |

1 | -4 | 1.001 | -3.994999 | 0.001 | 5.001 |

1 | -4 | 1.0001 | -3.9995 | 0.0001 | 5.0001 |

1 | -4 | 1.00001 | -3.99995 | 1E-05 | 5.00001 |

As we pick values of $x_{2}$ which are closer and closer to the point $x=1$ at which we are trying to find the gradient, it is clear that the gradient gets closer and closer to $5$. The lines we draw (if you sketch them)
^{4}^{4}
4
Or, if you look at these diagrams. also become closer and closer to the tangent line.

This is how we compute derivatives, but before we can do that, we need to introduce some new mathematics, called the "limit." The idea of a limit is that it gives us the value of a function, as the independent variable approaches a given value.

For example,

Which means that as we get close to $x=3$ (but not necessarily, at $x=3$) the value of the function tends to $9$. Limits are most useful for functions where we don’t know the value at a given point, but we do know the values around that point. For example, suppose we had a function $f(x)=3x$, except at $x=3$ where it was undefined. In that case $f(3)$ is undefined, but $\lim_{x\to 3}f(x)=3$.

The derivative of a function $f(x)$, is defined as a limit.

Let’s work out the derivative of $f(x)=x^{2}+3x-8$ at any point on the curve.

$\displaystyle\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$ | $\displaystyle=\lim_{h\to 0}\frac{((x+h)^{2}+3(x+h)-8)-(x^{2}+3x-8)}{h}$ | (10.5) | ||

$\displaystyle=\lim_{h\to 0}\frac{x^{2}+2hx+h^{2}+3x+3h-8-x^{2}-3x+8}{h}$ | (10.6) | |||

$\displaystyle=\lim_{h\to 0}\frac{2hx+h^{2}+3h}{h}$ | (10.7) | |||

$\displaystyle=\lim_{h\to 0}2x+h+3$ | (10.8) | |||

$\displaystyle=2x+3$ | (10.9) |

This gives us a formula for the gradient anywhere on this polynomial!

We can write the derivative in a number of ways. The best^{5}^{5}
5
Fight me. is

Where "$dy$" means a really small change in $y$ (or an infinitesimal of $y$), and "$dx$" means (you guessed it) a really small change in $x$ (or an infinitesimal of $x$).

Note that the variables don’t have to be $y$ and $x$! They could be any function and its dependent variable, for example if we had a function $q(o)=o^{2}+24o-100$ we could write its derivative in either of the forms below. Note that the second form is a handy way for denoting the derivative of an expression.

There are also a bunch of other ways which are usually worse, but are still used (usually for brevity, because they’re much shorter than writing out $\frac{dy}{dx}$ every time).

Again, the function could be called something other than $y(x)$. For example in the case of $q(o)$ we’d write