Synaplume

Calculus

Derivatives: The Mathematics of Change

45 min

The question calculus answers

"If I nudge the input a tiny bit, how much does the output change?"

That single question is the derivative, and it is the engine of all deep learning. Here's why it matters: a model has parameters (those ww's). Training asks, over and over: if I nudge this weight up a little, does my error go down? The derivative answers instantly, for millions of weights at once.

From slope to derivative

For a straight line y=3x+1y = 3x + 1, the slope is always 3: increase xx by 1 and yy rises by 3, everywhere.

Curves are trickier — the steepness of y=x2y = x^2 keeps changing. The trick: zoom in. Any smooth curve looks straight under enough magnification. The slope of that local straight line is the derivative at that point, written dydx\frac{dy}{dx} or f(x)f'(x).

For f(x)=x2f(x) = x^2, the derivative is f(x)=2xf'(x) = 2x:

  • At x=3x = 3: slope =6= 6 (climbing steeply)
  • At x=0x = 0: slope =0= 0 (flat — the bottom of the valley!)
  • At x=3x = -3: slope =6= -6 (descending steeply)

Slope zero marks the bottom. Remember that; it is the entire premise of model training: we search for the flat spot at the bottom of the error curve.

The rules (you need surprisingly few)

RuleStatementExample
Powerddxxn=nxn1\frac{d}{dx} x^n = n x^{n-1}ddxx3=3x2\frac{d}{dx}x^3 = 3x^2
Constant multipleddxcf=cf\frac{d}{dx} c f = c f'ddx5x2=10x\frac{d}{dx}5x^2 = 10x
Sum(f+g)=f+g(f + g)' = f' + g'derivatives add up
Exponentialddxex=ex\frac{d}{dx} e^x = e^x(its own slope!)
Logarithmddxlnx=1x\frac{d}{dx} \ln x = \frac{1}{x}shows up in log-loss

In practice, deep learning frameworks (PyTorch, TensorFlow) compute all derivatives automatically — it's called autodiff. You will rarely differentiate by hand. But you must understand what the numbers mean: a derivative is a sensitivity dial — how much does the output care about this input?

Minima: where learning stops

Training wants to minimize error. At a minimum the derivative is zero — the curve is flat. So a naive recipe for learning is:

  1. Compute the derivative of the error with respect to each parameter.
  2. If the derivative is positive, the error increases with the parameter → decrease the parameter. If negative → increase it.
  3. Repeat until every derivative is (near) zero.

That recipe has a name — gradient descent — and after one more concept (gradients) you'll fully understand it.

Key takeaways

  • Derivative = local slope = "how sensitive is the output to this input?"
  • Slope zero ⇒ flat ⇒ possible minimum: exactly what training searches for.
  • Frameworks differentiate for you (autodiff); your job is interpreting the result.

Check your understanding

0/3 answered
  1. 1.The derivative of f(x)=x2f(x) = x^2 at x=3x = 3 is…

  2. 2.At the bottom of a valley in the loss curve, the derivative is…

  3. 3.In deep learning frameworks, derivatives are computed…

Share:

0% of Mathematics for AI completed

Up nextGradients & the Chain Rule