Limits and the Formal Derivative Definition hero
Lesson 2Derivatives and Sensitivity

Limits and the Formal Derivative Definition

Define the formal mathematical derivative as the limit of average rates of change as the step interval shrinks toward an infinitesimal nudge.

In Lesson 1, we watched the secant slope converge toward 4.04.0 as Δx\Delta x became tiny.

Why can't we simply plug Δx=0\Delta x = 0 directly into the secant equation?

f(x+0)−f(x)0=f(x)−f(x)0=00\frac{f(x + 0) - f(x)}{0} = \frac{f(x) - f(x)}{0} = \frac{0}{0}

Plugging in Δx=0\Delta x = 0 results in 00\frac{0}{0}, which is undefined. Division by zero is mathematically impossible.

Calculus solves this dilemma using the concept of a limit.


The Limit Process: Shrinking Intervals Without Division by Zero

A limit evaluates the value that an expression approaches as an input variable gets closer and closer to a target value, without ever needing to touch that target value.

We write:

lim⁡Δx→0g(Δx)\lim_{\Delta x \to 0} g(\Delta x)

This is read: "The limit of g(Δx)g(\Delta x) as Δx\Delta x approaches zero."

We do not set Δx=0\Delta x = 0. Instead, we inspect the algebraic behavior of the ratio as Δx\Delta x shrinks toward zero through non-zero numbers (0.1,0.01,0.001,…0.1, 0.01, 0.001, \dots).


The Formal Definition of the Derivative

Combining the secant slope equation with the limit operator gives the Formal Definition of the Derivative:

dydx=lim⁡Δx→0f(x+Δx)−f(x)Δx\frac{dy}{dx} = \lim_{\Delta x \to 0} \frac{f(x + \Delta x) - f(x)}{\Delta x}

In Lagrange notation, the derivative is also written as f′(x)f'(x) (pronounced "f-prime of x"):

f′(x)=lim⁡Δx→0f(x+Δx)−f(x)Δxf'(x) = \lim_{\Delta x \to 0} \frac{f(x + \Delta x) - f(x)}{\Delta x}

This equation defines the instantaneous rate of change of the function f(x)f(x) with respect to xx at any point where the limit exists.


Symbol Translation: Greek Δ\Delta vs. Latin dd

Understanding calculus notation removes its intimidating appearance.

Notice how the symbols shift between macroscopic and microscopic analysis:

Macroscopic Difference (Secant Slope):       Δy / Δx   (Greek Delta: measurable change)
Microscopic Differential (Tangent Slope):     dy / dx   (Latin d: infinitesimal nudge)
  1. Δx\Delta x (Delta x): A macroscopic, real-world difference (e.g., Δx=1.0\Delta x = 1.0 hour or Δx=0.5\Delta x = 0.5 units).
  2. dxdx (Differential x): An infinitesimal nudge—a microscopic step in xx that is smaller than any measurable real number, yet strictly non-zero.
  3. dydy (Differential y): The resulting infinitesimal response in output yy caused by the input nudge dxdx.

The notation dydx\frac{dy}{dx} (introduced by Gottfried Wilhelm Leibniz) is written as a fraction for a deliberate reason: it represents the ratio of the infinitesimal output change dydy to the infinitesimal input nudge dxdx.

When reading dydx\frac{dy}{dx} in neural networks, translate the fraction into plain English:

"The resulting change in output y, for every microscopic nudge in input x."\text{\textit{"The resulting change in output $y$, for every microscopic nudge in input $x$."}}


First-Principles Derivation of f(x)=x2f(x) = x^2

Let's derive the exact derivative of f(x)=x2f(x) = x^2 algebraically from the formal definition, with zero hand-waving.

We begin with the definition:

dydx=lim⁡Δx→0f(x+Δx)−f(x)Δx\frac{dy}{dx} = \lim_{\Delta x \to 0} \frac{f(x + \Delta x) - f(x)}{\Delta x}

Step 1: Substitute f(x)=x2f(x) = x^2 into the numerator:

f(x+Δx)=(x+Δx)2f(x + \Delta x) = (x + \Delta x)^2 dydx=lim⁡Δx→0(x+Δx)2−x2Δx\frac{dy}{dx} = \lim_{\Delta x \to 0} \frac{(x + \Delta x)^2 - x^2}{\Delta x}

Step 2: Expand the binomial term (x+Δx)2(x + \Delta x)^2:

(x+Δx)2=x2+2xΔx+(Δx)2(x + \Delta x)^2 = x^2 + 2x\Delta x + (\Delta x)^2

Substitute this back into the fraction:

dydx=lim⁡Δx→0x2+2xΔx+(Δx)2−x2Δx\frac{dy}{dx} = \lim_{\Delta x \to 0} \frac{x^2 + 2x\Delta x + (\Delta x)^2 - x^2}{\Delta x}

Step 3: Simplify the numerator (x2−x2=0x^2 - x^2 = 0):

dydx=lim⁡Δx→02xΔx+(Δx)2Δx\frac{dy}{dx} = \lim_{\Delta x \to 0} \frac{2x\Delta x + (\Delta x)^2}{\Delta x}

Step 4: Factor out Δx\Delta x from the numerator:

dydx=lim⁡Δx→0Δx(2x+Δx)Δx\frac{dy}{dx} = \lim_{\Delta x \to 0} \frac{\Delta x (2x + \Delta x)}{\Delta x}

Step 5: Cancel the non-zero Δx\Delta x in numerator and denominator:

dydx=lim⁡Δx→0(2x+Δx)\frac{dy}{dx} = \lim_{\Delta x \to 0} (2x + \Delta x)

Step 6: Evaluate the limit as Δx→0\Delta x \to 0:

As Δx\Delta x approaches 00, the second term simply vanishes:

dydx=2x+0=2x\frac{dy}{dx} = 2x + 0 = \mathbf{2x}

We have proven from first principles that for the function f(x)=x2f(x) = x^2, the derivative at any point xx is:

ddx[x2]=2x\frac{d}{dx}[x^2] = 2x

Let's evaluate this general formula at specific coordinates:

  • At x=2x = 2: dydx=2(2)=4.0\frac{dy}{dx} = 2(2) = \mathbf{4.0} (matching our secant calculations exactly).
  • At x=0x = 0: dydx=2(0)=0.0\frac{dy}{dx} = 2(0) = \mathbf{0.0} (the flat base of the parabola).
  • At x=−3x = -3: dydx=2(−3)=−6.0\frac{dy}{dx} = 2(-3) = \mathbf{-6.0} (a steep downhill slope).

Key Mathematical Takeaways: Secant-to-Tangent Convergence

  • Secant-to-Tangent Convergence: As the perturbation interval Δx→0\Delta x \to 0, the secant line between (x0,f(x0))(x_0, f(x_0)) and (x0+Δx,f(x0+Δx))(x_0+\Delta x, f(x_0+\Delta x)) rotates smoothly into the instantaneous tangent line, and the average rate of change ΔyΔx\frac{\Delta y}{\Delta x} converges to dydx\frac{dy}{dx}.
  • Slope as Derivative Value: The slope of the tangent line at any point x0x_0 matches the analytical derivative f′(x0)=2ax0+bf'(x_0) = 2ax_0 + b.
  • Stationary Point Horizon: At the vertex (x=0x = 0 for f(x)=x2f(x)=x^2), the tangent line becomes completely horizontal (dydx=0\frac{dy}{dx} = 0), marking the stationary point.

Previous
The Rate of Change and Tangent Slopes