Skip to main content

Subsection 9.4.1 How to compute the eigenvalues of a \(2 \times 2 \) matrix

We have noted that finding the eigenvalues of a \(2 \times 2\) matrix requires the solution to the characteristic polynomial. In particular, if a \(2 \times 2 \) matrix \(A \) is real-valued and

\begin{equation*} A = \left( \begin{array}{c c} \alpha_{00} \amp \alpha_{01} \\ \alpha_{10} \amp \alpha_{11} \end{array} \right) \end{equation*}

then

\begin{equation*} \det( \lambda I - A ) = (\lambda - \alpha_{00}) ( \lambda - \alpha_{11} ) - \alpha_{10} \alpha_{01} = \lambda^2 \begin{array}[t]{c} \underbrace{ - ( \alpha_{00} + \alpha_{11} ) } \\ \beta \end{array} \lambda + \begin{array}[t]{c} \underbrace{ ( \alpha_{00} \alpha_{11} - \alpha_{10} \alpha_{10} ) } \\ \gamma \end{array} . \end{equation*}

It is then tempting to use the quadratic formula to find the roots: \[ \lambda_0 = \frac{-\beta + \sqrt{ \beta^2 - 4 \gamma } }{2} \] and \[ \lambda_0 = \frac{-\beta - \sqrt{ \beta^2 - 4 \gamma } }{2}. \] However, as discussed in Section C.2, one of these formulae may cause catastrophic cancellation, if \(\gamma \) is small. When is \(\gamma \) small? When \(\alpha_{00} \alpha_{11} - \alpha_{10} \alpha_{10}\) is small. In other words, when the determinant of \(A\) is small or, equivalently, when \(A \) has a small eigenvalue.

In the next week, we will discuss the QR algorithm for computing the Spectral Decomposition of a Hermitian matrix. We do not discuss the QR algorithm for computing the Schur Decomposition of a \(m \times m \) non-Hermitian matrix, which uses the eigenvalues of

\begin{equation*} \left( \begin{array}{c c} \alpha_{m-2,m-2} \amp \alpha_{m-2,m-1} \\ \alpha_{m-1,m-1} \amp \alpha_{m-1,m-1} \end{array} \right) \end{equation*}

to "shift" the matrix. (What this means will become clear next week.) This happened to come up in Robert's dissertation work. Making the "rookie mistake" of not avoiding catastrophic cancellation when computing the roots of a quadratic polynomial cost him three weeks of his life (debugging his code), since the algorithm that resulted did not converge correctly... Don't repeat his mistakes!