# Barzilai-Borwein method

The Barzilai-Borwein method is an iterative gradient descent method for unconstrained optimization using either of two step sizes derived from the linear trend of the most recent two iterates. This method, and modifications, are globally convergent under mild conditions, and perform competitively with conjugate gradient methods for many problems. Not depending on the objective itself, it can also solve some systems of linear and non-linear equations.

## Method

To minimize a convex function $f:\mathbb {R} ^{n}\rightarrow \mathbb {R}$ with gradient vector $g$ at point $x$, let there be two prior iterates, $g_{k-1}(x_{k-1})$ and $g_{k}(x_{k})$, in which $x_{k}=x_{k-1}-\alpha _{k-1}g_{k-1}$ where $\alpha _{k-1}$ is the previous iteration's step size (not necessarily a Barzilai-Borwein step size), and for brevity, let $\Delta x=x_{k}-x_{k-1}$ and $\Delta g=g_{k}-g_{k-1}$.
A Barzilai-Borwein (BB) iteration is $x_{k+1}=x_{k}-\alpha _{k}g_{k}$ where the step size $\alpha _{k}$ is either
[long BB step] $\alpha _{k}^{LONG}={\frac {\Delta x\cdot \Delta x}{\Delta x\cdot \Delta g}}$, or
[short BB step] $\alpha _{k}^{SHORT}={\frac {\Delta x\cdot \Delta g}{\Delta g\cdot \Delta g}}$.
Barzilai-Borwein also applies to systems of equations $g(x)=0$ for $g:\mathbb {R} ^{n}\rightarrow \mathbb {R} ^{n}$ in which the Jacobian of $g$ is positive-definite in the symmetric part, that is, $\Delta x\cdot \Delta g$ is necessarily positive.

## Derivation

Despite its simplicity and optimality properties, Cauchy's classical steepest-descent method for unconstrained optimization often performs poorly. This has motivated many to propose alternate search directions, such as the conjugate gradient method. Jonathan Barzilai and Jonathan Borwein instead proposed new step sizes for the gradient by approximating the quasi-Newton method, creating a scalar approximation of the Hessian estimated from the finite differences between two evaluation points of the gradient, these being the most recent two iterates.
In a quasi-Newton iteration,
$x_{k+1}=x_{k}-B^{-1}g(x_{k})$
where $B$ is some approximation of the Jacobian matrix of $g$ (i.e. Hessian of the objective function) which satisfies the secant equation $B_{k}\Delta x_{k}=\Delta g_{k}$. Barzilai and Borwein simplify $B$ with a scalar $1/\alpha$, which usually cannot exactly satisfy the secant equation, but approximate it as ${\frac {1}{\alpha }}\Delta x\approx \Delta g$. Approximations by two least-squares criteria are:
[1] Minimize $\|\Delta x/\alpha -\Delta g\|^{2}$ with respect to $\alpha$, yielding the long BB step, or
[2] Minimize $\|\Delta x-\alpha \Delta g\|^{2}$ with respect to $\alpha$, yielding the short BB step.

## Properties

In one dimension, both BB step sizes are equal and same as the classical secant method.
The long BB step size is the same as a linearized Cauchy step, i.e. the first estimate using a secant-method for the line search (also, for linear problems). The short BB step size is same as a linearized minimum-residual step. BB applies the step sizes upon the forward direction vector for the next iterate, instead of the prior direction vector as if for another line-search step.
Barzilai and Borwein proved their method converges R-superlinearly for quadratic minimization in two dimensions. Raydan demonstrates convergence in general for quadratic problems. Convergence is usually non-monotone, that is, neither the objective function nor the residual or gradient magnitude necessarily decrease with each iteration along a successful convergence toward the solution.
If $f$ is a quadratic function with Hessian $A$, $1/\alpha ^{LONG}$ is the Rayleigh quotient of $A$ by vector $\Delta x$, and $1/\alpha ^{SHORT}$ is the Rayleigh quotient of $A$ by vector ${\sqrt {A}}\Delta x$ (here taking ${\sqrt {A}}$ as a solution to $({\sqrt {A}})^{T}{\sqrt {A}}=A$, more at Definite matrix).
Fletcher compared its computational performance to conjugate gradient (CG) methods, finding CG tending faster for linear problems, but BB often faster for non-linear problems versus applicable CG-based methods.
BB has low storage requirements, suitable for large systems with millions of elements in $x$.
${\frac {\alpha ^{SHORT}}{\alpha ^{LONG}}}=\cos({\text{angle between }}\Delta x{\text{ and }}\Delta g)^{2}$.

## Modifications and related methods

Since being demonstrated by Raydan, BB is often applied with the non-monotone safeguarding strategy of Grippo, Lampariello, and Lucidi. This tolerates some rise of the objective, but excessive rise initiates a backtracking line search using smaller step sizes, to assure global convergence. Fletcher finds that allowing wider limits for non-monotonicity tend to result in more efficient convergence.
Others have identified a step size being the geometric mean between the long and short BB step sizes, which exhibits similar properties.