Linear Algebra and the C Language/a0nf


Theory: Eigenvalues ​​for programmers

In Mathematics

Let A be a matrix.
Let T be a transformation that maps every vector v to the vector Av.

            T(v) = Av 
            
This transformation can perform rotations, translations, expansions, etc., on the vectors v.

A particular transformation is one that only modifies the length of the vector and  lets its direction unchanged (or reversed).

            T(v) = Av 
            T(v) = λv 
            
In this particular case, we say that λ is an eigenvalue, and v is an eigenvector of this transformation.

We have :
             T(v) = Av 
             T(v) = λv    
            
Then :
              Av = λv
               0 = λv - Av           Transfer Av
               0 = λ Id v - Av       Introduce the identity matrix                     
               0 = (λ Id - A) v      Factor v
               0 =       B    v      Introduce B = (λ Id - A)   
               
               0 =       B    v      If B is Invertible ....... PROBLEM               
          invB 0 =    invB B  v      Simplify
               0 =        id  v               
               0 =            v      This stops the algorithm  (v=0)         
              
               0 =       B    v      If B is not invertible ... SOLUTION
          det(B) = 0                 The determinant of B = 0
   det(λ Id - A) = 0                 That gives
   
   In mathematics, this allows us to obtain the characteristic polynomial.
   
   
                     det(λ Id - A) = 0          det(A - λ Id) = 0 
                    
   
                    | λ-a   -b |               | a-λ  b   |
                    |          | = 0           |          | = 0
                    |  -c  λ-d |               | c    d-λ |  
                    
 Expanding the determinant will give us a polynomial which will allow us to calculate the eigenvalues ​​of A.

In programming

We will use an iterative algorithm, which utilizes QR decomposition, to calculate the eigenvalues ​​of A.