Solution (source code)

= Solution

The exact minimization gives $r_{j+1}=r_j-\alpha_jAp_j$, with $\alpha_j=p_j^Tr_j/(p_j^TAp_j)$. For <steepest descent method>, the next <search direction> is $p_{j+1}=r_{j+1}$. Hence
$$
\boxed{p_j^Tp_{j+1}=p_j^Tr_j-\alpha_jp_j^TAp_j=0.}
$$
Thus consecutive nonzero <search directions> are <orthogonal>. This calculation even covers an arbitrary initial direction $p_1$, as in the generic algorithm: it only needs the exact preceding line minimization and the choice $p_{j+1}=r_{j+1}$. If the new <linear-system residual> is zero, the <linear system> is already solved. No pairwise orthogonality of all nonconsecutive directions is asserted.