Exact two-dimensional power iteration (source code)

= Exact two-dimensional power iteration
{title2=$\tan\theta_k=3^{-k}$}

Consider the <symmetric matrix> and initial <unit vector>
$$
A=\begin{pmatrix}2&1\\1&2\end{pmatrix},\qquad x_0=\begin{pmatrix}1\\0\end{pmatrix}.
$$
Its <orthonormal eigenbasis> consists of $u_1=(1,1)^T/\sqrt2$ and $u_2=(1,-1)^T/\sqrt2$, with <eigenvalues> $3$ and $1$. Since $x_0=(u_1+u_2)/\sqrt2$, direct multiplication gives
$$
A^kx_0=\frac12\begin{pmatrix}3^k+1\\3^k-1\end{pmatrix},\qquad x_k=\frac{u_1+3^{-k}u_2}{\sqrt{1+3^{-2k}}}.
$$
The first unnormalized <vectors> are $(1,0)^T$, $(2,1)^T$, $(5,4)^T$, and $(14,13)^T$. If $\theta_k$ is the acute <angle> from the line spanned by the dominant <eigenvector>, then $\tan\theta_k=3^{-k}$. Every application divides the unwanted-to-wanted component ratio by three: normalization changes lengths, while the <spectral gap> selects the direction.

\Image[/power-iteration-symmetric-direction-error.png]
{title=Exact <power iteration> directions and errors for a <symmetric matrix> with <eigenvalues> 3 and 1}

The right panel compares the <power iteration direction error>, <Rayleigh quotient> error, and <eigenpair residual>. With $t_k=3^{-k}$, their exact values are
$$
\varepsilon_k=\frac{t_k}{\sqrt{1+t_k^2}},\qquad 3-\rho_k=\frac{2t_k^2}{1+t_k^2},\qquad \|r_k\|_2=\frac{2t_k}{1+t_k^2}.
$$
Thus a very accurate <Rayleigh quotient> can appear well before the <eigenvector> is comparably accurate. This is an example of <quadratic Rayleigh-quotient improvement for the power method>.