logo

Matrix QR Decomposition 📂Matrix Algebra

Matrix QR Decomposition

Overview

Efficient matrix decomposition requires several conditions, but before efficiency, whether the decomposition itself is possible or not can be important. QR decomposition is a matrix decomposition method that does not require the condition of being a square matrix.

Definition

For a matrix A:=[a1an]Cnm×nA := \begin{bmatrix} \mathbf{a}_{1} & \cdots & \mathbf{a}_{n} \end{bmatrix} \in \mathbb{C}^{m \times n}_{n} with coefficients nn, let’s define the subspace generated by the column vectors up to the iith

Si(A):=sp{a1,,ai} S_{i} (A) := \text{sp} \left\{ \mathbf{a}_{1}, \cdots , \mathbf{a}_{i} \right\}

When generating a vector space, since ii can be larger, it is assumed that

S1(A)S2(A)Sn(A) S_{1} (A) \subset S_{2} (A) \subset \cdots S_{n} (A)

will hold.

Of course, for a matrix made up of orthonormal vectors

Q^:=[q1qn]Cnm×n \widehat{Q} : = \begin{bmatrix} \mathbf{q}_{1} & \cdots & \mathbf{q}_{n} \end{bmatrix} \in \mathbb{C}^{m \times n}_{n}

S1(Q^)S2(Q^)Sn(Q^)S_{1} (\widehat{Q}) \subset S_{2} (\widehat{Q}) \subset \cdots S_{n} (\widehat{Q}) also holds.

If relationships such as satisfying Si(A)=Si(Q^)S_{i} (A) = S_{i} (\widehat{Q}) can be found, since Q^\widehat{Q} will be easier to handle, matrix AA would also become easier to handle.

a1=r11q1a2=r12q1+r22q2an=r1nq1++rnnqn \begin{align*} \mathbf{a}_{1} =& r_{11} \mathbf{q}_{1} \\ \mathbf{a}_{2} =& r_{12} \mathbf{q}_{1} + r_{22} \mathbf{q}_{2} \\ &\vdots \\ \mathbf{a}_{n} =& r_{1n} \mathbf{q}_{1} + \cdots + r_{nn} \mathbf{q}_{n} \end{align*}

The relationship we want to find will appear in forms like above, and the multiplication of matrices is organized as below.

A=[a1an]=[q1qn][r11r12r1n0r22r2n00rnn]:=Q^R^ A = \begin{bmatrix} \mathbf{a}_{1} & \cdots & \mathbf{a}_{n} \end{bmatrix} = \begin{bmatrix} \mathbf{q}_{1} & \cdots & \mathbf{q}_{n} \end{bmatrix} \begin{bmatrix} r_{11} & r_{12} & \cdots & r_{1n} \\ 0 & r_{22} & \cdots & r_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & r_{nn} \end{bmatrix} := \widehat{Q} \widehat{R}

And finding

Q^:=[q1qn]R^:=[r11r12r1n0r22r2n00rnn] \widehat{Q} : = \begin{bmatrix} \mathbf{q}_{1} & \cdots & \mathbf{q}_{n} \end{bmatrix} \\ \widehat{R} := \begin{bmatrix} r_{11} & r_{12} & \cdots & r_{1n} \\ 0 & r_{22} & \cdots & r_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & r_{nn} \end{bmatrix} that satisfies such a multiplication of matrices is exactly what QR decomposition is.

Algorithm

Let’s say [a1an]Cnm×n\begin{bmatrix} \mathbf{a}_{1} & \cdots & \mathbf{a}_{n} \end{bmatrix} \in \mathbb{C}^{m \times n}_{n}.

**Step 1. j=1j=1

Calculate r11r_{11} that satisfies a1=r11q1\mathbf{a}_{1} = r_{11} \mathbf{q}_{1} and q1=1| \mathbf{q}_{1} | = 1.


**Step 2. j=2,3,,nj= 2, 3, \cdots , n

  • Step 2-1. Calculate rij=qiajr_{ij} = \mathbf{q}_{i}^{\ast}\mathbf{a}_{j} for i=1,2,,j1i = 1,2, \cdots , j-1.
  • Step 2-2. Calculate the temporary vector as follows: vj=aji=1j1rijqi=aji=1j1(qiaj)qi \mathbf{v}_{j} = \mathbf{a}_{j} - \sum_{i = 1}^{j-1} r_{ij} \mathbf{q}_{i} = \mathbf{a}_{j} - \sum_{i=1}^{j-1} (\mathbf{q}_{i}^{\ast}\mathbf{a}_{j} ) \mathbf{q}_{i}
  • Step 2-3. Calculate rjj=vjr_{jj} = | \mathbf{v}_{j} |.
  • Step 2-4. Calculate the following: qj=vjrjj \mathbf{q}_{j} = {{ \mathbf{v}_{j} } \over {r_{jj} }}

  • Here, since RR is given as an upper triangular matrix and is calculated by rjj=vjr_{jj} = | \mathbf{v}_{j} |, it is always guaranteed to be rjj>0r_{jj} > 0, and therefore the existence of R1R^{-1} can be known.
  • On the other hand, as you may have noticed from the notation of Q^\widehat{Q} and R^\widehat{R}, more specifically, the decomposition mentioned above is called a reduced QR decomposition, i.e., rQR decomposition.
  • The full QR decomposition, i.e., fQR decomposition, is achieved in the same way as the singular value decomposition (../340), by composing Q=[Q^qn+1qm]Cm×mQ = \begin{bmatrix} \widehat{Q} & \mathbf{q}_{n+1} & \cdots & \mathbf{q}_{m} \end{bmatrix} \in \mathbb{C}^{m \times m} made of orthonormal vectors and filling the bottom with 00, to form R=[R^O]Cm×nR = \begin{bmatrix} \widehat{R} \\ O \end{bmatrix} \in \mathbb{C}^{m \times n}.

Existence

Matrix ACm×nA \in \mathbb{C}^{m \times n} always has a QR decomposition.

Uniqueness

Invertible matrix ARm×mA \in \mathbb{R}^{m \times m} has only one rQR decomposition.

Explanation

Although it’s good that the existence and uniqueness are guaranteed, there’s practically no proof to speak of. Especially regarding uniqueness, despite proving it to be unique, the fact that it tolerates inversions of signs among other things makes it a messy fact the more you delve into it, so it’s recommended to just acknowledge it and move on.