About the Derivative Visualiser
The derivative f'(x) is the instantaneous rate of change of a function, defined as the limit of the difference quotient: f'(x) = lim(Δx→0) [f(x + Δx) − f(x)] / Δx. Geometrically, the secant line through (x, f(x)) and (x + Δx, f(x + Δx)) has slope [f(x + Δx) − f(x)] / Δx; as Δx shrinks to zero, this secant approaches the tangent line, whose slope is f'(x). Differentiation is the foundation of calculus and has applications everywhere from Newton's equations of motion (F = ma = m·d²x/dt²) to gradient descent in machine learning.
The simulator plots f(x) and animates the secant line collapsing to a tangent as Δx decreases. A second panel shows f'(x) computed numerically alongside the analytical derivative, letting you compare them and explore how differentiation rules — chain rule, product rule, quotient rule — transform the graph visually.
Frequently Asked Questions
What is the formal definition of a derivative?
The derivative of f at x is f'(x) = lim(h→0) [f(x+h) − f(x)]/h, provided the limit exists. The function is called differentiable at x if this limit exists and is finite. If the limit exists from the right and left but they are unequal, the function has a "corner" at x (like |x| at x = 0) and is not differentiable there, even though it is continuous. Differentiability implies continuity but the converse is false — the Weierstrass function is continuous everywhere but differentiable nowhere.
What does the sign of the derivative tell you about the function?
Where f'(x) > 0, the function is increasing; where f'(x) < 0, it is decreasing; where f'(x) = 0, the function has a stationary point (possible maximum, minimum, or saddle). The second derivative f''(x) refines this: if f'(x) = 0 and f''(x) > 0, the point is a local minimum; if f''(x) < 0, a local maximum. Where f''(x) = 0 and f''changes sign, the function has an inflection point — where concavity switches from upward to downward or vice versa.
What is the chain rule and why is it important?
The chain rule states that if y = f(g(x)), then dy/dx = f'(g(x)) · g'(x) — the derivative of the outer function evaluated at the inner, multiplied by the derivative of the inner. It is arguably the most important differentiation rule, as almost every real function is a composition. In neural networks, the backpropagation algorithm is simply repeated application of the chain rule through each layer: gradients flow backward as products of local Jacobians, enabling gradient descent to train deep networks.
What is the difference between a derivative and a differential?
The derivative f'(x) is a number (or function) representing the instantaneous rate of change. The differential dy = f'(x) dx is an infinitesimal linear approximation to the change in y corresponding to an infinitesimal change dx in x. Differentials are useful for error propagation (if x has uncertainty Δx, then Δy ≈ f'(x)·Δx), linear approximation (f(x+h) ≈ f(x) + f'(x)·h for small h), and as the foundation of differential geometry on manifolds.
What is numerical differentiation and what are its pitfalls?
Numerical differentiation approximates f'(x) using finite differences, e.g., the forward difference [f(x+h) − f(x)]/h or the centred difference [f(x+h) − f(x−h)]/(2h). The centred difference has O(h²) truncation error versus O(h) for the forward difference. However, using too small an h causes catastrophic cancellation in floating-point arithmetic: when h = 10⁻¹⁵ on a 64-bit double, f(x+h) and f(x) agree to 15 digits and their difference is dominated by rounding error. The optimal h for a centred difference is approximately (ε_machine)^(1/3) ≈ 10⁻⁵ for doubles.
What is automatic differentiation (AD)?
Automatic differentiation computes exact derivatives of computer programs (not just mathematical functions) by applying the chain rule to each elementary arithmetic operation. In forward-mode AD, each variable carries a "dual" part tracking its derivative; in reverse-mode AD (which is backpropagation in ML), the program is first evaluated forward, then derivatives are accumulated backward through a computational graph. AD avoids both the symbolic complexity of calculus rules and the numerical errors of finite differences, making it the standard approach in modern deep learning frameworks like PyTorch and JAX.
How does the derivative relate to the tangent line?
The tangent line to f at x₀ is the unique line passing through (x₀, f(x₀)) with slope f'(x₀): y = f(x₀) + f'(x₀)(x − x₀). It is the best linear approximation to f near x₀ — formally, the error |f(x) − [f(x₀) + f'(x₀)(x − x₀)]| = o(|x − x₀|) as x → x₀. This "little-o" characterisation is actually the modern definition of differentiability on manifolds, generalising naturally to surfaces and higher-dimensional spaces where slopes don't make sense but linear approximations do.
What is L'Hôpital's rule?
L'Hôpital's rule states that if lim(x→a) f(x) = lim(x→a) g(x) = 0 (or ±∞), then lim(x→a) f(x)/g(x) = lim(x→a) f'(x)/g'(x), provided the latter limit exists. It resolves indeterminate forms (0/0, ∞/∞). A classic example: lim(x→0) sin(x)/x = lim(x→0) cos(x)/1 = 1. It was published by Guillaume de l'Hôpital in 1696 in the first textbook on differential calculus, though Bernoulli derived the result and sold it to l'Hôpital under a financial agreement.
What is the mean value theorem?
The mean value theorem (MVT) states that if f is continuous on [a, b] and differentiable on (a, b), then there exists c ∈ (a, b) such that f'(c) = [f(b) − f(a)]/(b − a) — the instantaneous rate of change equals the average rate of change at some interior point. The MVT underpins many fundamental results: it proves that a function with f'(x) = 0 everywhere is constant, and it is the basis of the fundamental theorem of calculus. In engineering it justifies using local derivative measurements to infer global behaviour.