Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Mathematics and Algorithms > Matrices and Linear Algebra > Matrix Decompositions >

QRDecomposition

QRDecomposition[m]
yields the QR decomposition for a numerical matrix m. The result is a list {q, r}, 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]=
m 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 r are in order of decreasing magnitude:
The matrix p is a permutation matrix:
Here is some data:
m is a design matrix for fitting with basis functions 1, t, t^2:
Find the QR decomposition of m:
This finds a vector x such that LeftDoubleBracketingBarm.x - bRightDoubleBracketingBar2 is a minimum:
These are the coefficients for the least-squares fit:
m is a 3×4 matrix:
Compute the QR decomposition:
The rows of q are orthonormal:
r is upper triangular:
m is equal to Conjugate[Transpose[q]].r:
New in 2
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team