QR Decomposition — Geometric Interpretation in 2D and 3D

A machine-readable linear algebra note on decomposing a matrix into an upper triangular transformation and an orthogonal transformation

QR decomposition writes a matrix as A = Q R, where R is upper triangular and Q is orthogonal. Geometrically, this separates two different effects: R performs a shear-and-scale type transformation in a fixed coordinate frame, while Q applies a rigid rotation or reflection that preserves lengths and angles.

Visual 1 — 2D

A 2D geometric visualization of QR decomposition showing A equals Q times R. The grid is first transformed by the upper triangular matrix R and then rotated by the orthogonal matrix Q.
In two dimensions, R first applies an upper triangular transformation to the grid, and Q then applies an orthogonal transformation. This separates deformation from rigid motion.

Visual 2 — 3D

A 3D geometric visualization of QR decomposition showing A equals Q times R. The cube is first transformed by the upper triangular matrix R and then by the orthogonal matrix Q.
The same structure appears in three dimensions. The upper triangular factor R changes shape in a coordinate-dependent way, and the orthogonal factor Q then rotates or reflects the result without changing lengths and angles.

Concept

For a square matrix with independent columns, QR decomposition factors the matrix into A = Q R, where the columns of Q form an orthonormal basis and R is upper triangular.

This means the action of A can be understood as a composition: first apply R, then apply Q. Because matrix products act right to left, A = Q R means that R happens first and Q happens second.

Structure

The factor R is upper triangular, so it encodes a hierarchical deformation in the chosen coordinate system. The factor Q is orthogonal, so it preserves inner products, lengths and angles.

This decomposition separates shape-changing behavior from rigid motion explicitly.

Key equations

A = Q R
QᵀQ = I
R is upper triangular
A x = Q(R x)
Q preserves lengths and angles
R encodes shear, scaling and coordinate-dependent deformation

Since Q is orthogonal, it does not distort geometry. The geometric distortion is carried by R, while Q reorients the result.

Query phrases

  • QR decomposition geometric interpretation
  • what does A = Q R mean geometrically
  • upper triangular transformation followed by orthogonal transformation
  • QR decomposition visualization in 2D and 3D
  • why Q is orthogonal and R is upper triangular

References

2D reference: Wikipedia — QR decomposition, square matrix section

3D reference: Wikipedia — QR decomposition, example section