Formula and Method for Polar Decomposition
The polar decomposition writes any square matrix A as the product A = QS, where Q is an orthogonal matrix (QᵀQ = I, a pure rotation or reflection) and S is a symmetric positive semi-definite matrix (a pure stretch along a set of perpendicular axes). It is the matrix generalization of writing a complex number in polar form, z = r·e^(iθ) — S plays the role of the magnitude r, and Q plays the role of the rotation e^(iθ). This calculator computes the decomposition for a general 2×2 real matrix A = [[a₁₁, a₁₂], [a₂₁, a₂₂]].
How the calculation works
First form M = AᵀA, which is always symmetric positive semi-definite. Its unique symmetric positive semi-definite square root S = √M is computed with the closed-form 2×2 identity S = (M + √det(M)·I) / √(tr(M) + 2√det(M)), which follows from the Cayley-Hamilton theorem (every 2×2 matrix satisfies its own characteristic equation, so its square root can be written as a linear combination of M and the identity I). Once S is known, the orthogonal factor is recovered as Q = A·S⁻¹, using the standard 2×2 inverse S⁻¹ = adj(S)/det(S). The rotation angle of Q is θ = atan2(Q₂₁, Q₁₁), and det(A) = det(Q)·det(S) tells you whether Q is a proper rotation (det Q = +1, so det A and det S share the same sign) or includes a reflection (det Q = −1).
Common mistakes
- Confusing left and right polar decomposition: this calculator computes the "right" decomposition A = QS; the "left" form A = KQ (with K = √(AAᵀ)) uses the same Q but a generally different symmetric factor K = QSQᵀ.
- Assuming Q is always a rotation: Q is only guaranteed to be orthogonal. If det(A) is negative, Q has determinant −1 and represents a rotation combined with a reflection, not a pure rotation.
- Applying the formula to a singular matrix: when det(A) = 0, S is still well defined but is only positive semi-definite (not invertible), so Q = AS⁻¹ cannot be computed this way and the decomposition is no longer unique.
Real-world applications
- Computer graphics and animation extract a clean rotation from an interpolated or skewed transform matrix by taking its Q factor, avoiding shearing artifacts.
- Continuum mechanics uses polar decomposition of the deformation gradient to separate pure stretch (strain) from rigid-body rotation at a material point.
- Robotics and biomechanics use it to find the best-fit rigid rotation between two sets of corresponding points (e.g., motion capture markers).
- Numerical linear algebra uses the polar decomposition, computed via the SVD, to find the nearest orthogonal matrix to a given matrix — useful for re-orthogonalizing rotation matrices that have drifted from numerical error.