%matplotlib inline
$x$: nonzero vector
Rayleigh quotient: $R(M,x)={x^{*}Mx \over x^{*}x}$
If $x$ is an eigenvector of $A$ then $R(M,x)$ is its eigenvalue. Otherwise, $R(M,x)$ is the closest scalar to an eigenvalue (in least squares):
Exercise 1:
Which is the value $\alpha$ that minimizes $||Ax - \alpha x||_2^2$?
hint: Compute the derivative of $||Ax - \alpha x||_2^2$ w.r.t. $\alpha$
Exercise 2:
np.random.seed
function)np.random.randn
)np.linalg.eig
)matplotlib.pyplot.hist
)
A well known method to compute eigenvalues is the power iteration method (also known as the Von Mises iteration).
This method takes $A$ a diagonalizable matrix as an input, and it outputs its greatest eigenvalue $\lambda$ (in absolute value), and its corresponding eigenvector $v$ (i.e., $Av=\lambda v$).
Power iteration($A$):
This method does not converge if:
Exercise 3 How does this method work?
Exercise 4
np.linalg.eig
np.linalg.eig
, and the current value estimated by the power iteration method.
Matrix $(A − \mu I)^{−1}$ and $A$ have the same eigenvectors, and the eigenvalues of $(A − \mu I)^{−1}$ are $(\lambda - \mu)^{-1}$
Exercise 5: Prove the previous statement.
If $\mu$ is close to the eigenvalue $\lambda_j$ then $(\lambda_j - \mu \mathbf{I})^{-1}$ is a larger eigenvalue than $(\lambda_i - \mu \mathbf{I})^{-1}, \; \forall j \neq i$.
The power iteration method applied to $(\lambda_i - \mu \mathbf{I})^{-1}$ converges quickly.
Inverse Iteration Algorithm ($A$, $\mu$):
Exercise 6:
np.linalg.eig
function.np.round
function)
Instead of using a random value $\mu$ as initial guess, we can use the Rayleigh quotient instead.
Moreover updating $\mu$ at each iteration allows a faster convergence.
These ideas give birth to the Rayleigh quotient iteration method
Rayleigh quotient iteration($A$):
Exercise 7:
np.linalg.eig
function.np.round
function)
Goal: Factorize $A$ in order to reveal the eigenvalues.
$$A = Q T Q^*$$Theorem: Every square matrix has a Schur decomposition
Method: This factorization is computed iteratively using the $QR$ factorization
Schur factorization(A):
Exercise 8:
np.linalg.eig
function