Derivatives and Partial Derivatives
Training a model is a long series of small questions: "If I nudge this weight up a little, does the error go up or down, and by how much?" The derivative answers that question. With several weights, the partial derivative answers it for one weight at a time.
The rule
Derivative: output change per tiny input change. Partial: freeze every other input.
A derivative is the slope of a function at a point. Take . Its derivative is , so at the slope is 6. That means a tiny nudge in changes about six times as much: and , a rise of about .
The rules you need most:
- Power rule: the derivative of is . So gives .
- Constants vanish: a number on its own has slope 0.
- Constant multiples stay: the derivative of is 3.
- Sums split: differentiate each term separately.
The sign matters as much as the size. A positive slope means increasing increases . A negative slope means increasing decreases . To reduce an error, move the weight against the slope.
A model usually has many weights. A partial derivative measures the slope along one of them while every other weight is treated as a fixed number. For :
- , because is frozen, so is just times .
- , because has no in it and vanishes.
At these are 8 and 3.
The shortcut
Freeze, then power-rule. Before differentiating with respect to one variable, mentally replace every other variable with a number. What is left is a one-variable problem you already know how to solve.
Freeze b, differentiate w
3w² gives 6w. 2wb is a constant times w, giving 2b. b² has no w, giving 0. So the partial with respect to w is 6w + 2b.
The usual slip is forgetting a cross term like : it has a slope in both directions.
Drills
Answer fast — trust the rule.
What is the derivative of 5w³?
For f(w, b) = w² + 3wb, what is the partial derivative with respect to b?
The slope of w² at w = −2 is −4. What does the negative sign tell you?
For g(w, b) = 3w² + 2wb + b², what is the partial derivative with respect to w at (w, b) = (2, 1)?
Remember
- Derivative: output change per tiny input change. Partial: freeze every other input.
- Shortcut: freeze the others, then use the power rule.
- Trap: dropping cross terms like 2wb, which have a slope in both directions.
