How this calculation works
Principal angles compare whole subspaces rather than pairing individual input basis vectors. Each basis matrix uses columns as spanning vectors and both share one ambient row dimension. The calculator orthonormalizes the independent columns, computes their cross-space overlap and extracts angle cosines from a small symmetric Gram eigensystem. It returns min(dim A,dim B) angles, sorted from smallest to largest on this page.
cos(θᵢ)=σᵢ(QAᵀQB), where QA and QB have orthonormal basis columns.A worked example
Let the first space be the xy plane, spanned by columns e1 and e2, and the second be the xz plane, spanned by e1 and e3. Their principal angles are zero and 90 degrees. The zero angle reflects their shared x-axis, while the other directions are perpendicular. Comparing only the planes’ normal vectors would return one angle and lose the full subspace-angle list.
Good to know
Supports independent real basis columns in at most six ambient dimensions, with entries under the shared matrix bounds. Dependent or ill-conditioned columns are rejected. The Gram approach loses relative precision for tiny angles and is not a certified near-coincidence test. Principal vectors are not returned. This Euclidean comparison does not use a weighted inner product or compare affine offsets.
Reference: SciPy — principal angles between column spaces (opens in a new tab) ↗
Changing a basis should not change the subspace answer
Multiplying a basis vector by a nonzero scalar or replacing a basis by invertible combinations of its columns leaves the same span. A direct list of pairwise input-vector angles would usually change under those operations. Orthonormalization and singular-value invariance remove that arbitrary coordinate dependence, which is why the calculator compares the column spaces.
The default planes have a common one-dimensional direction, so their smallest principal angle is zero. Their second angle is 90 degrees. If the spaces have unequal dimensions, the number of reported angles is limited by the smaller dimension. A smaller space entirely contained in a larger one has all of its reported principal angles zero; that does not mean the dimensions are equal.
The Moore–Penrose pseudoinverse calculator for rectangular matrices reports exact rational rank, while this subspace comparison uses numerical conditioning checks.
Numerical independence and angle precision remain assumptions
A zero column is not a basis vector, and dependent columns overstate the intended dimension. This page rejects them instead of silently dropping columns under an undocumented rank threshold. Near dependence can also make orthonormalization unstable, so a conditioning threshold is applied and explained as a numerical limit rather than an algebraic claim of exact dependence.
The overlap matrix’s singular values lie between zero and one in exact arithmetic. Tiny computed excursions are clipped before the inverse cosine. Because this implementation uses a Gram eigensystem, an angle extremely close to zero can lose accuracy when a cosine near one is rounded. It is suitable for bounded educational comparisons, not precision certification of nearly coincident spaces. The vector-angle calculator covers a single pair of directions; a plane-normal angle is another special representation and does not replace the whole principal-angle spectrum.
A few questions, answered
Are vectors entered by row or column?
By column. A 3×2 matrix represents two basis vectors in three-dimensional ambient space.
Why is the output order different from some libraries?
This page sorts angles ascending and labels that convention. Some numerical libraries return them in descending order; the same angle multiset is being described.