QR Factorisation Method
QR Factorisation Method
• Reduced QR Factorization
• columns of 𝑄 are an orthonormal basis for range(𝐴)
• Full QR Factorization
• Gram-Schmidt method for QR factorization
The idea of QR factorization is the construction of a sequence of orthonormal vectors 𝒒𝟏, 𝒒𝟐 , … that
span these successive spaces.
Assume that A 𝜖 𝙍𝑚x𝑛 (m > n) has full rank n (All n columns are independent)
𝒂𝟏 , 𝒂𝟐 , … , 𝒂𝒋 = 𝒒𝟏 , 𝒒𝟐 , … 𝒒𝒋 j=1,…,n
Dr. Durba Bhattacharya; St. Xavier’s College(Autonomous), Kolkata
𝒂𝟏 𝒂2 𝒂𝑛 𝒒𝟏 𝒒2 𝒒𝑛 ----(*)
• As A 𝛜 𝙍𝑚x𝑛 (m > n) is assumed to be of full rank n, the diagonal entries 𝒓𝒌𝒌 are nonzero.
• The invertibility of the upper-left k x k block of the triangular matrix implies that, conversely,
𝒒𝟏 , 𝒒𝟐 , … 𝒒𝑘 can be expressed as linear combinations of 𝒂𝟏 , 𝒂𝟐 , … , 𝒂𝑘 .
𝑦 ∈ range(𝐴)
⇐⇒ 𝑦 = 𝐴𝑥 for some 𝑥
⇐⇒ 𝑦 = 𝑄𝑅𝑥 for some 𝑥
⇐⇒ 𝑦 = 𝑄𝑧 for some 𝑧
⇐⇒ 𝑦 ∈ range(𝑄)
𝑹
=𝑸
A = 𝑄 ෨ 𝑅 = QR
𝑄
0
In the process, rows of zeros are appended to R so that it becomes an m x n matrix R, still upper-triangular.
In the full QR factorization, Q is m x m, R is m x n, and the last (m-n) columns of Q are multiplied by
zeros in R.
In the reduced QR factorization, the silent columns and rows are removed. Now Q is m x n, R is n x n,
and none of the rows of R are necessarily zero.
Note that in the full QR factorization, the columns 𝑞𝑗 for j > n are orthogonal to range(A).
Assuming A is of full rank n, they constitute an orthonormal basis for range𝐴⊥ (the space orthogonal to
range(A)), i.e, for null (𝐴′).
• linear equations
𝐴† = (𝐴′ 𝐴) −1 𝐴′
= (𝑅′ Q′ QR)−1R′ 𝑄′
= (𝑅′ R)−1 R′ 𝑄′
= R−1 𝑄′
⇒ R𝑥 = 𝑄 ′𝑏
The system of linear equations implicit in the left-hand side is also easy to solve because it is
triangular.
The QR matrix decomposition allows us to compute the solution to the Least Squares problem.
OLS gives us the closed from solution in the form of the normal equations.
But when we want to find the actual numerical solution they aren’t really useful.
Usually 𝛽መ = 𝑋 −1 𝑦 does not exist as we might have more observations than variables and 𝑋 −1 might not exist.
Instead, we try to find some 𝛽መ that minimizes the objective function σ(𝑦 − 𝑋𝛽)2 .
Taking derivatives with respect to 𝛽መ and setting to zero will lead us to the normal equations and
provides a closed-form solution.
⇒ (QR) 𝛽 = 𝑦
This means that all we need to do is find an inverse of R, transpose Q, and take the product. That will
produce the OLS coefficients.
We don’t even need to compute the Variance-Covariance matrix and its inverse (𝑋 ′ 𝑋)−1 which is
how OLS solutions are usually presented.
The use of Householder matrices, also termed a Householder reflections, is the most commonly
used method for performing the QR decomposition.
By a proper choice of u, 𝐻𝑢A zeros out all the elements below a diagonal element 𝑎𝑖𝑖 , and so it is
an ideal tool for the QR decomposition.
Let x be a vector that we wish to reflect in a mirror (hyperplane) that is perpendicular to the vector u.
𝑥 ′𝑢
The orthogonal projection of x onto the span of u is given by: 𝑢′ 𝑢
𝑢.
𝑥 ′𝑢 𝑥 ′𝑢
∴x- 𝑢 must lie on the mirror. x–2 𝑢
𝑢′ 𝑢 𝑢′ 𝑢
𝑥 ′𝑢
Hence the reflected vector = x – 2 𝑢′𝑢
𝑢
We can write the reflected vector as a matrix-vector multiply with the Householder
matrix:
𝑥′𝑢 𝑢𝑢′
x–2 𝑢′𝑢
𝑢 = (I – 2 𝑢′𝑢
)x
The successive matrices have the following structure (blank spaces indicate zeros):
If the first column of the fully-dense matrix above is a, then we want to find a vector v such
that 𝑄𝑣 𝑎=∥a−−∥2e1Qv_a_=‖a_‖2e1, where e1=(1,0,…,0)Te1=(1,0,…,0)T (remember that
reflections preserve lengths of vectors). A short derivation reveals that we want v–v_ such that: