Eigenvalues & Eigenvectors (SymPy)
Definition
Let \(A\) be an \(n\times n\) matrix (i.e. a square matrix). A non-zero vector \(\vec{v}\) is an eigenvector of \(A\) with eigenvalue \(\lambda\) if
Rewriting this equation, we see that \(\vec{v}\) is a solution of the homogeneous system of equations
where \(I\) is the identity matrix of size \(n\). Non-trivial solutions exists only when the matrix \(A-\lambda I\) is noninvertible (singular). That is, when \(\operatorname{det}(A-\lambda I) =0\). Therefore, the eigenvalues are the roots of the characteristic polynomial
Here are three examples that we will consider. In each case, we have pre-computed the eigenvalues and eigenvectors (check them yourself).
Notice, for matrix \(D\) there is one eigenvalue that has two associated eigenvectors.
Warning
Eigenvectors are not unique, any scalar multiple of an eigenvector is an eigenvector. Therefore, some caution is needed when having software compute eigenvectors, they may not be exactly the ones you computed by hand.
.eigenvals
To find the eigenvalues of a matrix, use the .eigenvals
method. eigenvals
returns a dictionary of eigenvalue
: algebraic_multiplicity
pairs.
.eigenvects
To find the eigenvectors of a matrix, use the .eigenvects
method. eigenvects
returns a list of tuples of the form (eigenvalue, algebraic_multiplicity, [eigenvectors])
.
Example
Determine the eigenvalues and eigenvectors of
The eigenvalues are \(1\) and \(4\).
\(\left[ \left( 1,1,\left[ \left[\begin{matrix} -2 \\ 1 \end{matrix}\right] \right] \right), \left( 4,1,\left[ \left[\begin{matrix} 1 \\ 1 \end{matrix}\right] \right] \right) \right]\)and the corresponding eigenvectors are \(\begin{bmatrix}-2 \\ 1 \end{bmatrix}\) and \(\begin{bmatrix} 1 \\ 1\end{bmatrix}\).
We can check this for ourself.
Example
Determine the eigenvalues and eigenvectors of
\(\left[ \left( -3,1,\left[ \left[\begin{matrix} 3/4 \\ 1 \end{matrix}\right] \right] \right), \left( 2,1,\left[ \left[\begin{matrix} 1 \\ 1 \end{matrix}\right] \right] \right) \right]\)
Example
Determine the eigenvalues and eigenvectors of
\(\left[ \left( -3,1,\left[ \left[\begin{matrix} 1 \\ 1 \\ 1 \end{matrix}\right] \right] \right), \left( 2,1,\left[ \left[\begin{matrix} 1 \\ 1 \\ 0 \end{matrix}\right] \right] \right), \left( 4,1,\left[ \left[\begin{matrix} 0 \\ 1 \\ 1 \end{matrix}\right] \right] \right) \right]\)
Example
Determine the eigenvalues and eigenvectors of
\(\left[ \left( -3,1,\left[ \left[\begin{matrix} 1 \\ -1 \\ 1 \end{matrix}\right] \right] \right), \left( 3,2,\left[ \left[\begin{matrix} 1 \\ 1 \\ 0 \end{matrix}\right], \left[\begin{matrix} -1 \\ 0 \\ 1 \end{matrix}\right] \right] \right) \right]\)
The eigenvalue \(3\) has algebraic multiplicity \(2\), and since there are two corresponding linearly independent eigenvectors it also has geometric multiplicity \(2\).