Derivatives and Differentiation

Derivatives and Differentiation

Definition: The derivative of a function at a point is its instantaneous rate of change there, equivalently the slope of the line tangent to its graph at that point, defined formally as the limit f’(x) = lim(h→0) [f(x+h) - f(x)] / h.

How It Works

  • The derivative of a function at a point measures its instantaneous rate of change there: how fast f(x) is changing at that exact instant, not averaged over some interval.
  • Geometrically, the derivative at a point equals the slope of the tangent line to the curve at that point, the single straight line that just grazes the curve there without crossing through it locally.
  • The derivative is formally defined as a limit: f’(x) = lim(h→0) [f(x+h) - f(x)] / h, the slope of a secant line through two points on the curve as those two points are pulled infinitely close together.
  • That secant-to-tangent process is why the derivative is sometimes described as “the limit of average rate of change as the interval shrinks to zero”: average becomes instantaneous once the two points collapse into one.
  • Differentiating a function produces another function, f’(x), that reports the original function’s slope at every x, not just a single number but a full formula.
  • Because f’(x) is itself a function, it can be differentiated again, producing the second derivative, f”(x), which measures how the slope itself is changing (the curve’s concavity).
  • The power rule handles the most common building block directly: d/dx[x^n] = n·x^(n-1); bring the exponent down as a multiplying constant, then subtract one from the exponent.
  • The constant multiple rule (d/dx[c·f(x)] = c·f’(x)) and the sum rule (d/dx[f(x)+g(x)] = f’(x)+g’(x)) let you differentiate term by term, which is why polynomials are so easy to differentiate.
  • More complex combinations need the product rule (for f(x)·g(x)) and the chain rule (for f(g(x)), a function nested inside another); both exist because the power, constant multiple, and sum rules alone can’t handle products or compositions.
  • Physics reuses the same derivative repeatedly on one quantity: velocity is the derivative of position with respect to time, and acceleration is the derivative of velocity, making it the second derivative of position.
  • Setting f’(x) = 0 finds a function’s critical points, the candidates for local maxima and minima; checking the sign of f’(x) on either side (or the sign of f”(x) at the point) tells you whether the function is increasing, decreasing, or turning around there.

Illustration

x y -10 10 -10 10

f(x) = x³ - 3x x = 0.50, f(x) = -1.37 f’(x) = -2.25 (tangent slope) Decreasing

Drag the slider to move the point along f(x) = x³ - 3x. The gold point and its tangent line track the curve live, with the tangent's slope always equal to f'(x) = 3x² - 3 at that point.

var curve = document.getElementById(‘deriv-curve’); var guide = document.getElementById(‘deriv-guide’); var tangent = document.getElementById(‘deriv-tangent’); var point = document.getElementById(‘deriv-point’); var pointTxt = document.getElementById(‘deriv-point-txt’); var slopeTxt = document.getElementById(‘deriv-slope-txt’); var statusTxt = document.getElementById(‘deriv-status-txt’);

var xIn = document.getElementById(‘deriv-x’); var xOut = document.getElementById(‘deriv-x-out’); var resetBtn = document.getElementById(‘deriv-reset’);

function fmt(n) { return (Math.round(n * 100) / 100).toFixed(2).replace(/.00$/, ‘.0’); }

