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:=[a1⋯an]∈Cnm×n with coefficients n, let’s define the subspace generated by the column vectors up to the ith
Si(A):=sp{a1,⋯,ai}
When generating a vector space, since i can be larger, it is assumed that
S1(A)⊂S2(A)⊂⋯Sn(A)
will hold.
Of course, for a matrix made up of orthonormal vectors
Q:=[q1⋯qn]∈Cnm×n
S1(Q)⊂S2(Q)⊂⋯Sn(Q) also holds.
If relationships such as satisfying Si(A)=Si(Q) can be found, since Q will be easier to handle, matrix A would also become easier to handle.
Q:=[q1⋯qn]R:=r110⋮0r12r22⋮0⋯⋯⋱⋯r1nr2n⋮rnn
that satisfies such a multiplication of matrices is exactly what QR decomposition is.
Algorithm
Let’s say [a1⋯an]∈Cnm×n.
**Step 1. j=1
Calculate r11 that satisfies a1=r11q1 and ∣q1∣=1.
**Step 2. j=2,3,⋯,n
Step 2-1. Calculate rij=qi∗aj for i=1,2,⋯,j−1.
Step 2-2.
Calculate the temporary vector as follows:
vj=aj−i=1∑j−1rijqi=aj−i=1∑j−1(qi∗aj)qi
Step 2-3. Calculate rjj=∣vj∣.
Step 2-4. Calculate the following:
qj=rjjvj
Here, since R is given as an upper triangular matrix and is calculated by rjj=∣vj∣, it is always guaranteed to be rjj>0, and therefore the existence of R−1 can be known.
On the other hand, as you may have noticed from the notation of Q and 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=[Qqn+1⋯qm]∈Cm×m made of orthonormal vectors and filling the bottom with 0, to form R=[RO]∈Cm×n.
Existence
Matrix A∈Cm×n always has a QR decomposition.
Uniqueness
Invertible matrix A∈Rm×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.