QR decomposition is a fundamental technique in linear algebra that factors a matrix into the product of an orthogonal matrix Q and an upper triangular matrix R. This decomposition is widely used in numerical methods, including solving linear systems, least squares problems, and eigenvalue computations. This calculator performs QR decomposition on 2×2 or 3×3 matrices using the classical Gram-Schmidt process.
Given a real matrix A of size 2×2 or 3×3, QR decomposition finds matrices Q and R such that:
where:
Q is an orthogonal matrix, meaning its columns are orthonormal vectors and Q^T Q = I.R is an upper triangular matrix.The classical Gram-Schmidt process constructs Q by orthogonalizing the columns of A. For each column vector a_k of A, we subtract its projections onto the previously computed orthonormal vectors q_1, q_2, ..., q_{k-1} and then normalize the result:
The matrix R is then computed as R = Q^T A, capturing the coefficients from the projections.
The matrix Q represents an orthonormal basis for the column space of A. Its columns have unit length and are mutually perpendicular. The matrix R contains the weights needed to reconstruct A from Q. Because R is upper triangular, it simplifies solving linear systems and least squares problems.
Consider the 2×2 matrix:
Step 1: Take the first column vector a_1 = [1, 3]^T. Normalize it:
Step 2: Orthogonalize the second column a_2 = [2, 4]^T against q_1:
Normalize u_2 to get q_2:
Step 3: Compute R:
This example demonstrates how the calculator automates these steps, reducing manual errors and providing clear output.
| Factorization | Matrix Types | Output Matrices | Key Properties | Common Uses |
|---|---|---|---|---|
| QR Decomposition | Any real matrix (m×n) | Q (orthogonal), R (upper triangular) | Numerically stable, always exists | Least squares, eigenvalue algorithms |
| LU Decomposition | Square, nonsingular matrices | L (lower triangular), U (upper triangular) | Efficient for solving linear systems | Direct linear system solving |
| SVD (Singular Value Decomposition) | Any real matrix (m×n) | U (orthogonal), Σ (diagonal), VT (orthogonal) | Provides rank, pseudoinverse, best low-rank approx. | Data compression, noise reduction |
It is used to solve linear least squares problems, compute eigenvalues, and perform numerical linear algebra tasks requiring stable orthogonalization.
Yes, QR decomposition exists for any real matrix, regardless of shape or rank.
If the third row inputs are left blank, the calculator treats the matrix as 2×2. All required entries for the chosen size must be filled.
No, other methods include Householder reflections and Givens rotations, which are more numerically stable but more complex to implement.
Because its columns are constructed to be orthonormal vectors, preserving lengths and angles, which is useful for stable computations.
The classical Gram-Schmidt process may produce inaccurate results or fail to produce a full set of orthonormal vectors in such cases.
This calculator provides a practical tool for exploring QR decomposition on small matrices, helping users understand the underlying linear algebra concepts and applications.