QR Decomposition Calculator

Factor any matrix into orthogonal (Q) and upper triangular (R) matrices using the QR decomposition

Matrix Input

Enter Matrix Elements

QR Decomposition: A = QR

Q Matrix (Orthogonal)

0.3162
0.9487
0.9487
-0.3162

R Matrix (Upper Triangular)

3.1623
4.4272
0
0.6325

Matrix Properties

Q Orthogonal
R Upper Triangular
2
Matrix Rank
Full Rank

Verification: QR = A

1
2
3
4

Maximum reconstruction error: 0.00e+0

Example Calculation

Input Matrix A

Consider the 3×2 matrix:

A = [1 2]
    [3 4]
    [5 6]

QR Decomposition Process

1. Apply Gram-Schmidt orthogonalization to columns

2. Normalize vectors to get orthogonal matrix Q

3. Calculate R = QTA (upper triangular)

4. Verify: A = QR

QR Decomposition Properties

Q

Orthogonal Matrix

QTQ = I

Columns are orthonormal

R

Upper Triangular

Rij = 0 for i > j

Zero below diagonal

=

Decomposition

A = QR

Always exists for any matrix

Applications

Solving linear systems Ax = b

Least squares regression

Eigenvalue computation (QR algorithm)

Gram-Schmidt orthogonalization

Signal processing and data analysis

Understanding QR Decomposition

What is QR Decomposition?

QR decomposition factors a matrix A into the product of an orthogonal matrix Q and an upper triangular matrix R. For any m×n matrix A (where m ≥ n), we can write A = QR.

Key Properties

  • Q matrix: Orthogonal columns (QTQ = I)
  • R matrix: Upper triangular (zeros below diagonal)
  • Existence: Every matrix has a QR decomposition
  • Uniqueness: Unique if A has full rank and R diagonal is positive

Gram-Schmidt Method

Step 1: Start with matrix columns a₁, a₂, ..., aₙ

Step 2: Orthogonalize using projections

Step 3: Normalize to get orthonormal vectors

Step 4: Form Q from orthonormal vectors, compute R = QTA

Why Use QR Decomposition?

  • Numerically stable for solving linear systems
  • Efficient for least squares problems
  • Foundation for eigenvalue algorithms