# QR decomposition of dense nonsingular matrices

Finding the decomposition of a matrix A of the form $A = QR$, where $Q$ is a unitary matrix and $R$ is an upper triangular matrix [1], is an important stage in solving certain more complex problems. Usually, the existence of this decomposition is proved for nonsingular matrices (see [2]), in which case all the diagonal entries of the triangular factor are nonzero. However, often, the QR decomposition is also needed in problems where the non-singularity of A is not guaranteed and $R$ may have some zero diagonal entries. There are several classical methods for finding the QR decomposition. They, and their variants, yield constructive proofs of the existence of this decomposition in the general case.

## 1 Methods for finding the QR decomposition of a dense square matrix

The classical methods for the QR decomposition can be divided into two groups, namely, methods for the unitary reduction to triangular form and methods for the non-unitary transformation to a unitary matrix. The first group includes the Givens (rotations) and Householder (reflections) methods, while the second group includes the orthogonalization method. Strictly speaking, the proof of the existence theorem (see [2]) yields another method for the decomposition via the Cholesky factorization of $A^*A$ and the subsequent calculation of the unitary factor. However, this method does not work for singular matrices; consequently, it is rarely used.

### 1.1 Unitary reduction to triangular form

#### 1.1.1 Givens method

The classical Givens (rotations) method uses left multiplications by Givens (rotation) matrices for transforming A into the upper triangular matrix $R$. The critical path of the graph of this method is linear with respect to the size of the problem.

#### 1.1.2 Householder method

The classical Householder (reflections) method uses left multiplications by Householder (reflection) matrices for transforming A into the upper triangular matrix $R$. The critical path of the graph for the stable classical variant is quadratic with respect to the size of the problem, while the use of doubling reduces its size to $O (n log_{2} n)$. Nevertheless, in program libraries, this method is more popular than Givens' method. The reason is that the former is better suited for using the basic subroutines of the BLAS library.

### 1.2 Other methods

#### 1.2.1 Orthogonalization method

The orthogonalization method implements the orthogonalization process for the columns of A. That is, by using upper triangular elementary matrices, A is transformed into a unitary matrix $Q$. The classical process is unstable, while the reorthogonalization slows down the process.

#### 1.2.2 Triangular decomposition of a Gram matrix

This method is practically not used and works only if the non-singularity of the original matrix $A$ is guaranteed. The method consists of three parts: 1. Construction of the Gram matrix $A^*A$ for the columns of the original matrix. 2. Finding the Cholesky decomposition $R^*R$ of the Gram matrix $A^*A$. 3. Calculation of the unitary matrix $Q=AR^{-1}$ by using, for instance, the modified back substitution.

## 2 References

1. Voevodin V.V., Kuznetsov Yu.A. Matrices and computations, Moscow: Nauka, 1984.
2. Voevodin V.V. Computational foundations of linear algebra Moscow: Nauka, 1977.