A QR decomposition of an matrix, , is , where is an orthogonal matrix and is and upper trapezoidal: for . In particular its bottom rows vanish.
Successive left Givens rotations annihilate the entries below the diagonal, column by column. When working on column , rotate rows and ; their earlier columns are already zero, so the earlier eliminations persist. If , then
A product of orthogonal matrices is orthogonal. The construction remains valid for a rank-deficient matrix, although uniqueness is not asserted. This is QR decomposition by Givens rotations.
A Givens rotation is the identity except in rows and columns , where it has the block
For and , choose
when . Then
If both entries vanish, any angle works.
For the given matrix, first use
It gives
Then use
Thus is
All leading row entries are positive. The resulting QR decomposition by Givens rotations is
where
and is the matrix above. Since it is a product of transposed rotations, is orthogonal.