Maths & numbers
QR decomposition
Factor a small matrix into an orthonormal basis and upper-triangular coefficients.
A clear answer. Here’s how.
Computes economy QR using modified Gram–Schmidt with a second orthogonalisation pass. Requires rows≥columns and numerically independent columns; up to 6 × 6. Returns Q and R with A≈QR and QᵀQ≈I. Rejects column norms at or below 10⁻¹² × max(1, largest absolute input entry); no column pivoting is performed.
See a worked example
Worked example
A fixed demonstration, separate from the values you enter above.
- Matrix: one row per line
1, 1 1, 0 0, 1
Example result
| Factor | Row | C1 | C2 |
|---|---|---|---|
| Q | 1 | 0.707106781187 | 0.408248290464 |
| Q | 2 | 0.707106781187 | -0.408248290464 |
| Q | 3 | 0 | 0.816496580928 |
| R | 1 | 1.41421356237 | 0.707106781187 |
| R | 2 | 0 | 1.22474487139 |
Economy QR: A=Q×R and transpose(Q)×Q=I. Modified Gram–Schmidt with a second orthogonalisation pass; dependent columns are rejected.