Linear Algebra – How to Calculate Eigenvectors and Eigenvalues of a 3×3 Matrix

eigenvalues-eigenvectorslinear algebramatrices

I am dealing with a task in which I have to calculate the eigenvectors and eigenvalues of the following matrix:
$$\begin{pmatrix}
5& 6 &1\\
1 &3& 1\\
2 &1 &2\end{pmatrix}$$

So I have computed the characteristic equation, which turns out to be this three-degree polynomial:

$$-λ^3+10\lambda^2 -22\lambda +20$$

This cannot be factored by Ruffini, which leaves me stuck as to finding the roots I need. Have I done something wrong?

Thanks in advance.

Best Answer

The python code

from sympy import pprint
from sympy.printing.latex import LatexPrinter, print_latex
from sympy.matrices import  Matrix

A = Matrix([[5,6,1],[1,3,1],[2,1,2]])
pprint( A )
E = A.eigenvals()
print_latex( E )

produces \begin{align} \lambda_1&=\frac{10}{3} + \left(- \frac{1}{2} - \frac{\sqrt{3} i}{2}\right) \sqrt[3]{\frac{2 \sqrt{1086}}{9} + \frac{280}{27}} + \frac{34}{9 \left(- \frac{1}{2} - \frac{\sqrt{3} i}{2}\right) \sqrt[3]{\frac{2 \sqrt{1086}}{9} + \frac{280}{27}}}\,,\\ \lambda_2&=\frac{10}{3} + \frac{34}{9 \left(- \frac{1}{2} + \frac{\sqrt{3} i}{2}\right) \sqrt[3]{\frac{2 \sqrt{1086}}{9} + \frac{280}{27}}} + \left(- \frac{1}{2} + \frac{\sqrt{3} i}{2}\right) \sqrt[3]{\frac{2 \sqrt{1086}}{9} + \frac{280}{27}}\,,\\ \lambda_3&=\frac{34}{9 \sqrt[3]{\frac{2 \sqrt{1086}}{9} + \frac{280}{27}}} + \sqrt[3]{\frac{2 \sqrt{1086}}{9} + \frac{280}{27}} + \frac{10}{3}\,. \end{align}

To wrap up some comments:

The numerical values of the eigenvectors are \begin{align} \lambda_1&\approx 1.30555781-\mathbf{i}\,1.00114303\,,\\ \lambda_2&\approx 1.30555781+\mathbf{i}\,1.00114303\,,\\ \lambda_3&\approx 7.38888438\,. \end{align} As pointed out by ancient mathematician, all three eigenvectors can be obtained from $$ \begin{pmatrix}5-\lambda\\6\\1\end{pmatrix}\times\begin{pmatrix}1\\3-\lambda\\1\end{pmatrix}=\begin{pmatrix}3+\lambda\\-4+\lambda\\\lambda^2-8\lambda+9\end{pmatrix}\,. $$ The only thing that is not immediately obvious is that the dot product of this vector with $(2,1,2-\lambda)$ (the last row of $A-\lambda I$) is zero. This dot product is however equal to the characteristic polynomial $$ - \lambda^3+ 10 \lambda^2 - 22 \lambda +20 $$ and therefore zero when $\lambda$ is one of the eigenvalues.

Another tip:

In that case, the exact expressions above for the eigenvalues produced by sympy are impressive but practically nearly useless because too complicated. If you only want the numerical values use scipy.linalg:

from numpy import array
from scipy.linalg import eig
A = array([[5,6,1],[1,3,1],[2,1,2]])
E, V = eig(A)
Related Question