Solution (source code)

= Solution

The <power method> starts from $q_0\ne0$ and iterates
$$
q_{j+1}=\frac{Aq_j}{\|Aq_j\|}.
$$
If the <eigenvalue> of largest <modulus> is separated by a <spectral gap> and the initial <vector> is <nonorthogonal> to a corresponding <eigenvector>, the iterates converge in direction to that <eigenvector>.

<Inverse iteration> with shift $s$ instead solves
$$
(A-sI)y_{j+1}=q_j,
\qquad
q_{j+1}=\frac{y_{j+1}}{\|y_{j+1}\|}.
$$
It applies the <power method> to $(A-sI)^{-1}$ and therefore finds an <eigenvector> whose <eigenvalue> is closest to $s$.