The algorithm for the inverse power iteration works as following : \begin{align} &v^{(0)} =\text{ some vector with }\|v^{(0)}\|=1\\ &\text{for }k = 1, 2, \ldots\\ &\qquad\text{Solve } (A - \mu I)w = v^{(k-1)}\text{ for }w\\ &\qquad v^{(k)}= w/\|w\|\\ &\qquad \lambda^{(k)} = (v^{(k)})^TAv^{(k)}\\ \end{align}
However, If we use the exact (or a very close) eigenvalue $\mu$ of the matrix $A$, wouldn't solving $(A - \mu I)w = v^{(k-1)}$ be impossible/ill-conditioned? How is this handled?
edit : for example $\begin{bmatrix}2 & 1\\1 & 2\end{bmatrix}$ has eigenvalues $1$ and $3$ but if we have as input $\mu=1$ or $\mu=3$ to the algorithm it would not work (julia script).
using LinearAlgebra
function invIter(A, n, mu)
v = [1;0]
lambda = 0
for k = 1:n
w = (A-mu*I)\v
v = w/norm(w)
lambda = v'*A*v
end
return lambda, v
end
A = [2 1;1 2]
lambda, v = invIter(A, 100, 1)
println("lambda, v are : ", lambda, v)