Definition (Orthogonal projection). If \mathbf{Q} has orthonormal columns, then \mathbf{P}=\mathbf{Q}\mathbf{Q}^{\mathsf{H}} is the orthogonal projector onto their range: \mathbf{P}^{\mathsf{H}}=\mathbf{P} and \mathbf{P}^2=\mathbf{P}. For any vector \mathbf{x}, the projected vector lies in the subspace and the residual \mathbf{x}-\mathbf{P}\mathbf{x} is orthogonal to it. Principal angles compare two subspaces rather than particular choices of basis.
Subspaces and projectors
Many numerical methods first select a subspace and then solve or approximate within it. The projector describes that choice independently of the basis used to represent it.
Results
Theorem (The CS decomposition).
A unitary matrix \mathbf{U} partitioned into blocks over p ⊕ q, given an injection e : p \to q (so p is no larger than q), factors as \mathbf{U} = \begin{bmatrix} \mathbf{V}_1 & \mathbf{0} \\ \mathbf{0} & \mathbf{V}_2 \end{bmatrix} \mathbf{K} \begin{bmatrix} \mathbf{W}_1 & \mathbf{0} \\ \mathbf{0} & \mathbf{W}_2 \end{bmatrix}^{\mathsf{H}} with \mathbf{K} the canonical matrix NLAlib.csMatrix of \mathbf{c}, \mathbf{s}, e, unitary \mathbf{V}_1, \mathbf{W}_1, \mathbf{V}_2, \mathbf{W}_2, and \mathbf{c}_i, \mathbf{s}_i \ge 0, \mathbf{c}_i^2 + \mathbf{s}_i^2 = 1; the cosines \mathbf{c} are the singular values of the leading block, in some order. [HornJohnson2013, Theorem 2.7.1]; [GolubVanLoan2013, Theorem 2.5.3]; [PaigeWei1994, Theorem 8.1]; Paige and Wei allow any 2 \times 2 partitioning, here the diagonal blocks are square.
Lean statement and details
NLAlib.HasOrthonormalCols.exists_cs_decomposition.{u_1, u_2, u_3} {𝕜 : Type u_1} [RCLike 𝕜]
{p : Type u_2} {q : Type u_3} [Fintype p] [Fintype q] [DecidableEq p] [DecidableEq q]
{U : Matrix (p ⊕ q) (p ⊕ q) 𝕜} (hU : HasOrthonormalCols U) (e : p ↪ q) :
∃ V₁ W₁ V₂ W₂ c s,
HasOrthonormalCols V₁ ∧
HasOrthonormalCols W₁ ∧
HasOrthonormalCols V₂ ∧
HasOrthonormalCols W₂ ∧
(∀ (i : p), 0 ≤ c i) ∧
(∀ (i : p), 0 ≤ s i) ∧
(∀ (i : p), c i ^ 2 + s i ^ 2 = 1) ∧
(∃ f, ∀ (i : p), c i = singularValues U.toBlocks₁₁ ↑(f i)) ∧
U = fromBlocks V₁ 0 0 V₂ * csMatrix 𝕜 c s e * (fromBlocks W₁ 0 0 W₂)ᴴTheorem (Equal Gram matrices).
\mathbf{A}^{\mathsf{H}}\mathbf{A} = \mathbf{B}^{\mathsf{H}}\mathbf{B} exactly when \mathbf{A} = \mathbf{W}\mathbf{B} for some \mathbf{W} with orthonormal columns, provided \mathbf{A} has at least as many rows as \mathbf{B}. [HornJohnson2013, Theorem 7.3.11].
General form: sizes are index types
Lean statement and details
NLAlib.conjTranspose_mul_self_eq_iff_exists_mul.{u_1, u_2, u_3, u_4} {𝕜 : Type u_1} [RCLike 𝕜]
{m : Type u_2} {n : Type u_3} {p : Type u_4} [Fintype m] [Fintype p] [Finite n] [DecidableEq p]
{A : Matrix m n 𝕜} {B : Matrix p n 𝕜} (hcard : Fintype.card p ≤ Fintype.card m) :
Aᴴ * A = Bᴴ * B ↔ ∃ W, HasOrthonormalCols W ∧ A = W * BTheorem (The exact error split, Gram form).
for \mathbf{X} \in \Bbbk^{m \times r}, \mathbf{S} \in \Bbbk^{k \times m} and \mathbf{B} \in \Bbbk^{m \times n} with \operatorname{rank}(\mathbf{S}\mathbf{X}) = \operatorname{rank}(\mathbf{X}), the oblique projection error has two orthogonal components. With \mathbf{P}_{\mathbf{X}} the orthogonal projector onto the range of \mathbf{X}, \mathbf{\Pi} = \mathbf{\Pi}_{\mathbf{X},\mathbf{S}} and \mathbf{E} = (\mathbf{I}-\mathbf{P}_{\mathbf{X}})\mathbf{B}, ((\mathbf{I}-\mathbf{\Pi})\mathbf{B})^{\mathsf{H}}(\mathbf{I}-\mathbf{\Pi})\mathbf{B} = \mathbf{E}^{\mathsf{H}}\mathbf{E} + (\mathbf{\Pi}\mathbf{E})^{\mathsf{H}}\mathbf{\Pi}\mathbf{E}\,. [EpperlyWebber2026, Lemma 5.1, (5.2)]; [CamanoEpperlyMeyerTropp2025, Lemma 2.6]; [TroppYurtseverUdellCevher2017, Lemmas A.3, A.4]; there a trace identity in a basis.
Lean statement and details
NLAlib.conjTranspose_mul_self_one_sub_obliqueProjector_mul.{u_1, u_2, u_3, u_4, u_7} {𝕜 : Type u_1}
[RCLike 𝕜] {k : Type u_2} {m : Type u_3} {n : Type u_4} {r : Type u_7} [Fintype k] [Fintype m]
[Fintype r] {X : Matrix m r 𝕜} {S : Matrix k m 𝕜} [DecidableEq m] (h : (S * X).rank = X.rank)
(B : Matrix m n 𝕜) :
((1 - obliqueProjector X S) * B)ᴴ * ((1 - obliqueProjector X S) * B) =
((1 - rangeProjector X) * B)ᴴ * ((1 - rangeProjector X) * B) +
(obliqueProjector X S * ((1 - rangeProjector X) * B))ᴴ *
(obliqueProjector X S * ((1 - rangeProjector X) * B))Theorem (The secant formula).
The spectral norm of a nonzero idempotent \mathbf{P} is the secant of the largest principal angle between its range and the range of \mathbf{P}^{\mathsf{H}} (the orthogonal complement of its kernel): \|\mathbf{P}\|_2 \cos \theta_j = 1 with \theta_j = \theta_j(\mathbf{P}, \mathbf{P}^{\mathsf{H}}) and j + 1 = \operatorname{rank} \mathbf{P}; that \theta_j < \pi / 2 is IsIdempotentElem.principalAngle_conjTranspose_lt. [HornJohnson2013, Corollary 3.4.3.3]; [Szyld2006].
Lean statement and details
IsIdempotentElem.specNorm_mul_cos_principalAngle.{u_1, u_2} {𝕜 : Type u_1} [RCLike 𝕜] {n : Type u_2}
[Fintype n] {P : Matrix n n 𝕜} (hP : IsIdempotentElem P) {j : ℕ} (hj : j + 1 = P.rank) :
specNorm P * Real.cos (principalAngle P Pᴴ j) = 1Theorem (Unitary canonical form of an idempotent).
In an orthonormal basis of the range and its orthogonal complement, the diagonal blocks are the identity and zero. The rectangular upper-right block is diagonal with entries \sqrt{\sigma_i(\mathbf{P})^2-1}. [HornJohnson2013, Corollary 3.4.3.3].
General form: sizes are index types
Lean statement and details
IsIdempotentElem.exists_conjTranspose_mul_mul_eq_fromBlocks.{u_1, u_2} {𝕜 : Type u_1} [RCLike 𝕜]
{n : Type u_2} [Fintype n] {P : Matrix n n 𝕜} (hP : IsIdempotentElem P) {s : ℕ}
(hc : P.rank + s = Fintype.card n) :
∃ H,
HasOrthonormalCols H ∧
Hᴴ * P * H =
fromBlocks 1 (of fun i j ↦ if ↑i = ↑j then ↑√(singularValues P ↑i ^ 2 - 1) else 0) 0 0Theorem (Cosines for orthonormal frames).
for \mathbf{U} and \mathbf{V} with orthonormal columns, the cosines of the principal angles between their column spaces are the singular values of \mathbf{U}^{\mathsf{H}}\mathbf{V}: \cos \theta_k(\mathbf{U}, \mathbf{V}) = \sigma_k(\mathbf{U}^{\mathsf{H}}\mathbf{V}) for every k. [GolubVanLoan2013, §6.4.3].
Lean statement and details
NLAlib.HasOrthonormalCols.cos_principalAngle.{u_1, u_2, u_3, u_4} {𝕜 : Type u_1} [RCLike 𝕜]
{n : Type u_2} {p : Type u_3} {q : Type u_4} [Fintype n] [Fintype p] [Fintype q] [DecidableEq p]
[DecidableEq q] {U : Matrix n p 𝕜} {V : Matrix n q 𝕜} (hU : HasOrthonormalCols U)
(hV : HasOrthonormalCols V) (k : ℕ) : Real.cos (principalAngle U V k) = singularValues (Uᴴ * V) kTheorem (The gap between two orthogonal projectors).
\|\mathbf{P} - \mathbf{Q}\|_2 is the larger of the two directed gaps, \max(\|(\mathbf{I} - \mathbf{Q})\mathbf{P}\|_2, \|(\mathbf{I} - \mathbf{P})\mathbf{Q}\|_2). [GolubVanLoan2013, §2.5.3]; [Kato1995, §I.6.8].
Lean statement and details
IsStarProjection.specNorm_sub_eq_max.{u_1, u_3} {𝕜 : Type u_1} [RCLike 𝕜] {n : Type u_3} [Fintype n]
[DecidableEq n] {P Q : Matrix n n 𝕜} (hP : IsStarProjection P) (hQ : IsStarProjection Q) :
specNorm (P - Q) = max (specNorm ((1 - Q) * P)) (specNorm ((1 - P) * Q))Formal definitions
Used by algorithms
14 algorithms using this topic or its subtopics
GMRES
Minimize the residual over a Krylov space for a general square system.
Arnoldi process
Build an orthonormal Krylov basis and an upper-Hessenberg compression.
Golub–Kahan process
Build a pair of Krylov bases and a block bidiagonal factorization of a rectangular operator.
Sketch-and-solve least squares
Solve a compressed least-squares problem produced by a sketch.
Sketch-and-precondition least squares
Build a preconditioner from a sketch before solving the original problem.
Gram–Schmidt orthogonalization
Construct an orthonormal basis from input vectors.
QR factorization
Factor a matrix into an orthogonal basis and a triangular factor.
Randomized subspace extraction (deflation)
Project a random sample through a matrix and extract a basis using QR.
Full orthogonalization method (FOM)
Enforce Galerkin orthogonality using a full Krylov basis.
LU factorization
Factor a matrix into lower- and upper-triangular factors without row permutations.
PLU factorization
Use row permutations in a lower–upper triangular factorization.
Preconditioned MINRES
Minimize a preconditioned residual norm for a Hermitian system.
Randomized Kaczmarz
Project onto sampled row equations using squared-row-norm sampling.
Sketch-and-project
Project an iterate onto a sketched system of equations.