Chapter 2

Derivatives

Definition

Derivative

If the limit

exists, is differentiable at and is its derivative there.

Geometrically, is the slope of the tangent line at . The notion of limit used here is the one from Limits › The precise definition.

Common derivatives

A numerical check

For small the difference quotient approaches the derivative. This program uses a central difference to check that :

const derivative = (f: (x: number) => number, x: number, h = 1e-5): number =>
  (f(x + h) - f(x - h)) / (2 * h)
 
console.log(derivative(Math.sin, 0)) // ≈ 1 = cos(0)

Why a central difference

The central difference has error ; a one-sided difference has error . For the same , the former is far more accurate.

The chain rule

If is differentiable at and is differentiable at , then

Comments