GMRES problem:

This is a least-squares problem but the solution is simple.

Recall that from Arnoldi:

These are the steps to solve the least-squares problem:

From the definition of the Krylov subspace and the fact that is orthogonal, we get:

We are already familiar with this matrix

This is the top left block in the upper Hessenberg form Its size of .

The final least-squares problem we need to solve is