Linear Algebra and the C Language/a0ng


Theory: Eigenvectors ​​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   
          
We obtained the eigenvalues ​​by calculating the determinant:

                                det(A - λ Id) = 0 
 
Consider the system:

                (A - λ Id)   v  = 0
                
                a-λ  + b   | v1 | 0 
                c    + d-λ | v2 | 0
                
If all the eigenvalues ​​are distinct, solving this system will yield a zero row.
                
This row will allow us to introduce a free variable. Solving the system with this free variable will give us a free vector. This normalized free vector will become the eigenvector of the eigenvalue λ.
                
If some of the eigenvalues ​​are identical, solving this system will give us several zero rows.
                
These rows will allow us to introduce several free variables. Solving the system with free variables will give us free vectors. These normalized free vectors will become the eigenvectors of identical eigenvalues ​​λ.
                

In programming

We will use the same algorithm as in mathematics for symmetric real matrices: eigs_V_mR(); when the eigenvalues ​​are distinct
              
The function GJ_PP_FreeV_mR(); displays the null row, introduces the free variable, solves the system, and returns a free vector. (An eigenvector)
              
For real symmetric matrices with  eigenvalues with multiple multiplicity , the multiplicity of each eigenvalue must be manually indicated before calculating the eigenvectors.