If we think about the triangle drawing idea above and bring it to a limit, so that we're drawing an arbitrarily small triangle, then we approach the true gradient at the point. This lets us derive the formula for a derivative from first principles.

Say we have the function f and we want to find the gradient at the point x

_{1}. Then we 'draw' a horizontal line from the point (x

_{1}, f(x

_{1})) to the point (x

_{1}+ δx, f(x

_{1})) and a vertical line from the point (x

_{1}+ δx, f(x

_{1})) to the point (x

_{1}+ δx, f(x

_{1}+ δx)), where δx is a small change in the x-coordinate.

Now, dividing the length of the vertical line by the length of the horizontal line, and cancelling, gives us the approximation to the gradient at the point x

_{1}:

f(xNow, this should give us the exact gradient if we let δx go to zero, so the formula we eventually obtain for the gradient of a function f at a point x_{1}+ δx) - f(x_{1}) --------------------- δx

_{1}is:

f(x_{1}+ δx) - f(x_{1}) f^{|}(x_{1}) = lim_{δx->0}--------------------- δx

Now for a quick example. Anyone who's taken even the most elementary of elementary calculus courses knows that the derivative of x

^{n}is nx

^{n-1}. Pumping f(x) = x

^{n}into the formula derived above gives:

(x_{1}+ δx)^{n}- x_{1}^{n}f^{|}(x_{1}) = lim_{δx->0}--------------------- δx

Now, by the binomial theorem: (x

_{1}+ δx)

^{n}= x

_{1}

^{n}+ nx

_{1}

^{n-1}δx + (n(n-1)/2)x

_{1}

^{n-2}δx

^{2}+ o(δx

^{3})

where o(δx^{3}) means terms where δx is present in at least the third power.

x_{1}^{n}+ nx_{1}^{n-1}δx + (n(n-1)/2)x_{1}^{n-2}δx^{2}+ o(δx^{3}) - x_{1}^{n}f^{|}(x_{1}) = lim_{δx->0}---------------------------------------------------- δx nx_{1}^{n-1}δx + (n(n-1)/2)x_{1}^{n-2}δx^{2}+ o(δx^{3}) = lim_{δx->0}-------------------------------------- δx nx_{1}^{n-1}δx (n(n-1)/2)x_{1}^{n-2}δx^{2}o(δx^{3}) = lim_{δx->0}------- + ----------------- + ------- δx δx δx

lim

_{δx->0}(δx

^{2}/δx) and lim

_{δx->0}(o(δx

^{3})/δx) are both zero, so, after cancelling δx's, we are left with:

f^{|}(x_{1}) = nx_{1}^{n-1}

I've used the <pre> tag lots and lots and it looks fine on my system. If it looks all funny, please /msg me.