This repository consists of the implementation of 2 projects of Linear Algebra:
- Design a program to find the projection matrix P onto the space spanned by 2 vectors.
- Design a program to check which of the matrices cannot be diagonalised.
To find the projection matrix P onto the space spanned by 2 vectors:
- Give 2 input vectors whose projection matrix has to be found.
- Find the transpose of those matrices.
- Then find the dot product of obtained transpose with the matrices.
- Similarly repeat these steps to obtain projection matrix P given by P = A * (A * AT) AT
To check which of the matrices cannot be diagonalised:
- Let A be the n×n matrix that you want to diagonalize.
- Find the characteristic polynomial p(t) of A.
- Find eigenvalues λ of the matrix A and their algebraic multiplicities from the characteristic polynomial p(t).
- For each eigenvalue λ of A, find a basis of the eigenspace Eλ. If there is an eigenvalue λ such that the geometric multiplicity of λ, dim(Eλ), is less than the algebraic multiplicity of λ, then the matrix A is not diagonalizable. If not, A is diagonalizable, and proceed to the next step.
- If we combine all basis vectors for all eigenspaces, we obtained n linearly independent eigenvectors v1v2...vn.
- Define the nonsingular matrix S = [v1v2...vn].
- Define the diagonal matrix D, whose (i,i)-entry is the eigenvalue λ such that the i-th column vector vi is in the eigenspace Eλ.
- Then the matrix A is diagonalized as S−1AS = D.