function drawCurve() { // Static curve, sampled once at load; it never changes since this // widget only ever moves a point and tangent line along a fixed f(x). var pts = []; for (var x = -10; x <= 10.001; x += 0.25) { var y = clampY(f(x)); var p = toPx(x, y); pts.push((pts.length === 0 ? ‘M’ : ‘L’) + p[0].toFixed(1) + ’,’ + p[1].toFixed(1)); } curve.setAttribute(‘d’, pts.join(’ ’)); }

function update() { var x0 = parseFloat(xIn.value); xOut.textContent = fmt(x0);

var y0 = f(x0);
var m = fPrime(x0);

var pp = toPx(x0, clampY(y0));
point.setAttribute('cx', pp[0]);
point.setAttribute('cy', pp[1]);

var gp2 = toPx(x0, 0);
guide.setAttribute('x1', pp[0]); guide.setAttribute('y1', pp[1]);
guide.setAttribute('x2', gp2[0]); guide.setAttribute('y2', gp2[1]);

// Live tangent line through (x0, y0) with slope m, built from the
// point-slope form y = y0 + m(x - x0). Walk a fixed distance L along
// the line's direction vector (1, m), normalized, so the segment has
// the same on-screen length whether the tangent is shallow or steep.
var L = 2.5;
var norm = Math.sqrt(1 + m * m);
var dx = L / norm;
var dy = m * dx;
var tp1 = toPx(x0 - dx, clampY(y0 - dy));
var tp2 = toPx(x0 + dx, clampY(y0 + dy));
tangent.setAttribute('x1', tp1[0]); tangent.setAttribute('y1', tp1[1]);
tangent.setAttribute('x2', tp2[0]); tangent.setAttribute('y2', tp2[1]);

pointTxt.textContent = 'x = ' + fmt(x0) + ', f(x) = ' + fmt(y0);
slopeTxt.textContent = "f'(x) = " + fmt(m) + ' (tangent slope)';

if (m > 0.05) {
  statusTxt.textContent = "Increasing (f' > 0)";
} else if (m < -0.05) {
  statusTxt.textContent = "Decreasing (f' < 0)";
} else {
  statusTxt.textContent = "Critical point (f' ≈ 0)";
}

}

xIn.addEventListener(‘input’, update); resetBtn.addEventListener(‘click’, function () { xIn.value = 0.5; update(); });

drawCurve(); update(); })();

Under the Hood

f'(x) = lim(h→0) [f(x+h) - f(x)] / h      limit definition of the derivative
d/dx[x^n] = n·x^(n-1)                     power rule
d/dx[c·f(x)] = c·f'(x)                    constant multiple rule
d/dx[f(x) + g(x)] = f'(x) + g'(x)         sum rule
  • The power rule itself falls directly out of the limit definition: expanding (x+h)^n with the binomial theorem and letting h→0 leaves only the n·x^(n-1) term, since every other term in the expansion carries a factor of h and vanishes in the limit.

Worked Example 1: Differentiating a polynomial term by term. Given: f(x) = x³ - 3x. Step 1: apply the power rule to each term; the sum rule lets you differentiate them separately: d/dx[x³] = 3x², and d/dx[-3x] = -3. Step 2: add the results together. Answer: f’(x) = 3x² - 3.

Worked Example 2: Finding a tangent line’s equation at a specific point. Given: f(x) = x³ - 3x, find the tangent line at x = 2. Step 1: f(2) = 2³ - 3(2) = 8 - 6 = 2, so the tangent touches the curve at the point (2, 2). Step 2: f’(2) = 3(2)² - 3 = 12 - 3 = 9, so the tangent’s slope is 9. Step 3: apply point-slope form, y - 2 = 9(x - 2). Answer: y = 9x - 16.

Worked Example 3: Finding critical points and classifying them. Given: f(x) = x³ - 3x, the same cubic driving the widget above. Step 1: set f’(x) = 0: 3x² - 3 = 0, so x² = 1, so x = ±1. Step 2: test the sign of f’(x) = 3(x-1)(x+1) on either side of each critical point: at x = -2, f’ = 3(-3)(-1) = 9 (positive); at x = 0, f’ = 3(-1)(1) = -3 (negative); at x = 2, f’ = 3(1)(3) = 9 (positive). Step 3: at x = -1, f’ switches from positive to negative, so the function stops increasing and starts decreasing there, a local maximum. At x = 1, f’ switches from negative to positive, so the function stops decreasing and starts increasing there, a local minimum. Answer: local max at (-1, 2), local min at (1, -2); the second derivative f”(x) = 6x confirms it independently: f”(-1) = -6 (concave down, a max) and f”(1) = 6 (concave up, a min).

History

  • Isaac Newton developed his version of calculus, which he called the method of “fluxions,” during the 1660s and 1670s, motivated directly by problems in physics: describing the changing velocities and accelerations of moving bodies.
  • Gottfried Wilhelm Leibniz independently developed calculus around the same period, in the 1670s, publishing the notation dy/dx, the same notation still used today; Newton and Leibniz are both credited today as co-inventors of calculus, having reached the same core ideas independently of one another.
  • Their near-simultaneous, independent discoveries led to a bitter priority dispute between England and continental Europe that dragged on for decades, with each side’s supporters accusing the other of plagiarism.
  • The dispute is often blamed for setting English mathematics back for roughly a century, since English mathematicians loyally stuck with Newton’s clunkier fluxion notation long after continental Europe had moved on to Leibniz’s more workable dy/dx system.
  • Neither Newton nor Leibniz had a fully rigorous definition of the derivative available to them; both leaned on an intuitive, not fully justified notion of “infinitesimally small” quantities.
  • The rigorous limit-based definition used today, f’(x) = lim(h→0)[f(x+h)-f(x)]/h, was only formalized in the 19th century, largely by Augustin-Louis Cauchy, putting calculus on solid logical footing more than 150 years after Newton and Leibniz first developed it.

