Test QᵀQ = I, read the determinant, watch lengths and angles survive, and identify the rotation or reflection.
Preset?A square matrix is orthogonal when its columns are orthonormal: unit length and mutually perpendicular, which is the single equation QᵀQ = I. Then Q⁻¹ = Qᵀ, the rows are orthonormal too, det Q = ±1, and Q preserves every length and angle: |Qx| = |x| and (Qx)·(Qy) = x·y. In the plane an orthogonal matrix is a rotation (det +1) or a reflection (det −1); in space a rotation about an axis, or a rotation combined with a reflection.
Size
Q2× 2
Entries of Q
Test vector x
Q2×2
0.866
−0.5
0.5
0.866
Step 1 / 7
Step explanations
1Is this 2×2 matrix orthogonal?
A matrix is orthogonal when its columns are orthonormal — each of length 1, each pair perpendicular — which is the single matrix equation QᵀQ = I. The test is one multiplication. If it passes, everything else follows: Q⁻¹ = Qᵀ, det Q = ±1, and Q moves vectors without changing any length or angle, so it is a rotation, a reflection, or a combination.
Orthogonal group O(n) — all n×n orthogonal matrices; closed under products and inverses.
Getting Started with the Visualizer
Choose a matrix and test it.
• Use the Preset pills for eight matrices: a 30° rotation, a reflection, a permutation, a Householder reflection, a rotation about the z-axis, a matrix with perpendicular but non-unit columns, a scaled rotation, and a shear • Use the Size stepper for 2×2 or 3×3, and Shuffle for a random rotation or reflection • Edit any entry directly; the entries are shown to four decimals, and the test tolerates that rounding • Change the test vectorx to see lengths and dot products preserved for your own vector • Hover the ? icon for a reminder of what orthogonality means and implies • Press play or step manually; the step log on the right keeps every stage
A matrix that fails the test stops early, with the diagnosis: perpendicular columns of the wrong length, which normalizing fixes, or columns that are not perpendicular at all.
The Scenes in Order
The visualizer follows the textbook checks exactly.
• QTQ — computed as a product; the diagonal entries are the squared column lengths, the off-diagonal ones the dot products between columns • Not orthogonal — the run stops, showing the normalized matrix when only the lengths were wrong • Determinant — ±1, with the rotation-or-reflection verdict • Lengths and angles — Qx and Qy for two test vectors, with ∥Qx∥=∥x∥ and (Qx)⋅(Qy)=x⋅y • Inverse — QQT=I, so Q−1=QT and the rows are orthonormal too • Classify — in 2D, the rotation angle or the mirror line; in 3D, the axis from the null space of Q−I and the angle from the trace • Done — the summary and the group properties
The Test
The frozen picture below shows QTQ for the 30° rotation: the identity. Each diagonal entry is a column dotted with itself, 1; each off-diagonal entry is the dot product of the two columns, 0.
One multiplication decides orthogonality.
QᵀQ = I, frozen
The 30° rotation: each diagonal entry is cos² + sin² = 1, each off-diagonal entry is −cos·sin + sin·cos = 0. The columns are orthonormal.
The test packs n length checks and n(n−1)/2 perpendicularity checks into one product, and it is exactly the condition that the columns form an orthonormal basis. The same product for a non-orthogonal matrix is still informative: the diagonal reports the squared column lengths and the off-diagonal entries report which pairs of columns are not perpendicular.
For a 2×2 matrix the test can be done by eye. The columns (a,c) and (b,d) must satisfy a2+c2=1, b2+d2=1 and ab+cd=0; with a=cosθ and c=sinθ the second column is forced to be ±(−sinθ,cosθ), which is the whole classification.
Determinant Plus or Minus One
The frozen picture below shows the determinant of the 30° rotation: cos230°+sin230°=1.
Orthogonal matrices have determinant ±1, and the sign is the difference between a rotation and a reflection.
det Q = 1, frozen
cos² 30° + sin² 30° = 1: orientation preserved, a rotation. Every orthogonal matrix has determinant +1 or −1.
The determinant is ±1 because det(QTQ)=(detQ)2=detI=1. Its sign records orientation: a rotation keeps a counterclockwise triangle counterclockwise, a reflection turns it clockwise. Both keep areas and volumes, since ∣detQ∣=1.
Rotations alone form a group, SO(n), since the product of two determinant-+1 matrices has determinant +1. Reflections do not: the product of two reflections is a rotation, which is how every rotation of the plane can be built from two mirrors.
Lengths and Angles Survive
The frozen picture below shows the 30° rotation applied to x=(2,1) and y=(1,0). Both images have the same lengths as the originals, 5 and 1, and the same dot product, 2.
Every dot product survives, so every length and every angle does.
Lengths and angles, frozen
x = (2, 1) and y = (1, 0) rotated by 30°: |Qx| = |x| = √5, |Qy| = 1, and (Qx)·(Qy) = 2 = x·y. The whole figure turned rigidly.
The one-line proof is (Qx)⋅(Qy)=(Qx)T(Qy)=xTQTQy=xTy. Because lengths are x⋅x and angles come from cosθ=x⋅y/∥x∥∥y∥, everything geometric is preserved. The unit circle maps to itself; the grid maps to a rotated, or reflected, grid of the same squares.
This is what distinguishes orthogonal matrices from all other invertible ones. A general matrix sends the unit circle to an ellipse and changes angles; its singular values measure by how much. An orthogonal matrix has all singular values equal to 1.
The Inverse Is the Transpose
The frozen picture below shows QQT=I for the 30° rotation. The transpose is the rotation by −30°, and it undoes Q.
QTQ=I was the test; QQT=I comes free, and says the rows are orthonormal too.
Q Qᵀ = I, frozen
The transpose is the rotation by −30° and undoes Q. Q⁻¹ = Qᵀ, and the rows are orthonormal too.
For a square matrix a left inverse is automatically a right inverse, so QTQ=I forces QQT=I. The practical consequence is enormous: solving Qx=b is x=QTb, one matrix-vector product, and the condition number is 1, so no error is amplified.
That is why numerical algorithms are built from orthogonal steps. Householder reflections zero out entries below a pivot, Givens rotations zero out one entry at a time, and both leave the rest of the problem exactly as well-conditioned as before.
Reading Off a Reflection
The reflection preset 21(111−1) has determinant −1. The frozen picture below shows its classification: with cos2φ=sin2φ=1/2, the mirror line is at φ=22.5°.
The direction (cos22.5°,sin22.5°) is fixed and its perpendicular is reversed.
A reflection classified, frozen
det −1 and cos 2φ = sin 2φ = 1/√2: the mirror line is at φ = 22.5°. That direction is fixed, its perpendicular reversed.
A 2×2 reflection matrix has the form (cos2φsin2φsin2φ−cos2φ), symmetric, with Q2=I and eigenvalues +1 along the mirror and −1 across it. The doubled angle is why a matrix whose entries suggest 45° is a reflection across the 22.5° line.
Reflections are the building blocks of all orthogonal matrices: any orthogonal matrix in n dimensions is a product of at most n reflections. Two reflections across lines at angle α apart compose to a rotation by 2α.
The Axis of a Rotation in Space
The permutation matrix that sends (x,y,z) to (z,x,y) is orthogonal with determinant +1. The frozen picture below shows its classification: the axis, the null space of Q−I, is (1,1,1), and the trace 0=1+2cosθ gives θ=120°.
Cycling three coordinates is a third of a turn about the main diagonal.
A rotation of space classified, frozen
The permutation (x, y, z) → (z, x, y): axis (1, 1, 1) from the null space of Q − I, and trace 0 = 1 + 2 cos θ gives θ = 120°.
Euler's theorem says every rotation of space has an axis, a line of fixed points. Algebraically, Q has determinant +1 and eigenvalues of modulus 1, so one eigenvalue is real and equal to 1, and its eigenvector is the axis. The other two are e±iθ, and adding all three gives trQ=1+2cosθ, which fixes the angle up to sign.
The Householder preset shows the determinant −1 case: eigenvalue −1 along the normal (1,1,1), which is reversed, and eigenvalue 1 twice on the plane x+y+z=0, which is fixed. A pure reflection across a plane.
Perpendicular but Not Unit
The matrix (111−1) has perpendicular columns of length 2: QTQ=2I, not I. The frozen picture below shows the diagnosis and the fix, each column divided by 2.
The normalized matrix is the reflection preset.
Perpendicular, not unit, frozen
Columns (1, 1) and (1, −1) are perpendicular but of length √2, so QᵀQ = 2I. Dividing each column by √2 gives an orthogonal matrix - the reflection preset.
This is the most common way to be almost orthogonal, and the easiest to repair: Gram–Schmidt's final step is exactly this normalization. The scaled-rotation preset is the same situation, QTQ=4I with columns of length 2, and dividing by 2 recovers the rotation.
Columns that are not perpendicular, as in the shear preset, cannot be repaired by rescaling. Gram–Schmidt would produce an orthonormal basis of the same column space, but the result is a different matrix, and the original was simply not orthogonal.
Reading the Scene Player
Each scene shows the matrices for one check with the arithmetic in the caption.
• In QTQ and QQT the diagonal is the target when the product is the identity; entries that spoil it are muted • The test vectors and their images share colours: x and Qx accent, y and Qy secondary • In the determinant scene the matrix is drawn between bars, with the diagonal accent for +1 and muted for −1 • The classification scene colours the whole matrix accent for a rotation and secondary for a reflection • Entries are shown to four decimals since rotations involve sines and cosines
Choosing a Matrix
The eight presets each make a different point.
• Rotation 30° — (cos30°sin30°−sin30°cos30°), determinant +1, angle read from the first column • Reflection — 21(111−1), determinant −1, the mirror at 22.5° • Permutation — cyclic shift of coordinates; a rotation by 120° about (1,1,1) • Householder — I−32uuT with u=(1,1,1); a reflection of space across the plane x+y+z=0 • Rotation about z — 90° about the z-axis; the axis is found as the null space of Q−I • Orthogonal, not unit — (111−1); the columns are perpendicular but of length 2, and the tool shows the normalized version • Scaled rotation — twice a 45° rotation; angles are kept but lengths double, and QTQ=4I • Shear — columns not perpendicular; no rescaling helps
Shuffle produces a random rotation or reflection by multiples of 30°, combined with a signed permutation in 3D.
What an Orthogonal Matrix Is
A square matrix Q is orthogonal when its columns q1,…,qn are orthonormal: qi⋅qj=1 if i=j and 0 otherwise. Since entry (i,j) of QTQ is exactly qi⋅qj, the condition is the single equation
QTQ=I
For a square matrix a one-sided inverse is the inverse, so Q−1=QT and also QQT=I, which says the rows are orthonormal too. Taking determinants, (detQ)2=1, so detQ=±1.
The geometric content is that Q preserves the dot product: (Qx)⋅(Qy)=xTQTQy=x⋅y. Lengths and angles are dot products, so Q moves every figure rigidly, without stretching or distorting; it is an isometry fixing the origin. Conversely every linear isometry is orthogonal.
In the plane there are two kinds. Determinant +1 gives a rotation (cosθsinθ−sinθcosθ); determinant −1 gives a reflection (cos2φsin2φsin2φ−cos2φ) across the line at angle φ. In space, determinant +1 is a rotation about an axis, the direction u with Qu=u, by an angle with trQ=1+2cosθ; determinant −1 is a reflection across a plane, possibly combined with a rotation about the plane's normal.
Orthogonal matrices are closed under multiplication and inversion, forming the orthogonal group, and they are the reason so much of linear algebra is numerically safe: a change of basis by an orthogonal matrix amplifies no error. The spectral decomposition, QR and the SVD are all built from them. For the theory, see the orthogonal sets page and the geometric transformations page.
Key Properties
Facts that hold for every orthogonal matrix Q.
• QTQ=QQT=I and Q−1=QT; both columns and rows are orthonormal • detQ=±1: rotation or reflection • Isometry: ∥Qx∥=∥x∥, (Qx)⋅(Qy)=x⋅y, angles preserved • Eigenvalues have modulus 1: real ones are ±1, the rest are conjugate pairs e±iθ • Group: products and inverses of orthogonal matrices are orthogonal; QT and Q−1 are orthogonal • Condition number 1: the best possible; solving Qx=b is a transpose • Every orthonormal basis is the column set of an orthogonal matrix, and changing to it is a rigid motion • Symmetric orthogonal matrices are reflections: Q2=I, eigenvalues ±1 • Permutation matrices and ±1 diagonal matrices are orthogonal • Unitary matrices are the complex counterpart, with Q∗Q=I
Why It Matters
Orthogonal matrices are the rigid motions, and the tools of numerical linear algebra.
• Geometry and graphics: rotations of objects, cameras and coordinate frames are orthogonal matrices, composed by multiplication and undone by transposition • Numerical stability: QR factorization, Householder and Givens methods, the QR algorithm for eigenvalues and the SVD all work by orthogonal transformations because they never amplify rounding error • Spectral decomposition: a symmetric matrix is QΛQT; the change to its eigenvector basis is orthogonal • Least squares: with orthonormal columns the normal equations reduce to x^=QTb • Signal processing: the discrete Fourier, cosine and wavelet transforms are orthogonal (or unitary), which is why they preserve energy and invert by transposition • Statistics: orthogonal rotations of factor loadings, and orthogonal designs • Physics and robotics: rotation groups SO(2) and SO(3), Euler angles, and the axis–angle form read from the trace
Test.QTQ has diagonal entries cos230°+sin230°=1 and off-diagonal entries −cos30°sin30°+sin30°cos30°=0: the identity. Orthogonal.
Determinant.cos230°+sin230°=1: a rotation.
Lengths. For x=(2,1), Qx=(1.232,1.866) and ∥Qx∥2=1.518+3.482=5=∥x∥2. For y=(1,0), Qy=(0.866,0.5), and (Qx)⋅(Qy)=1.067+0.933=2=x⋅y.
Inverse.QT=(0.866−0.50.50.866) is the rotation by −30°, and QQT=I.
Classify.cosθ=0.866 and sinθ=0.5 give θ=30°. The eigenvalues are e±i30°, complex, so no real direction is fixed.
For contrast, the reflection preset 21(111−1) also passes the test but has determinant −1; with cos2φ=sin2φ=1/2 the mirror is at φ=22.5°, and the direction (cos22.5°,sin22.5°) is fixed while its perpendicular is reversed.
Common Mistakes
A few mistakes recur.
• Perpendicular columns without unit length — (111−1) has orthogonal columns but is not an orthogonal matrix; the name refers to orthonormal columns • Checking only detQ=±1 — many non-orthogonal matrices have determinant ±1, such as a shear; the test is QTQ=I • Reading a reflection as a rotation — both preserve lengths; only the sign of the determinant tells them apart • Confusing the rotation angle with the eigenvalue argument in 3D — the angle comes from trQ=1+2cosθ, not from any single entry • Assuming QT=Q — only symmetric orthogonal matrices, the reflections, satisfy this; a rotation's transpose is the opposite rotation • Non-square matrices with orthonormal columns — they satisfy QTQ=I but not QQT=I, and are not called orthogonal matrices • Expecting real eigenvectors — a rotation of the plane by anything but 0° or 180° has none
Related Concepts
Gram–Schmidt — how to manufacture an orthogonal matrix from any independent set of columns.
QR decomposition — A=QR with Q orthogonal; the tool for least squares and the eigenvalue algorithm.