Advanced

QR Decomposition Calculator — 2×2 Matrix

Decompose a 2×2 matrix A = QR where Q is orthogonal (Q^T Q = I) and R is upper triangular. Enter the four matrix elements and the calculator applies Gram-Schmidt to the columns to produce Q and R instantly.
Row 1, Column 1
Row 1, Column 2
Row 2, Column 1
Row 2, Column 2
det(A)
2

Determinant of A = R[1,1] × R[2,2] | non-zero confirms full rank

R (upper triangular)
[[5, 2.2], [0, 0.4]]
Q[1,1]
0.6
Q[1,2]
-0.8
Q[2,1]
0.8
Q[2,2]
0.6
R[1,1] = ‖col₁‖
5
R[1,2] = col₂ · ê₁
2.2
R[2,2] = ‖col₂ − proj‖
0.4
Q^T Q off-diagonal (≈ 0)
-0
Q — the orthogonal factor (rotates/reflects the standard basis)
Step by step
  1. 1

    A[1,1] × A[2,2]

    3 × 2 = 6
  2. 2

    A[1,2] × A[2,1]

    1 × 4 = 4
  3. 3

    det(A) = A[1,1]·A[2,2] − A[1,2]·A[2,1]

    6 − 4 = 2
    A non-zero determinant confirms that the columns are linearly independent and QR decomposition exists.
Results are estimates for general information only and are not professional advice — always verify important results independently before relying on them. Read the full disclaimer.
Quick answer

How does this calculator work?

QR decomposition factors A = QR using Gram-Schmidt: normalise column 1 to get ê₁; subtract its projection from column 2 and normalise to get ê₂. Q = [ê₁|ê₂] (orthogonal) and R = [[‖v₁‖, v₂·ê₁],[0,‖u₂‖]] (upper triangular). Requires linearly independent columns (det ≠ 0). Used in least-squares, eigenvalue algorithms, and regression.

Formula
A = Q R | Q = [ê₁ | ê₂], R = [[‖v₁‖, v₂·ê₁], [0, ‖u₂‖]] (Gram-Schmidt)
How this is calculated

QR decomposition factors a matrix A into a product QR where Q is orthogonal (Q^T Q = I, so Q^(−1) = Q^T) and R is upper triangular with non-negative diagonal entries. This is computed here using Gram-Schmidt orthogonalisation applied to the columns of A.

Let v₁ and v₂ be the columns of A. Step 1: normalise v₁ to get the unit vector ê₁ = v₁/‖v₁‖ (this becomes column 1 of Q, and ‖v₁‖ becomes R[1,1]). Step 2: subtract the projection of v₂ onto ê₁ to get u₂ = v₂ − (v₂·ê₁)ê₁; normalise to ê₂ = u₂/‖u₂‖ (column 2 of Q; ‖u₂‖ = R[2,2]; the projection v₂·ê₁ = R[1,2]). The lower-left entry R[2,1] = 0 by construction.

QR decomposition exists and is unique (with positive diagonal of R) whenever A has linearly independent columns. It is numerically stable and widely used: solving least-squares problems (Ax ≈ b) via back-substitution on Rx = Q^T b, computing eigenvalues via QR iteration, and regression. The determinant of A equals det(Q) × det(R) = ±1 × R[1,1] × R[2,2].

Frequently asked questions

QR decomposition is used to solve least-squares problems (Ax ≈ b), compute eigenvalues via the QR algorithm, and perform numerically stable Gaussian elimination. It is preferred over LU decomposition when numerical stability matters, because Q is orthogonal and does not amplify rounding errors.

Multiply Q × R and check that it equals the original matrix A. Also verify Q is orthogonal: Q^T Q should equal the identity matrix (off-diagonal entries ≈ 0, diagonal ≈ 1). The calculator shows the off-diagonal element of Q^T Q — any value well above floating-point precision suggests an error.

If the columns of A are linearly dependent, the second Gram-Schmidt step produces a zero vector u₂, making ê₂ and R[2,2] undefined. Geometrically the matrix projects 2-D space onto a line rather than a plane, so no orthonormal basis for the column space exists in 2-D. The decomposition fails, and the matrix is singular (det = 0).

Also known as

qr decomposition calculator 2x2
qr factorization matrix
gram schmidt orthogonalization calculator
orthogonal upper triangular matrix factorization
a equals q times r decomposition
linear algebra qr factorization tool
orthonormal basis matrix calculator

APA

TG we-Calculate Editorial Team. (2026). QR Decomposition Calculator — 2×2 Matrix [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/qr-decomposition-calculator

Chicago

TG we-Calculate Editorial Team. "QR Decomposition Calculator — 2×2 Matrix." TG we-Calculate. 2026. https://we-calculate.com/calculator/qr-decomposition-calculator.

IEEE

TG we-Calculate Editorial Team, "QR Decomposition Calculator — 2×2 Matrix," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/qr-decomposition-calculator

BibTeX

@misc{wecalculate_qr_decomposition_calculator, title = {QR Decomposition Calculator — 2×2 Matrix}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/qr-decomposition-calculator}}, year = {2026}, note = {TG we-Calculate} }

Did this calculator help you?