Recall that the cost function in CG is quadratic:

After scaling by , the level curves of the cost function become simple circles. At each step, we make an incremental correction to the solution that is orthogonal to all the previous steps (with the scaling). This is illustrated in the figure below.

Corollary. We obtain the exact solution in at most steps, where is the size of matrix .