Differentiation is the process by which we can get from a function, \(f(x)\), to its gradient function, \(f'(x)\), i.e. a function that outputs the gradient of the curve at a point.

Suppose we have some function, \(y=f(x)\) :

(*graph)

Lets now take two points on the graph. The first will just be a generic point, \((x,f(x))\). For the second point we will use \((x+\delta x, f(x+ \delta x))\), where \(\delta x\) means "a small change in x", i.e. our new point is our old point plus a small change:

(*graph)

If we join the two points with a line segment, we can see that the gradient of this line segment (we'll call it \(m\) for now) is given by:

\[m = \frac{f(x+\delta x)-f(x)}{\delta x}\]

from the usual formula that \(gradient=\frac{\Delta y}{\Delta x}\).

Now we can see that if we make \(\delta x\) smaller, the line segment joining the two points comes closer to being the gradient of the curve at the point \((x, f(x))\). I.e., as \(\delta x \to 0\), \(m \to f'(x)\):

(*animation)

Therefore, writing this in mathematical notation, we get:

\[f'(x)=\lim_{\delta x \to 0} \frac{f(x+\delta x)-f(x)}{\delta x}\]

where \(lim\) means the 'limit' (i.e. what it tends towards) as \(\delta x\) tends to zero. We have now derived the formula for the gradient function. Applying this formula is referred to as 'differentiating from first principles'.