Solution (source code)

= Solution

The <descent lemma> follows by integrating the <gradient> along the line and using its <Lipschitz continuity>:
$$
f(x+\alpha p)\leq f(x)+\alpha g(x)^Tp+\frac\gamma2\alpha^2\|p\|_2^2,\qquad\alpha\geq0.
$$
This upper bound is at most the right side of the <Armijo condition> when $\alpha[(1-\beta)g^Tp+\gamma\alpha\|p\|_2^2/2]\leq0$. Since $g^Tp<0$, it holds for
$$
\boxed{0\leq\alpha\leq\alpha_{\max}=\frac{2(1-\beta)(-g^Tp)}{\gamma\|p\|_2^2}=\frac{2(\beta-1)g^Tp}{\gamma\|p\|_2^2}.}
$$
The zero step gives equality; every positive step in this interval satisfies the prescribed sufficient-decrease test.