This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

QRDecomposition

QRDecomposition[m]
yields the QR decomposition for a numerical matrix m. The result is a list , where q is an orthogonal matrix and r is an upper-triangular matrix.
  • For non-square matrices, q is row orthonormal. »
  • The matrix r has zeros for all entries below the leading diagonal. »
Compute the QR decomposition for a 3×2 matrix with exact values:
Compute the QR decomposition for a 2×3 matrix with approximate numerical values:
Compute the QR decomposition for a 3×2 matrix with exact values:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
 
Compute the QR decomposition for a 2×3 matrix with approximate numerical values:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
is a 3×4 matrix:
QR decomposition computed with exact arithmetic:
QR decomposition computed with machine arithmetic:
QR decomposition computed with 24-digit arithmetic:
QR decomposition for a 3×3 matrix with random complex entries:
Compute the QR decomposition using machine arithmetic with pivoting:
The elements along the diagonal of are in order of decreasing magnitude:
The matrix is a permutation matrix:
QRDecomposition satisfies m.p==ConjugateTranspose[q].r:
Here is some data:
is a design matrix for fitting with basis functions , , :
Find the QR decomposition of :
This finds a vector such that is a minimum:
These are the coefficients for the least-squares fit:
is a 3×4 matrix:
Compute the QR decomposition:
The rows of are orthonormal:
is upper triangular:
is equal to ConjugateTranspose[q].r:
New in 2