Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
Calculus  ›  Lesson

Derivatives and Partial Derivatives

Derivatives, Partial Derivatives 14 minA derivative measures how fast an output changes for a tiny change in one input, and a partial derivative does the same while holding every other input fixed.

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 f(w)=w2f(w) = w^2. Its derivative is f′(w)=2wf'(w) = 2w, so at w=3w = 3 the slope is 6. That means a tiny nudge in ww changes ff about six times as much: f(3)=9f(3) = 9 and f(3.01)=9.0601f(3.01) = 9.0601, a rise of about 6×0.016 \times 0.01.

The rules you need most:

  • Power rule: the derivative of wnw^n is nwn−1n w^{n-1}. So 5w35w^3 gives 15w215w^2.
  • Constants vanish: a number on its own has slope 0.
  • Constant multiples stay: the derivative of 3w3w is 3.
  • Sums split: differentiate each term separately.

The sign matters as much as the size. A positive slope means increasing ww increases ff. A negative slope means increasing ww decreases ff. 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 f(w,b)=w2+3wbf(w, b) = w^2 + 3wb:

  • ∂f/∂w=2w+3b\partial f / \partial w = 2w + 3b, because bb is frozen, so 3wb3wb is just 3b3b times ww.
  • ∂f/∂b=3w\partial f / \partial b = 3w, because w2w^2 has no bb in it and vanishes.

At (w,b)=(1,2)(w, b) = (1, 2) 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.

Both partials of g(w, b) = 3w² + 2wb + b²Step 1 of 4
  1. 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 2wb2wb: it has a slope in both directions.

Drills

Answer fast — trust the rule.

quick drill

What is the derivative of 5w³?

quick drill

For f(w, b) = w² + 3wb, what is the partial derivative with respect to b?

quick drill

The slope of w² at w = −2 is −4. What does the negative sign tell you?

quick drill

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.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainFreeze, then power-rule

For g(w, b) = 3w² + 2wb + b², find both partial derivatives, evaluate them at w = 1, b = 1, and explain what the sign of each tells you about which way to move w and b to make g smaller.