Solution (source code)

= Solution

For the <quadratic function>, write $r_j=b-Ax_j$ and restrict to the full line $x_j+\alpha p_j$. <Symmetry> of $A$ gives
$$
f(x_j+\alpha p_j)=f(x_j)-\alpha p_j^Tr_j+\frac{\alpha^2}{2}p_j^TAp_j.
$$
The coefficient $p_j^TAp_j$ is positive by <positive definiteness> and $p_j\ne0$. The unique <minimizer> is therefore
$$
\boxed{\alpha_j=\frac{p_j^Tr_j}{p_j^TAp_j},\qquad x_{j+1}=x_j+\alpha_jp_j.}
$$
<Quadratic minimization along a line> also gives the exact change
$$
f(x_{j+1})-f(x_j)=-\frac{(p_j^Tr_j)^2}{2p_j^TAp_j}.
$$
Thus \b[strict decrease holds exactly when $p_j^Tr_j\ne0$]. The search is over the whole line, so $\alpha_j$ can be negative; a positive <step size> would require the additional <descent direction> condition $p_j^Tr_j>0$.