QR Decomposition of Matrix \(A\) invloves Factoring Matrix \(A\) into 2 Matrices as follows
\(A=QR\) ...(2)
where
\(Q\) is an Orthogonal Matrix having \(M\) Rows and \(K\) Columns (where \(1 \leq K \leq N\) ).
\(R\) is Right Triangular Matrix containing \(K\) Rows and \(N\) Columns.
For any \(M \times N\) Matrix \(A\) (as given above) containing \(N\) Vectors \(V_1, V_2, ..., V_n\) as Columns, the corresponding Orthogonal Matrix \(Q\) containing Mutually Orthonormal \(K\) Vectors \(M_1, M_2, ..., M_k\) (where \(1 \leq K \leq N\) ) can be found using Gram-Schmidt Process as follows
Add the First Vector/Column \(V_1\) of Matrix \(A\) as the First Vector/Column \(M_1\) of Matrix \(Q\).
Calculate the Orthogonal Rejection OF Vector \(V_2\) of Matrix \(A\) FROM Vector Sub-space formed by Matrix \(Q\). If the Orthogonal Rejection thus obtained is a Non-Null Vector, add it to the Matrix \(Q\) as its next Vector/Column \(M_2\).
Calculate the Orthogonal Rejection OF all subsequent Vectors \(V_n\) of Matrix \(A\) FROM Vector Sub-space formed by then Current Matrix \(Q\). If the Orthogonal Rejection thus obtained is a Non-Null Vector, add it to the Matrix \(Q\) as its next Vector/Column \(M_k\).
Once all the Orthogonal Non-Null Rejection Vectors have been added to Matrix \(Q\), convert all the Vectors/Columns in Matrix \(Q\) to Unit Vectors, thus converting the Matrix \(Q\) to Orthogonal Matrix.
Once the Orthogonal Matrix \(Q\) corresponding to Matrix \(A\) is found using the Gram-Schmidt Process, the \(R\) Matrix is calculated as follows
\(A=QR\) ...(From equation 2)
Pre-Multiplying Both Sides of equation (2) with \(Q^T\) we get
The following gives the Calculations for Finding Orthogonal Vectors/Columns \(M_1, M_2, ..., M_n\) using Gram-Schmidt Process
Let \(P_1\) be the Projection Matrix Corresponding to Vector \(V_1\) (or Vector \(M_1\)). Therefore the Rejection Matrix \(R_1\) Corresponding to Vector \(V_1\) is given as
\(R_1=I-P_1\)
Now, Rejection OF Vector \(V_2\) (i.e. Vector \(M_2\)) FROM Vector \(V_1\) (or Vector \(M_1\)) is given as
Now, Let \(P_2\) be the Projection Matrix Corresponding to Vector \(M_2\). Since \(M_1\) and \(M_2\) are Mutually Orthogonal Vectors, therefore the Projection Matrix \(P_{12}\) Corresponding to the
Vector Space formed by Vectors \(M_1\) and \(M_2\) is Sum of Projection Matrices \(P_1\) and \(P_2\). That is
\(P_{12}=P_1 + P_2\)
Hence, the Rejection Matrix \(R_{12}\) Corresponding to the Vector Space formed by Vectors \(M_1\) and \(M_2\) is given as
\(R_{12}=I-P_{12}=I-P_1 - P_2\)
Therefore Rejection OF Vector \(V_3\) (i.e. Vector \(M_3\)) FROM the Vector Space formed by Vectors \(M_1\) and \(M_2\) is given as
Now, Let \(P_3\) be the Projection Matrix Corresponding to Vector \(M_3\). Since \(M_1\), \(M_2\) and \(M_3\) are Mutually Orthogonal Vectors, therefore the Projection Matrix \(P_{123}\) Corresponding to the
Vector Space formed by Vectors \(M_1\), \(M_2\) and \(M_3\) is Sum of Projection Matrices \(P_1\), \(P_2\) and \(P_3\). That is
\(P_{123}=P_1 + P_2 + P_3\)
Hence, the Rejection Matrix \(R_{123}\) Corresponding to the Vector Space formed by Vectors \(M_1\), \(M_2\) and \(M_3\) is given as
\(R_{123}=I-P_{123}=I-P_1 - P_2 - P_3\)
Therefore Rejection OF Vector \(V_4\) (i.e. Vector \(M_4\)) FROM the Vector Space formed by Vectors \(M_1\), \(M_2\) and \(M_3\) is given as
Likewise, Let \(P_{n-1}\) be the Projection Matrix Corresponding to Vector \(M_{n-1}\). Since \(M_1\), \(M_2\), \(M_3\), ... and \(M_{n-1}\) are Mutually Orthogonal Vectors, therefore the Projection Matrix \(P_{123...(n-1)}\) Corresponding to the
Vector Space formed by Vectors \(M_1\), \(M_2\), \(M_3\), ... and \(M_{n-1}\) is Sum of Projection Matrices \(P_1\), \(P_2\), \(P_3\), ... and \(P_{n-1}\). That is
Hence, the Rejection Matrix \(R_{123...(n-1)}\) Corresponding to the Vector Space formed by Vectors \(M_1\), \(M_2\), \(M_3\), ... and \(M_{n-1}\) is given as
Therefore Rejection OF Vector \(V_k\) (i.e. Vector \(M_k\)) FROM the Vector Space formed by Vectors \(M_1\), \(M_2\), \(M_3\), ... and \(M_{k-1}\) is given as
Please note that out of all the Vectors \(M_1, M_2,..., M_n\) that are obtained using above calculations, Only the Non-Null Vectors become a part of the Matrix \(Q\).
Subsequently, all the Vectors/Columns in Matrix \(Q\) are converted to Unit Vectors, thus converting the Matrix \(Q\) to Orthogonal Matrix.