Why It Matters

  • Velocity and acceleration in physics are literally derivatives of position: velocity is the first derivative of position with respect to time, and acceleration is the second.
  • Optimization in economics and engineering, finding the price that maximizes profit or the design that minimizes material cost, routinely reduces to finding a function’s critical points.
  • Machine learning’s core training method, gradient descent, is built entirely on derivatives: it repeatedly adjusts parameters in the direction that most decreases a loss function, exactly the direction its derivative points.
  • Economists use marginal cost and marginal revenue, the derivatives of total cost and total revenue with respect to quantity, to find the exact production level that maximizes profit.
  • Related-rates problems in engineering use the chain rule to connect the rates at which several changing quantities affect each other, such as how fast a shadow lengthens as a person walks away from a light.
  • Any field that models change over time or space, from population growth in biology to reaction rates in chemistry to infection curves in epidemiology, reaches for a derivative as its basic unit of “how fast.”

Common Pitfalls

  • Forgetting that the power rule takes two steps, not one: bring the exponent down as a multiplying constant, and subtract one from the exponent. Doing only the first half leaves the exponent unchanged, an easy silent error.
  • Assuming every critical point (where f’(x) = 0) is automatically a local max or min. Some are neither, such as x = 0 in f(x) = x³, a saddle/inflection point where the function briefly flattens but keeps increasing on both sides.
  • Confusing the average rate of change (the slope of a secant line through two points) with the instantaneous rate of change (the slope of the tangent line at a single point, the actual derivative). They only agree in special cases.
  • Sign errors when a function is written with negative exponents or as a root: rewrite roots as fractional exponents (√x = x^(1/2)) and reciprocals as negative exponents (1/x² = x^-2) before applying the power rule, or the sign and exponent are easy to get wrong.
  • Forgetting that a constant term disappears entirely when differentiated (d/dx[c] = 0), then wrongly carrying a leftover constant into the derivative.
  • Applying the plain power rule directly to something like (3x + 1)², getting 2(3x + 1) and stopping, instead of remembering the chain rule requires an extra multiplication by the inner function’s own derivative (3 in this case), giving 6(3x + 1).

Comparison

AspectAverage Rate of ChangeInstantaneous Rate of Change
Geometric pictureSlope of the secant line through two pointsSlope of the tangent line at one point
Formula[f(b) - f(a)] / (b - a)f’(x) = lim(h→0) [f(x+h) - f(x)] / h
What it needsTwo distinct points on the curveOne point, plus the limiting process
What it tells youHow much f changed on average over an intervalHow fast f is changing at that exact instant
Everyday exampleA trip’s average speed over 2 hoursA speedometer’s reading at one instant

FAQ

Is the derivative the same thing as slope? Yes, at a single point on a curve. The derivative f’(x) is defined as, and always equals, the slope of the line tangent to the graph at that point. “Slope” for a straight line and “derivative” for a curve are the same underlying idea, just extended from lines to curves that bend.

Can a function fail to have a derivative even where it’s continuous? Yes. A function is differentiable at a point only if it is continuous there and has no sharp corner or vertical tangent. A corner, like |x| at x = 0, has no single well-defined tangent slope, so the derivative does not exist there even though the function itself is perfectly continuous.

Does f’(x) = 0 always mean a local max or min? No, it only means the tangent line is horizontal there. It is a necessary condition for a smooth local max or min, not a sufficient one; the point could instead be a saddle or inflection point where the function pauses and then keeps going the same direction, as with x = 0 in f(x) = x³.

Example

A car traveling along a straight road has position s(t) = t³ - 3t (in suitable units) measured from a starting mark. Its velocity is v(t) = s’(t) = 3t² - 3, the same derivative worked out above, and it momentarily stops and reverses direction at exactly t = 1 second, precisely the critical point (and local minimum of position) found by hand in the Under the Hood section.

Dig deeper