Computing Library › Linear Algebra
Linear Algebra

Orthogonal Matrices

Square matrices whose columns are orthonormal; they rotate and reflect without changing lengths or angles.

Definition

A square matrix Q is orthogonal if its columns form an orthonormal set, equivalently if Q^T Q = I, which means Q^{-1} = Q^T. The transpose is the inverse, so undoing the transformation costs nothing. Orthogonal matrices represent rigid motions of space: rotations and reflections that leave the geometry unchanged.

Length and angle preservation

Multiplying by an orthogonal matrix preserves dot products, |Qx . Qy| = x . y, and therefore preserves lengths and angles. This isometry property is why orthogonal transformations are the safest operations in numerical computing: they never amplify errors, so their condition number is exactly one, the best possible.

Determinant and structure

An orthogonal matrix has determinant plus or minus one. A determinant of plus one gives a proper rotation; minus one includes a reflection. In two and three dimensions these are exactly the familiar rotations and reflections, and every orthogonal matrix factors into a product of simple planar rotations (Givens) or reflections (Householder).

Why algorithms love them

Because they preserve norms, orthogonal matrices are the transformations of choice in stable algorithms. QR factorization triangularizes a matrix using orthogonal steps, the SVD sandwiches a diagonal between two orthogonal matrices, and eigenvalue routines use orthogonal similarity transforms. Each keeps error growth in check that non-orthogonal transforms would risk.

python
import numpy as np
Q, _ = np.linalg.qr(np.random.rand(3, 3))
print(np.allclose(Q.T @ Q, np.eye(3)))   # True
print(round(abs(np.linalg.det(Q)), 6))   # 1.0
v = np.random.rand(3)
print(np.allclose(np.linalg.norm(Q @ v), np.linalg.norm(v)))  # length preserved

Coordinate rotations between laboratory, field-aligned, and magnetic frames in plasma physics are orthogonal transformations, chosen precisely because they preserve the physical magnitudes they act on.