Below is a compact, step-by-step derivation of the classic (batch) Gradient Descent (GD) weight-update rule that you see in most machine-learning textbooks:
- Problem Statement
Given
L(w) ≔ loss / cost / objective function
with parameter vector w ∈ ℝ^d, we want
w* = arg min_w L(w).
Because a closed-form solution is rarely available, we use an iterative search that repeatedly moves w “downhill’’ until convergence.
- First-Order Taylor Expansion
Take the current iterate w^t. For a small step Δw we have the 1st-order (linear) approximation
L(w^t + Δw) ≈ L(w^t) + ∇L(w^t)ᵀ Δw. (1)
∇L(w^t) is the gradient column vector of partial derivatives evaluated at w^t.
- Choose Δw that decreases L
We want Δw that minimizes the right-hand side of (1) while keeping the step length small, i.e.
min_{Δw} ∇L(w^t)ᵀ Δw subject to ||Δw||₂ = ε, (2)
where ε>0 is a tiny constant “step radius”.
• Using a Lagrange multiplier or the Cauchy–Schwarz inequality, the solution to (2) is
Δw* = −ε ∇L(w^t) / ||∇L(w^t)||₂. (3)
So the best direction is opposite the gradient (the direction of steepest descent); ε/||∇L|| plays the role of a scalar step size.
- Introduce a Tunable Scalar Step (Learning Rate)
Instead of fixing ε geometrically, we introduce a user-controlled learning rate η>0:
Δw = −η ∇L(w^t). (4)
- The Update Rule
Plug (4) into w^{t+1}=w^t+Δw:
w^{t+1} = w^t − η ∇L(w^t). (5)
Equation (5) is the Gradient Descent update.
- Scalar (1-D) View
If L is a function of a single parameter θ,
θ_{new} = θ_{old} − η (dL/dθ).
Same derivation—just replace vectors with scalars.
- Component-wise Form
For each coordinate j = 1…d,
w_j^{,t+1} = w_j^{,t} − η ∂L/∂w_j │_{w=w^t}. (6)
- Variants (Mentioned for Context)
• Stochastic Gradient Descent (SGD): replace L by loss on a single sample.
• Mini-batch GD: gradient computed on a small batch.
• Momentum, Adam, etc.: modify (5) with additional terms but still descend along (functions of) the gradient.
Key Take-away
The rule
w ← w − η ∇L(w)
arises directly from minimizing a linearized (first-order) surrogate of the loss under a small-step constraint, yielding movement in the direction of steepest decrease—namely, the negative gradient.