374 Using Mathematica to Find Eigenvalues and Eigenvectors
374 Using Mathematica to Find Eigenvalues and Eigenvectors
Define matrix A = .
4 | 5 |
-4 | -4 |
A={{4,5},{-4,-4}}
{{4,5},{-4,-4}}
Make A look like a matrix (I do this to check I put in the matrix correctly!)
MatrixForm[A]
4 | 5 |
-4 | -4 |
CharPoly[m_]:=Det[A-m*IdentityMatrix[2]]
CharPoly[m]
4+
2
m
Find eigenvalues by solving the characteristic equation |A-mI|=0.
Solve[CharPoly[m]0,m]
{{m-2},{m2}}
Eigenvalues of A are m = ± 2. Now find an eigenvector for eigenvalue m=2.
CharEqn[m_,c1_,c2_]:=(A-m*IdentityMatrix[2]).{c1,c2}{0,0}
CharEqn[2,c1,c2]
{(4-2)c1+5c2,-4c1-(4+2)c2}{0,0}
Solve[CharEqn[2,c1,c2],{c2,c1}]
c1-1-c2
2
Thus, if c2 = 2, we get the eigenvector .
=
=
+
-2- |
2 |
-2- |
2+0 |
-2 |
2 |
-1 |
0 |
You can also find eigenvalues and eigenvectors directly using the following commands:
Eigenvalues[A]
{2,-2}
Eigenvectors[A]
{{-2-,2},{-2+,2}}
MatrixForm[{-2-,2}]
-2- |
2 |
MatrixForm[{-2+,2}]
-2+ |
2 |
