1.2.3 · D1Calculus & Optimization Basics

Foundations — Partial derivatives

1,785 words8 min readBack to topic

This is the ground floor for the parent topic. If any symbol there felt like it appeared from nowhere, it gets built here from zero.


0. What counts as "zero"?

We assume you can add, multiply, and read a graph. Nothing else. Every letter, every squiggle, every notation the parent note leaned on gets introduced below in an order where each idea only uses ideas already built.


1. A variable — a slot that can hold a number

  • Plain words: "a number I haven't fixed yet, and might change."
  • The picture: a slider you can drag. Drag and its value goes up or down.
  • Why the topic needs it: the whole point of a derivative is changing an input and watching the output react. No changing box, nothing to differentiate.

A constant is the opposite: a box whose number is nailed down (like or ). The entire trick of partial derivatives is temporarily treating a variable as if it were a constant — so you must feel the difference between "can move" and "nailed down" in your bones.


2. A function — a machine that turns inputs into an output

  • Plain words: feed numbers in, get one number out.
  • The picture (Figure 1): a box with arrows going in and one arrow coming out.
Figure — Partial derivatives

The notation means the machine has two input slots. In ML we go further: is a machine with many slots. Each slot is a knob; the output is "how bad the model is". That is exactly why we need per-slot slopes later.


3. The graph — turning a function into a shape

For one input, draws a curve: horizontal axis = the input , vertical axis = the output. Height of the curve above a point = the value .

For two inputs, needs a surface — a hilly landscape floating over a flat floor. This is the picture the parent note used ("your height depends on how far east and how far north you stand"). We build that surface carefully in Figure 3.


4. Slope — steepness of a straight piece

  • Plain words: how many units up per one unit across.
  • The picture (Figure 2): a ramp. A gentle ramp has small slope; a steep wall has large slope; a flat floor has slope ; a downhill ramp has negative slope.
Figure — Partial derivatives

Why the topic needs it: a derivative is a slope — but a slope of a curve, not a straight line. To get there we need one more tool: the limit.


5. The limit — "creep closer and see where it heads"

A curve bends, so its steepness is different at every point. To measure the slope exactly at one point, we take a second point very close by and slide it in.

  • Plain words: "where is this going as the gap closes?"
  • The picture (Figure 3): two dots on a curve joined by a straight line. As the second dot slides in (gap ), that line settles onto the tangent — the slope right at the point.
  • The symbol : a tiny nudge in the input. Not zero, just small, and getting smaller.
Figure — Partial derivatives

6. The derivative (single variable) — slope of a curve at a point

This is the one-input case, covered fully in 1.2.02-Derivatives-single-variable. A partial derivative is literally this same formula — with the extra promise that the other inputs stay frozen. So if you can read this line, you are one small step from partials.

The shortcuts the parent uses (all from single-variable calculus):


7. Now the new symbols the parent introduces

  • The picture (Figure 4): take the hilly surface, slice it with a vertical wall running along the -direction at a fixed . Where the wall cuts the surface you get a 1-D curve. Its ordinary slope is .
Figure — Partial derivatives

8. How it all stacks (prerequisite map)

Variable vs constant

Function f of inputs

Graph = curve or surface

Slope = rise over run

Limit as h to zero

Derivative f prime

Power, constant, exp, chain rules

Partial derivative del f del x

Slice the surface at y const

Gradient nabla f

Gradient descent


Equipment checklist

Read each question, answer out loud, then reveal.

What does the letter right before a bracket, as in , mean?
The name of the machine (function); the bracket holds its inputs — it is never multiplication.
What is a slope in plain words?
Rise over run — how many units the output goes up per one unit sideways.
What does ask?
"Where does this expression head toward as the tiny nudge shrinks to zero?"
Why can't we just set in the difference quotient?
It gives , which is meaningless; we must cancel by algebra first, then close the gap.
Slope of by the power rule?
.
Slope of a constant (a fixed number)?
— a flat line has no steepness.
Slope of ?
itself.
What does the chain rule say for ?
.
What does the curly-d signal?
A partial derivative — all variables except the named one are held constant.
What does the subscript in tell you?
is the moving variable; everything else is frozen.
What is (nabla)?
The vector listing all partial derivatives; it points toward steepest ascent.
In the ML loss, what is the residual ?
, the prediction minus the true target.

Connections