Loading [MathJax]/jax/output/HTML-CSS/jax.js
Skip to main content
Library homepage
 

Text Color

Text Size

 

Margin Size

 

Font Type

Enable Dyslexic Font
Mathematics LibreTexts

29.1: Eigenvalues and eigenvectors review

( \newcommand{\kernel}{\mathrm{null}\,}\)

Definition

A non-zero vector x in Rn is called an eigenvector of a n×n matrix A if Ax is a scalar multiple of x. If Ax=λx, then λ is called the eigenvalue of A corresponding to x.

Steps for finding the eigenvalues and eigenvectors

We want to find λ and non-zero vector x such that Ax=λx for a n×n matrix.

  1. We introduce an identity matrix I of n×n. Then the equation becomes:

Ax=λIx

AxλIx=0

(AλI)x=0

  1. This suggests that we want to find λ such that (AλI)x=0 has a non-trivial solution. It is equivalent to that the matrix AλI is singular, i.e., has a determinant of 0. |AλI|=0
  2. The determinant is polynomial in λ (called the characteristic polynomial of A) with degree n. We solve this equation (called the characteristic equation) for all possible λ (eigenvalues).
  3. After finding the eigenvalues, we substitute them back into (AλI)x=0 and find the eigenvectors x.

Let’s calculate eigenvalues for the following matrix:

A=[002121103]

Find eigenvalues

Looking at the above recipe, let’s solve the problem symbollically using sympy. First lets create a matrix B such that:

B=AλI

Login with LibreOne to run this code cell interactively.

If you have already signed in, please refresh the page.

%matplotlib inline
import matplotlib.pylab as plt
import numpy as np
import sympy as sym
sym.init_printing()
%matplotlib inline
import matplotlib.pylab as plt
import numpy as np
import sympy as sym
sym.init_printing()

Login with LibreOne to run this code cell interactively.

If you have already signed in, please refresh the page.

#Most sympy requires defeing the variables as "symbols"
#Once we do this we can use the variables in place of numbers
lam = sym.symbols('lambda')

A = sym.Matrix([[0, 0 ,-2], [1, 2, 1], [1, 0, 3]])
I = sym.eye(3)

B = A - lam*I

B
#Most sympy requires defeing the variables as "symbols"
#Once we do this we can use the variables in place of numbers
lam = sym.symbols('lambda')

A = sym.Matrix([[0, 0 ,-2], [1, 2, 1], [1, 0, 3]])
I = sym.eye(3)

B = A - lam*I

B

Now, per step 2, the determinate of B must be zero. Note that sympy calculates the determinate symbollically as follows:

Login with LibreOne to run this code cell interactively.

If you have already signed in, please refresh the page.

B.det()
B.det()
Do This

Using the sympy.solve function on the determinate of B to solve for lam (λ). Verify that the solution to the last question produces the same eigenvalues as above.

Login with LibreOne to run this code cell interactively.

If you have already signed in, please refresh the page.

# Put your code to solve for det(B) = 0 here
# Put your code to solve for det(B) = 0 here
Do This

First, let’s use the built in funciton eigenvals function in sympy to calculate the eigenvalues. Find out the meaning of the output.

Login with LibreOne to run this code cell interactively.

If you have already signed in, please refresh the page.

# Put your code here
# Put your code here

Find eigenvectors

Now we know the eigenvalues, we can substitue them back into the equation to find the eigenvectors.

We solve this symbollically using sympy. First let’s make a vector of our eigenvalues (from above):

Login with LibreOne to run this code cell interactively.

If you have already signed in, please refresh the page.

eig = [1,2]
eig = [1,2]

Now (per step 4 above) we need to solve the equation (AλI)x=0. One way to do this in sympy is as follows:

Login with LibreOne to run this code cell interactively.

If you have already signed in, please refresh the page.

x1,x2,x3 = sym.symbols(['x_1','x_2','x_3'])

x = sym.Matrix([[x1],[x2],[x3]])
x
x1,x2,x3 = sym.symbols(['x_1','x_2','x_3'])

x = sym.Matrix([[x1],[x2],[x3]])
x

Login with LibreOne to run this code cell interactively.

If you have already signed in, please refresh the page.

for lam in eig:
    vec = sym.solve((A - lam*I)*x,x)
    print(vec)
for lam in eig:
    vec = sym.solve((A - lam*I)*x,x)
    print(vec)
{x_1: -2*x_3, x_2: x_3}
{x_1: -x_3}
Question

Explain your output here. (Hint, you can also try the rref to find the solutions)

Do This

Next, let’s use the eigenvects function in sympy to find three linear independent eigenvectors for the matrix A?

Login with LibreOne to run this code cell interactively.

If you have already signed in, please refresh the page.

# Put your answer to the above question here
# Put your answer to the above question here
Question

Compare this answer to the eigenvectors we calculated above. Does this answer make sense? What does the syntax tell us?

Do This

Find the eigenvalues and eigenvectors of the following matrix:

A2=[2102]

Question

What are the eigenvalues for the matrix A2?

Question

What are the eigenvectors for the matrix A2?


This page titled 29.1: Eigenvalues and eigenvectors review is shared under a CC BY-NC 4.0 license and was authored, remixed, and/or curated by Dirk Colbry via source content that was edited to the style and standards of the LibreTexts platform.

Support Center

How can we help?