Gradient Descent

Click on the contour plot to set a starting point, then step or run the iteration.
Heat map & iso-contours of \(f\). Dots = iterates, arrow = negative gradient \(-\nabla f\).
log-scaled slider, \(\eta \in [10^{-4},\,10^{0}]\)
iteration \(n\)0
point \((x_n, y_n)\)
\(f(x_n, y_n)\)
\(\|\nabla f\|\)
statusidle

The method

To minimize a differentiable function \(f:\mathbb{R}^2\to\mathbb{R}\), gradient descent moves in the direction of steepest decrease, the negative gradient:

\[ \mathbf{x}_{n+1} \;=\; \mathbf{x}_n \;-\; \eta\,\nabla f(\mathbf{x}_n), \qquad \nabla f = \left(\frac{\partial f}{\partial x},\, \frac{\partial f}{\partial y}\right). \]

The step size \(\eta > 0\) (the learning rate) controls how far each step travels. Things to observe with the demo:

Back to Collection