Why This Matters
In calculus, the derivative is introduced as the slope of a tangent line or the rate of change. But the rigorous definition is a limit: f prime of c equals the limit as h approaches 0 of (f(c + h) minus f(c)) divided by h. This limit must exist in the epsilon-delta sense for the derivative to be defined.
Rolle theorem says that if a differentiable function equals the same value at two endpoints, then its derivative is zero somewhere between them. The mean value theorem generalizes this: between any two points, the derivative takes on the average rate of change. These are not just elegant statements — they are the engine behind proving that zero-derivative functions are constant, that antiderivatives are unique up to constants, and that Taylor approximations have bounded error.
Define Terms
Visual Model
The full process at a glance. Click Start tour to walk through each step.
Rolle theorem leads to the mean value theorem, which in turn proves that derivatives control function behavior.
Code Example
// Rigorous derivative computation
// Compute derivative as limit of difference quotients
function derivative(f, c, h) {
return (f(c + h) - f(c)) / h;
}
// Watch the difference quotient converge
console.log("f(x) = x^3, f prime(2) should be 12:");
for (const h of [0.1, 0.01, 0.001, 0.0001, 0.00001]) {
const dq = derivative(x => x**3, 2, h);
console.log(` h=${h}: quotient = ${dq.toFixed(8)}, error = ${Math.abs(dq - 12).toExponential(3)}`);
}
// Symmetric difference quotient (more accurate)
function symmetricDerivative(f, c, h) {
return (f(c + h) - f(c - h)) / (2 * h);
}
console.log("\nSymmetric quotient for f(x) = x^3 at x = 2:");
for (const h of [0.1, 0.01, 0.001]) {
const sd = symmetricDerivative(x => x**3, 2, h);
console.log(` h=${h}: ${sd.toFixed(10)}, error = ${Math.abs(sd - 12).toExponential(3)}`);
}
// Rolle theorem verification
// f(x) = x^2 - 4 on [-2, 2]: f(-2) = f(2) = 0
// f prime(x) = 2x, so f prime(0) = 0
const f1 = x => x*x - 4;
console.log("\nRolle: f(x) = x^2 - 4 on [-2, 2]");
console.log(` f(-2) = ${f1(-2)}, f(2) = ${f1(2)}`);
console.log(` f prime(0) = ${derivative(f1, 0, 0.0001).toFixed(6)} (should be 0)`);
// Mean Value Theorem verification
// f(x) = x^3 on [1, 3]
// MVT: f prime(c) = (f(3) - f(1))/(3 - 1) = (27 - 1)/2 = 13
const f2 = x => x*x*x;
const avgRate = (f2(3) - f2(1)) / (3 - 1);
console.log(`\nMVT: f(x) = x^3 on [1, 3]`);
console.log(` Average rate: (f(3)-f(1))/2 = ${avgRate}`);
// f prime(x) = 3x^2, so 3c^2 = 13, c = sqrt(13/3)
const c_mvt = Math.sqrt(13/3);
console.log(` c = sqrt(13/3) = ${c_mvt.toFixed(6)}`);
console.log(` f prime(c) = ${(3 * c_mvt * c_mvt).toFixed(6)} (should be ${avgRate})`);
console.log(` c is in (1, 3): ${c_mvt > 1 && c_mvt < 3}`);Interactive Experiment
Try these exercises:
- Compute the difference quotient for f(x) = |x| at x = 0 using h = 0.1, 0.01, -0.1, -0.01. Why do the left and right limits disagree?
- For f(x) = x * sin(1/x) at x = 0 (with f(0) = 0), check if the difference quotient converges as h approaches 0. Is this function differentiable at 0?
- Verify the MVT for f(x) = sin(x) on [0, pi]: find c where f prime(c) = (sin(pi) - sin(0))/pi = 0. Where is cos(c) = 0?
- For f(x) = e^x on [0, 1], compute the MVT value c and verify that c = ln(e - 1). Check numerically.
- Show that if f prime(x) = 0 for all x in [0, 1], then f(0.5) must equal f(0) by applying MVT to [0, 0.5].
Quick Quiz
Coding Challenge
Write a function called `findMVTPoint` that takes a function f, its derivative fPrime, and an interval [a, b]. It should return a value c in (a, b) where f prime(c) equals the average rate of change (f(b) - f(a))/(b - a), accurate to within 0.001. Use a numerical search: evaluate fPrime at many points in (a, b) and find the one closest to the average rate.
Real-World Usage
Rigorous differentiation theory powers much of applied science and engineering:
- Optimization: Gradient descent relies on the mean value theorem to guarantee that moving in the negative gradient direction decreases the function value (for small enough step sizes).
- Error analysis: Taylor remainder estimates, derived from the mean value theorem, bound the error of polynomial approximations used in scientific computing.
- Physics: Proving conservation laws often requires showing that a derivative is zero on an interval, using the MVT consequence that zero derivative implies constancy.
- Automatic differentiation: Modern ML frameworks compute exact derivatives using the chain rule and limit definition, rather than finite differences, for numerical stability.
- Control theory: Lyapunov stability analysis uses the derivative of energy functions to prove system stability — the rigorous framework ensures these proofs are valid.