This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

Documentation / Mathematica / The Mathematica Book / Advanced Mathematics in Mathematica / Linear Algebra /

3.7.9 Eigenvalues and Eigenvectors

Eigenvalues and eigenvectors.

The eigenvalues of a matrix are the values for which one can find non-zero vectors such that . The eigenvectors are the vectors .

The characteristic polynomial CharacteristicPolynomial[m, x] for an matrix is given by Det[m - x IdentityMatrix[n]]. The eigenvalues are the roots of this polynomial.

Finding the eigenvalues of an matrix in general involves solving an -degree polynomial equation. For , therefore, the results cannot in general be expressed purely in terms of explicit radicals. Root objects can nevertheless always be used, although except for fairly sparse or otherwise simple matrices the expressions obtained are often unmanageably complex.

Even for a matrix as simple as this, the explicit form of the eigenvalues is quite complicated.

In[1]:= Eigenvalues[ {{a, b}, {-b, 2a}} ]


If you give a matrix of approximate real numbers, Mathematica will find the approximate numerical eigenvalues and eigenvectors.

Here is a numerical matrix.

In[2]:= m = {{2.3, 4.5}, {6.7, -1.2}}


The matrix has two eigenvalues, in this case both real.

In[3]:= Eigenvalues[ m ]


Here are the two eigenvectors of m.

In[4]:= Eigenvectors[ m ]


Eigensystem computes the eigenvalues and eigenvectors at the same time. The assignment sets vals to the list of eigenvalues, and vecs to the list of eigenvectors.

In[5]:= {vals, vecs} = Eigensystem[m]


This verifies that the first eigenvalue and eigenvector satisfy the appropriate condition.

In[6]:= m . vecs[[1]] == vals[[1]] vecs[[1]]


This finds the eigenvalues of a random matrix. For non-symmetric matrices, the eigenvalues can have imaginary parts.

In[7]:= Eigenvalues[ Table[Random[ ], {4}, {4}] ]


The function Eigenvalues always gives you a list of eigenvalues for an matrix. The eigenvalues correspond to the roots of the characteristic polynomial for the matrix, and may not necessarily be distinct. Eigenvectors, on the other hand, gives a list of eigenvectors which are guaranteed to be independent. If the number of such eigenvectors is less than , then Eigenvectors appends zero vectors to the list it returns, so that the total length of the list is always .

Here is a matrix.

In[8]:= mz = {{0, 1, 0}, {0, 0, 1}, {0, 0, 0}}


The matrix has three eigenvalues, all equal to zero.

In[9]:= Eigenvalues[mz]


There is, however, only one independent eigenvector for the matrix. Eigenvectors appends two zero vectors to give a total of three vectors in this case.

In[10]:= Eigenvectors[mz]


Finding largest and smallest eigenvalues.

Eigenvalues sorts numeric eigenvalues so that the ones with large absolute value come first. In many situations, you may be interested only in the largest or smallest eigenvalues of a matrix. You can get these efficiently using Eigenvalues[m, k] and Eigenvalues[m, -k].

This computes the exact eigenvalues of an integer matrix.

In[11]:= Eigenvalues[{{1, 2}, {3, 4}}]


The eigenvalues are sorted in decreasing order of size.

In[12]:= N[%]


This gives the three eigenvalues with largest absolute value.

In[13]:= Eigenvalues[Table[N[Tan[i/j]], {i, 10}, {j, 10}], 3]


Generalized eigenvalues and eigenvectors.

The generalized eigenvalues for a matrix with respect to a matrix are defined to be those for which .

The generalized eigenvalues correspond to zeros of the generalized characteristic polynomial Det[m - x a].

Note that while ordinary matrix eigenvalues always have definite values, some generalized eigenvalues will always be Indeterminate if the generalized characteristic polynomial vanishes, which happens if and share a null space. Note also that generalized eigenvalues can be infinite.

These two matrices share a one-dimensional null space, so one generalized eigenvalue is Indeterminate.

In[14]:= Eigenvalues[{{{1.5, 0}, {0, 0}}, {{2, 0}, {1, 0}}}]