What is QR decomposition?

QR decomposition is a method in linear algebra that helps us understand matrix factorizationDecomposing a matrix into a product of two or more matrices., optimize calculations on matrices and enhance our understanding of complex systems of linear equations. In this method, we resolve a matrix into the product of two matrices: Q and R.

  • Q is the matrix form of orthonormal vectorsOrthonormal vectors are defined as a combination of orthogonal and normalized vectors. Orthogonal vectors are perpendicular to each other, and their dot product equals zero and a normalized vector is a unit vector form of a vector formed from the original matrix.

  • R is the product of the transpose of Q and the original matrix.

Note: The matrix R is always an upper triangular matrix.

Suppose we have a matrix M. After QR decomposition, we can represent it as:

Steps of QR decomposition

Before learning how to perform the QR decomposition, we must know the Gram-Schmidt process.

Note: To learn about the Gram-Schmidt process, we can refer to this Answer.

There are two major steps involved in the process of QR decomposition:

  1. Calculating the Q matrix

  2. Calculating the R matrix

1. Calculating the Q matrix

To calculate the Q matrix, we perform the following steps:

  • We extract column vectors from our original matrix.

  • We find the orthonormal vectors of these vectors using the Gram-Schmidt process.

  • We combine the orthonormal vectors to form the matrix Q, where each vector forms a column of the Q matrix.

2. Calculating the R matrix

To calculate the R matrix, we perform the following steps sequentially:

  • We find the transpose of the Q matrix calculated

  • We multiply the transpose result with the original matrix

Example

Suppose we have a matrix M such that:

M=[1231]M = \begin{bmatrix}1 & 2 \\3 & 1\\\end{bmatrix}

Let's find its Q and R matrices using QR decomposition.

  1. Calculating the Q matrix:

  • Extracting column vectors from M

v1=(1,3)v1 = (1, 3) (First column of M)

v2=(2,1)v2 = (2, 1) (Second column of M)

  • Finding the orthonormal vectors of the above vectors using the Gram-Schmidt process:

Calculating orthogonal vectors first:

Calculating orthonormal vectors now:

  • Combining the orthonormal vectors to form the matrix Q:

  1. Calculating the R matrix:

  • Finding the transpose of the Q matrix calculated:

  • We multiply the transpose result with the matrix M:

We can verify our QR decomposition as the product of Q and R should be equal to M:

Conclusion

QR decomposition is a valuable tool in linear algebra to effectively resolve our square matrix into two matrices: Q and R. It finds its application in various areas of mathematics to simplify matrix calculations and help us understand matrix factorization.

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved