In more detail
Formally, f′(x) = lim (h → 0) of (f(x + h) − f(x)) / h: the slope of the line through two points on the curve as the points move together. The power rule says d/dx xⁿ = n × xⁿ⁻¹, so the derivative of x³ is 3x². Other rules handle combinations: (fg)′ = f′g + fg′ for products and f(g(x))′ = f′(g(x)) × g′(x) (the chain rule) for functions inside functions. Where the derivative is zero the function has a peak, a trough or a flat spot; the second derivative tells which.
Why it matters
Derivatives are rates: speed is the derivative of position, marginal cost is the derivative of total cost, and finding where a derivative is zero is how you find a maximum or minimum. When software estimates a derivative numerically with a small step h, a step that is too small loses accuracy to floating-point rounding.
Example
f(x) = x³ − 6x² + 9x + 1
f′(x) = 3x² − 12x + 9 = 3(x − 1)(x − 3)
f″(x) = 6x − 12
f′ is zero at x = 1 and x = 3. f″(1) = −6 is negative, so f(1) = 5 is a local maximum; f″(3) = 6 is positive, so f(3) = 1 is a local minimum. At x = 2 the slope is f′(2) = −3, and the difference quotient with h = 0.001 gives −2.999999.
Common confusion
The Slope of a straight line is one number everywhere. A derivative is the slope of the tangent line, which changes from point to point on a curve.