Reflections, Rotations and QR Factorization
Reflections, Rotations and QR Factorization
Householder Reflections
A Householder Reflection is W = I – w·w' = W' = W–1 for any column w satisfying w'·w = 2 .
If y = W·x then y'·y = x'·x , and y'·x = x'·y is real even if x, y and w are complex. W is a
reflection because W·w = –w and W·p = p whenever w'·p = 0 . Numerical analysts name this
reflection after Alston S. Householder because he introduced it to them in the mid 1950s as part
of an improved way to solve Least-Squares problems.
Given columns x and e := [1, 0, 0, …, 0]' so that e'·x = x1 , we seek column w so that
w'·w = 2 and W := I – w·w' reflects x to W·x = e·ß for some scalar ß . Its |ß| = ||x|| := √(x'·x)
and x'·W·x = x'·e·ß = x1'·ß must be real, so ß = ±||x||·x1/|x1| if x1 ≠ 0 .
Proof: Let p := x + e·ß so that p'·d = 0 = p'·w . Then W·d = –d and W·p = p , whereupon
2W·x = W·(p+d) = p–d = 2e·ß as desired.
How is the sign ± in ß chosen? The simplest way maximizes Ω2 := d'·d/2 = Ñ·(Ñ – (±)|x1|)
by setting ß := –Ñ·x1/|x1| , as we’ll see. Of course, any ± sign works when x1 = 0 .
Detailed Construction: Let v := x – e·x1 , so that e'·v = v1 = 0 , and let µ := v'·v > 0 , so that
Ñ := √(x'·x) = √( µ + |x1|2 ) . Next set ç := x1/|x1| = sign(x1) except that we reset ç := 1 if
x1 = 0 . Next we choose ß := ±ç·Ñ . Numerical stability requires two cases to be distinguished:
QR Factorization:
Given an m-by-n matrix F with no fewer rows than columns (so m ≥ n ), we wish to factorize
F = Q·R , with Q'·Q = I and R upper-triangular, by using Householder reflections thus:
Wn·…·W2·W1·F = R in which each reflection Wj = Wj' = Wj–1 is constructed to annihilate all
O
Finally, set Gn+1 := Fn and, for j = n, n–1, …, 1 in turn, extract wj from Gj+1(j:m, j) ,
overwrite column [oj–1; 1; om–j] onto Gj+1(:, j) , and then onto Gj+1(j:m, j:n) overwrite
Gj(j:m, j:n) := Gj+1(j:m, j:n) – wj·(wj'·Gj+1(j:m, j:n)) . Then Q := G1 .
Numerical experiments indicate that MATLAB uses the same method to get [Q, R] = qr(F, 0) .
wherein |r|2 = v'·v , so c2 + s'·s = 1 when (by convention) we choose c ≥ 0 . Here v' is the
complex conjugate transpose of v , and s' is the complex conjugate of s . The rotation is named
after Wallace Givens who introduced this rotation to numerical analysts in the 1950s while he
was working at Argonne National Labs near Chicago. The rotation is encoded in one complex
number t := (y/x)' from which are derived c := 1/√(1 + t'·t) , s := c·t and r := x/c . In the
special case that t = ∞ (presumably because x = 0 ), we set c := 0 , s := 1 and r := y . In any
event, note that Q–1 = Q' . Return [c, s, t, r] = givenst(x, y) .
Bottom-Up QR Factorization:
Given an m-by-n matrix F with no fewer rows than columns (so m ≥ n ), we wish to factorize
F = Q·R , with Q'·Q = I and R upper-triangular, by using Givens rotations thus:
For 1 ≤ i ≤ m–1 and 1 ≤ j ≤ n let Qij be the Givens rotation that acts upon an m-by-n matrix
z i, j r i, j z i, j
Z to overwrite Qij· = onto . We shall premultiply F by a sequence of
z i + 1, j 0 z i + 1, j
Since each Qij affects only rows i and i+1 of columns j to n of the product, we may store tij
in place of the product’s zero element in position (i+1, j) since it will not figure in subsequent
premultiplications. After the last premultiplication we find R in the product’s first n rows and
columns after ignoring the subdiagonal elements that hold tijs . Then these are used to construct
Q as a product of inverse rotations Qij' premultiplying I in this reverse order (from right to
O
left):
for j = n down to 1 in turn { for i = j up to m–1 in turn { premultiply by Qij' }}.
Each premultiplication by Qij' affects only rows i and i+1 of columns j to n of the product
after tij was extracted from location (i+1, j) and replaced by 0 .
This is not the only way to use Givens rotations for QR factorizations. Another is …
Top-Down QR Factorization:
Given an m-by-n matrix F with no fewer rows than columns (so m ≥ n ), we wish to factorize
F = Q·R , with Q'·Q = I and R upper-triangular, by using Givens rotations thus:
For 1 ≤ j ≤ n and j+1 ≤ i ≤ m let Qij be the Givens rotation that acts upon an m-by-n matrix
z j, j r j, j z j, j
Z to overwrite Qij· = onto . We shall premultiply F by a sequence of rotations
z i, j 0 z i, j
Since each Qij affects only rows i and j of columns j to n of the product, we may store tij in
place of the product’s zero element in position (i, j) since it will not figure in subsequent
premultiplications. After the last premultiplication we find R in the product’s first n rows and
columns after ignoring the subdiagonal elements that hold tijs . Then these are used to construct
Q as a product of inverse rotations Qij' premultiplying I in this reverse order (from right to
O
left):
for j = n down to 1 in turn { for i = m down to j+1 in turn { premultiply by Qij' }}.
Each premultiplication by Qij' affects only rows i and j of columns j to n of the product after
tij was extracted from location (i, j) and replaced by 0 .
MATLAB appears to use Householder reflections to get its [Q, R] = qr(F, 0) . There is no reason
to expect any two of the three different [Q, R] factorizations to agree though they must be related
in the absence of roundoff: R1·R2–1 = Q1'·Q2 must be a diagonal unitary matrix.
=============================================
MATLAB Programs
% = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
% = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
% = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
% = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
% = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =