Nepedia
Back to Discover
Advanced Reader
🔢

Gradient descent

math Maturity 11-13 Next article →

Gradient descent is a method used for unconstrained mathematical optimization. It is a first-order iterative algorithm. This means it uses a sequence of steps to minimize a differentiable multivariate function. In simple terms, it finds the lowest point of a mathematical surface. This process is vital in machine learning and artificial intelligence. It helps computers minimize a cost function or a loss function. This reduction of error allows machines to learn from data.

Gradient descent
Gradient descent

The mechanism relies on the concept of a gradient. A gradient is a vector that points in the direction of the steepest ascent. To find the minimum, the algorithm takes steps in the opposite direction. This is known as the direction of steepest descent. If you move in the direction of the gradient, you perform gradient ascent to find a maximum. The algorithm starts with an initial guess for a local minimum. It then calculates the gradient at that specific point. The next point is found by subtracting a portion of the gradient from the current position. This process repeats until the algorithm reaches a minimum point.

Choosing the right step size is a critical part of the process. This step size is often called the learning rate. If the learning rate is too small, the algorithm will converge very slowly. If the learning rate is too large, the algorithm might overshoot the minimum. This can lead to divergence, where the algorithm fails to find the bottom. Mathematicians use different methods to find a good step size. One method is called line search. This can follow specific rules known as the Wolfe conditions. Another approach is backtracking line search, which provides good experimental results.

Gradient Descent Example Nonlinear Equations
Gradient Descent Example Nonlinear Equations

There are different types of functions that affect how the algorithm behaves. A function is called convex if it has a bowl-like shape. In a convex function, any local minimum is also the global minimum. This means the algorithm is guaranteed to find the absolute lowest point. However, non-linear functions can be much more complex. In these cases, the algorithm might get stuck in a local minimum. A local minimum is a low point that is not the lowest point of the entire function. It might also get stuck at a saddle point.

Okanogan-Wenatchee National Forest, morning fog shrouds trees (37171636495)
Okanogan-Wenatchee National Forest, morning fog shrouds trees (37171636495)

The history of gradient descent spans many important mathematicians. Augustin-Louis Cauchy is generally credited with suggesting the method in 1847. Later, in 1907, Jacques Hadamard independently proposed a similar method. The convergence properties for non-linear problems were studied by Haskell Curry in 1944. Since then, the method has become much more widely studied. Today, a simple extension called stochastic gradient descent is very common. It is the basic algorithm used to train most deep networks in modern artificial intelligence.

Gradient descent can also be used to solve systems of linear equations. This is done by reformulating the system as a quadratic minimization problem. If the system matrix is real, symmetric, and positive-definite, the method works very well. However, the path taken can sometimes be inefficient. If the condition number of the matrix is large, the algorithm produces a zig-zag path. This happens because the residual vectors are orthogonal across iterations. The algorithm tends to overshoot and then correct itself in a different direction.

Steepest descent
Steepest descent

This mathematical tool is deeply connected to many fields of science. It works in spaces of any number of dimensions. It can even work in infinite-dimensional function spaces. In those cases, mathematicians use the Fréchet derivative to find the direction. Whether solving nonlinear equations or training neural networks, the core idea remains the same. It is a constant search for the most efficient path toward a minimum. This makes it one of the most important tools in modern mathematics and computer science.

623 words

Where will your curiosity go next?

Keep exploring at your chosen reading level.

🖼️ Images & Media (5)
Gradient Descent in 2D.webm
File:Gradient descent.svg
Gradient descent.svg
File:Okanogan-Wenatchee National Forest, morning fog shrouds trees (37171636495).jpg
Okanogan-Wenatchee National Forest,...
File:Steepest descent.png
Steepest descent.png
File:Gradient Descent Example Nonlinear Equations.gif
Gradient Descent Example Nonlinear Equations.gif
More to explore

🔬 Go deeper

More advanced topics to explore

🪜 Step back

Simpler topics to build understanding

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.