The method for symbolic computation of eigenvectors and eigenvalues involves first finding the eigenvalues from the characteristic polynomial:
det(M - λ I) = 0
where, in this case for two dimensional matrix M =
which gives the characteristic equation:
(m00 - λ)(m11 - λ) - m01 m10 = 0
expanding out gives:
λ² - (m00 + m11)λ + (m00 m11 - m01 m10) = 0
where:
- (m00 + m11) = trace
- (m00 m11 - m01 m10) = determinant
solving the quadratic equation gives:
λ = (m00 + m11)/2 ± (√(4*m01*m10 + (m00 - m11)²))/2
We can then substitute these into
which is equivalent to solving 2 simultaneous equations.
Special Cases
If the matrix is symmetrical around the leading diagonal:
m01=m10
then:
λ = (m00 + m11)/2 ± (√(2*m01)² + (m00 - m11)²))/2
Code
Here is a Java function to return the eigenvalues:
/**
code to return eigenvalues of a 2x2 matrix
result we be returned in resultReal[0],resultImaginary[0],resultReal[1] and resultImaginary[1]
expects arrays to be setup before being called, like this:
double[] resultReal= new double[2];
double[] resultImaginary = new double[2];
*/
public void eigenValue(double[][] m, double[] resultReal , double[] resultImaginary) {
quadratic(1.0,m[0][0] + m[1][1],m[0][0]*m[1][1] - m[0][1]*m[1][0],resultReal,resultImaginary);
// the quadratic function is defined on this page:
// https://www.euclideanspace.com/maths/algebra/equations/polynomial/quadratic/
return;
}
Example - 2D Rotation Matrix
A 2D rotation matrix can be written:
cos(θ) |
-sin(θ) |
sin(θ) |
cos(θ) |
As descrtibed on this page.
So we can work out the eigen values as follows:
λ = (m00 + m11)/2 ± (√(4*m01*m10 + (m00 - m11)²))/2
λ = (cos(θ) + cos(θ))/2 ± (√(-4*sin(θ)*sin(θ) + (cos(θ) - cos(θ))²))/2
λ = cos(θ) ± (√(-4*sin(θ)*sin(θ)))/2
λ = cos(θ) ± i sin(θ) = e±iθ
substitute these into [M] {v} = λ {v}
cos(θ) - λ |
-sin(θ) |
sin(θ) |
cos(θ) - λ |
|
|
= |
|
let λ = cos(θ) + i sin(θ) gives:
- i sin(θ) |
-sin(θ) |
sin(θ) |
- i sin(θ) |
|
|
= |
|
so,
Program
There are a number of open source programs that can calculate eigenvalues and eigenvectors. I have used Axiom, how to install Axiom here.
To get a numeric solution for a given matrix, we can use eigenvalues(m)
and eigenvectors(m) as shown here:
I have put user input in red:
(1) -> m := matrix[[1,4],[2,5]]
+1 4+ (1) | | +2 5+ Type: Matrix Integer (2) -> ev := eigenvalues(m)
2 (2) [%A | %A - 6%A - 3] Type: List Union(Fraction Polynomial Integer,SuchThat(Symbol,
Polynomial Integer))
(3) -> eigenvectors(m)
+%B - 5+ 2 |------| (3) [[eigval= (%B | %B - 6%B - 3),eigmult= 1,eigvec= [| 2 |]]] | | + 1 +
Type: List Record(eigval: Union(Fraction Polynomial Integer,SuchThat(Symbol,
Polynomial Integer)),eigmult: NonNegativeInteger,eigvec: List Matrix
Fraction Polynomial Integer) (4) ->
|
Or we can find a general formula for a given matrix as shown here:
(1) -> msymb := matrix[[a,b],[c,d]]
+a b+ (1) | | +c d+
Type: Matrix Polynomial Integer (2) ->
(2) -> evsymb := eigenvalues(msymb)
2 (2) [%A | (a - %A)d - b c - %A a + %A ] Type: List Union(Fraction Polynomial Integer,
SuchThat(Symbol,Polynomial Integer))
(3) -> eigenvectors(msymb)
(3) [ 2 [eigval= (%B | (a - %B)d - b c - %B a + %B ), eigmult= 1, +- d + %B+ |--------| eigvec= [| c |]] | | + 1 + ] Type: List Record(eigval: Union(Fraction Polynomial Integer,
SuchThat(Symbol,Polynomial Integer)),eigmult:
NonNegativeInteger,eigvec: List Matrix Fraction Polynomial Integer) (4) ->
|
This site may have errors. Don't use for critical systems.