3.3 Orthogonal matrices, rotations and reflections
The matrices that never stretch anything are exactly those whose columns are orthonormal. In the plane they are rotations and reflections; in space every rotation turns about a fixed axis. Their inverse is free, which is why computers love them.
Apostol, not taughtBeyond the courseApostol 5.10Strang, Introduction to Linear Algebra, 4.4Axler 7C (isometries)
A general matrix stretches some directions and squashes others. This chapter studies the matrices that do neither: they move vectors around without changing any length or any angle. In the plane those are rotations and reflections. In space they include every way of turning a rigid object. They have one more property that makes them precious in computing: their inverse is their transpose, so undoing them costs nothing and loses no accuracy.
Before you start
Chapter 2.9 (orthonormal sets, norms) and 3.1 (where Q in A=QΛQT already had orthonormal columns).
Quick checkFor orthonormal vectors q1,q2, what is q1⋅q2 and q1⋅q1?
Orthonormal: perpendicular to each other (dot product 0) and of length 1 (dot product with itself 1).Review: orthonormal sets
Quick checkWhat is det(AB)?
The product rule for determinants (2.7). It will show that an orthogonal matrix has determinant ±1.Review: the product rule
The picture
Watch the orange unit square: under “Rotate 90°” and “Reflect” it stays a unit square, only turned or flipped. The grid stays square too. Now try “Shear” or “Stretch”: squares become parallelograms or rectangles, so lengths or angles change. The maps that keep the grid square are this chapter’s subject.
Where this came from· Rotations, from Euler to the Apollo guidance computer
Leonhard Euler presented a paper to the St. Petersburg Academy in 1775 (printed in 1776) showing that any turning of a rigid body about a fixed point is a rotation about a single axis: a ball turned any way keeps two opposite points where they were. He wanted a way to describe the motion of rigid bodies with a few numbers. In 1843 William Rowan Hamilton found the quaternions, which describe 3D rotations compactly. In 1846 Arthur Cayley published a formula that builds an orthogonal matrix from an antisymmetric one. The idea outlived them. The Apollo guidance computer stored the orientation of its inertial platform as a 3 by 3 matrix of this kind (called REFSMMAT), and Apollo documents describe an orthogonalization step when computing it. Any program that multiplies many rotation matrices must restore orthogonality now and then, because rounding errors slowly turn a rotation into a slight stretch.
Definitions and theorems
Definition A
Orthogonal matrix
A real n×n matrix Q is orthogonal if its columns form an orthonormal basis of Rn. Equivalently, QTQ=I, because entry (i,j) of QTQ is the dot product of column i with column j. Then Q−1=QT, and so also QQT=I: the rows are orthonormal too.
In one lineA square real matrix whose columns are orthonormal; equivalently QTQ=I, so Q−1=QT.
Why it existsThese are exactly the matrices that preserve length, and their inverse costs nothing to compute.
Watch out· The name is misleading
An “orthogonal matrix” has orthonormal columns, not only perpendicular ones. [2003] has perpendicular columns but is not orthogonal. The name is historical and every textbook uses it.
Definition B
Isometry
A linear map Q:Rn→Rn is an isometry if ∥Qx∥=∥x∥ for every x.
In one lineA linear map that preserves length: ∥Qx∥=∥x∥ for every x.
Why it existsIt is the precise meaning of 'moves things without distorting them'.
Theorem AApostol 5.10; Axler 7.42
Orthogonal means length-preserving
For a real n×n matrix Q, the following are equivalent:
QTQ=I.
(Qx)⋅(Qy)=x⋅y for all x,y (dot products, hence angles, are preserved).
∥Qx∥=∥x∥ for all x (lengths are preserved).
In one lineFor a square real matrix Q, these are equivalent: QᵀQ = I; Q preserves dot products; Q preserves lengths.
Why it is trueDot products and lengths determine each other (polarization), and QᵀQ = I is exactly 'dot products survive'.
ProofAxler 7.42
The idea: 1 ⇒ 2 by moving Qᵀ across. 2 ⇒ 3 by taking x = y. 3 ⇒ 2 by the polarization identity, which recovers dot products from lengths. 2 ⇒ 1 by testing on standard basis vectors.
(1 ⇒ 2) If QTQ=I then (Qx)⋅(Qy)=xTIy=x⋅y.
(Qx)⋅(Qy)=(Qx)TQy=xTQTQy.
(2 ⇒ 3) Take y=x: ∥Qx∥2=∥x∥2.
A length is the square root of a dot product with itself.
(3 ⇒ 2) x⋅y=21(∥x+y∥2−∥x∥2−∥y∥2). Apply it to Qx,Qy, use Q(x+y)=Qx+Qy, and each length on the right is unchanged by Q.
Expand ∥x+y∥2=∥x∥2+2x⋅y+∥y∥2 and solve for x⋅y: the polarization identity.
(2 ⇒ 1) (QTQ)ij=(Qei)⋅(Qej)=ei⋅ej, which is 1 if i=j and 0 otherwise. So QTQ=I. ■
Entry (i,j) of QTQ is (Qei)⋅(Qej), which by 2 equals ei⋅ej.
Theorem Astandard
Determinant of an orthogonal matrix
If Q is orthogonal, detQ=±1. Orthogonal matrices with detQ=1 are called rotations (or proper orthogonal); those with detQ=−1 reverse orientation.
In one lineAn orthogonal matrix has determinant +1 (a rotation) or −1 (it includes a reflection).
Why it is truedet(QᵀQ) = det(Q)² = det I = 1.
Proofstandard
The idea: Take determinants of QᵀQ = I.
1=detI=det(QTQ)=detQTdetQ=(detQ)2.
Product rule (2.7), and detQT=detQ (2.7).
So detQ=±1. ■ In the picture: area is unchanged (∣det∣=1), and the sign says whether the square was flipped.
A real number whose square is 1.
Worked example
Prove: the product PQ of two orthogonal matrices is orthogonal, and so is Q−1.
Solution.
State what must be shown. We need (PQ)T(PQ)=I. That is the definition of orthogonal.
Reverse the transpose of a product.(PQ)T(PQ)=QTPTPQ. The transpose of a product reverses the order (2.5).
Cancel from the middle.PTP=I, so this is QTQ=I. Both P and Q are orthogonal. The inner pair collapses first, then the outer pair.
Inverse.Q−1=QT, and (QT)TQT=QQT=I. We showed QQT=I in the definition (rows are orthonormal too).
Answer. Both are orthogonal. ■ Geometric meaning: two length-preserving moves in a row preserve length, and so does undoing one.
Worked example
Prove: an orthogonal Q sends an orthonormal basis u1,…,un to an orthonormal basis.
Solution.
Compute the dot products of the images.(Qui)⋅(Quj)=ui⋅uj. Orthogonal matrices preserve dot products (the theorem above).
Read off. That equals 1 when i=j and 0 when i=j. The ui are orthonormal.
Count. The n vectors Qui are orthonormal, so independent (2.9), and n independent vectors in Rn form a basis (2.2). Orthonormal sets are independent, and a basis needs exactly n vectors.
Answer.Qu1,…,Qun is an orthonormal basis. ■ Example: the standard basis goes to the columns of Q.
The plane: every orthogonal matrix is a rotation or a reflection
Definition A
Rotation matrix
The rotation matrix by angle θ is Rθ=[cosθsinθ−sinθcosθ]. Its first column is ^ turned by θ, and its second is ^ turned by θ.
In one lineRθ=[cosθsinθ−sinθcosθ] turns the plane counterclockwise by θ.
Why it existsIts columns are where the two axis arrows land after turning by θ.
Theorem Astandard
Orthogonal 2 by 2 matrices
Every 2×2 orthogonal matrix is either Rθ=[cosθsinθ−sinθcosθ] (determinant 1) or [cosθsinθsinθ−cosθ] (determinant −1), which reflects across the line at angle θ/2.
In one lineEvery 2×2 orthogonal matrix is a rotation R_θ (det 1) or a reflection across a line (det −1).
Why it is trueThe first column is a unit vector at some angle θ; the second must be a unit vector perpendicular to it, and there are only two choices.
Proofstandard
The idea: Column 1 is a unit vector, so it is (cos θ, sin θ) for some θ. Column 2 is a unit vector perpendicular to it: only ±(−sin θ, cos θ).
The first column is (cosθ,sinθ) for some θ.
A unit vector in the plane lies on the unit circle, so it has this form for some angle θ.
The second column is a unit vector perpendicular to it, so it is (−sinθ,cosθ) or (sinθ,−cosθ).
The vectors perpendicular to (a,b) are the multiples of (−b,a); length 1 leaves two choices.
The first choice gives Rθ with determinant cos2θ+sin2θ=1; the second gives determinant −1. ■
Compute the two determinants.
Worked example
Is Q=131[51212−5] orthogonal? If so, is it a rotation or a reflection, and across which line?
Solution.
Test the columns. Column 1 is 131(5,12) with squared length 16925+144=1. Column 2 is 131(12,−5) with squared length 169144+25=1. Their dot product is 16960−60=0. Orthonormal columns are the definition. Unit length and perpendicular are two separate checks, and both are needed.
Find the determinant.detQ=169−25−144=−1. +1 means a rotation, −1 means a reflection (the plane theorem).
Match the reflection form.cosθ=135 and sinθ=1312, so θ≈67.4°. Compare with [cosθsinθsinθ−cosθ].
Find the mirror. It is the line at angle 2θ≈33.7°, which has slope tan2θ=1+cosθsinθ=18/1312/13=32, so direction (3,2). Check: Q(3,2)=131(15+24,36−10)=(3,2), so the mirror line is fixed.
Answer. Orthogonal, determinant −1: a reflection across the line through (3,2).
Worked example
Show RαRβ=Rα+β, and explain what that says about trigonometry.
Compare with Rα+β. Turning by β then by α is turning by α+β, so the product must equal [cos(α+β)sin(α+β)−sin(α+β)cos(α+β)]. Composition of maps is multiplication of their matrices (2.5).
Read off the entries.cos(α+β)=cosαcosβ−sinαsinβ and sin(α+β)=sinαcosβ+cosαsinβ. Equal matrices have equal entries.
Answer. The addition formulas you memorised in school are the statement “two rotations make a rotation”, read entry by entry. Rotations of the plane also commute: RαRβ=RβRα.
Your answerRotate the vector (3,4) by 90° counterclockwise. What is the first coordinate of the result?
Use cos90°=0 and sin90°=1 in Rθ.
R90°=[01−10] sends (3,4) to (−4,3). The length is still 5.
Worked example
Find the inverse of Rθ, and compute R30°−1.
Solution.
Use the transpose.Rθ is orthogonal, so Rθ−1=RθT=[cosθ−sinθsinθcosθ]. For an orthogonal matrix the inverse is the transpose, with no elimination.
Recognize it. Since cos(−θ)=cosθ and sin(−θ)=−sinθ, this is R−θ. Turning back by θ undoes turning forward by θ.
Put in 30°.cos30°=23 and sin30°=21, so R30°−1=[23−212123]. Substitute in the formula of step 1.
Answer.Rθ−1=R−θ=RθT.
Worked example
Write the matrix of the reflection across the line through the origin at angle φ. Then find the reflection across y=x.
Solution.
Set up. Let u=(cosφ,sinφ) be the unit vector along the mirror. A vector x splits as the part along the mirror, (u⋅x)u, plus the part across it, x−(u⋅x)u. The first part is the projection onto the line (2.9).
Flip the cross part. The reflection keeps the first part and negates the second: Fx=(u⋅x)u−(x−(u⋅x)u)=2(u⋅x)u−x. A mirror leaves points on it fixed and sends the perpendicular offset to its negative.
Read off the matrix. Since (u⋅x)u=uuTx, we get F=2uuT−I=[2cos2φ−12sinφcosφ2sinφcosφ2sin2φ−1]=[cos2φsin2φsin2φ−cos2φ]. Double-angle formulas. This is the reflection form of the plane theorem with θ=2φ.
Take y=x. Here φ=45°, so 2φ=90° and F=[0110]. cos90°=0, sin90°=1. Check: it swaps x and y, which is what reflecting across y=x does.
Answer.F=[cos2φsin2φsin2φ−cos2φ]; for y=x it is [0110] with determinant −1.
Your answerReflect the point (2,5) across the line y=x. What is the first coordinate of the result?
Reflecting across y=x swaps x and y.
The reflection across y=x is [0110], which swaps the coordinates and sends (2,5) to (5,2).
Quick checkIs [0.60.80.8−0.6] a rotation or a reflection?
The columns have length 0.36+0.64=1 and dot product 0.48−0.48=0, so it is orthogonal. The determinant is −1, so it reverses orientation. Rotations have the form [cs−sc], with the minus sign in the top right.
Space: every rotation has an axis
Theorem BEuler 1775; standard
Euler's rotation theorem
If Q is a 3×3 orthogonal matrix with detQ=1, then Qv=v for some v=O. So Q is a rotation about the axis through v.
In one lineEvery 3×3 rotation (orthogonal, det 1) fixes a line through the origin: it is a turn about an axis.
Why it is truedet(Q − I) = 0 for a 3×3 rotation, so 1 is an eigenvalue; its eigenvector is the axis.
Proofstandard
The idea: Show det(Q − I) = 0 using QᵀQ = I, det Q = 1 and the fact that for 3×3 matrices det(−A) = −det A.
Q−I=Q−QQT=Q(I−QT).
Write I=QQT (rows of an orthogonal matrix are orthonormal too), then factor Q out on the left.
det(Q−I)=detQ⋅det(I−QT)=det(I−Q).
Product rule, detQ=1, and det(I−QT)=det((I−Q)T)=det(I−Q).
det(I−Q)=det(−(Q−I))=−det(Q−I).
For a 3×3 matrix, multiplying every row by −1 multiplies the determinant by (−1)3=−1.
So det(Q−I)=−det(Q−I), hence det(Q−I)=0.
A number equal to its own negative is 0.
There is v=O with (Q−I)v=O, that is, Qv=v. ■
Q−I is not invertible, so it has a non-zero null vector (2.6).
Proof workshopRebuild the proof of Euler's rotation theorem
Tap the lines in the order a proof would write them. Each line can only use what is already above it.
Replace I by QQT, which equals I because the rows of an orthogonal matrix are orthonormal, and factor Q out.
Product rule, detQ=1, and a matrix has the same determinant as its transpose.
This uses the factored form, so factor first.
Multiplying all three rows by −1 multiplies the determinant by (−1)3.
You need det(I−Q) to appear before you can rewrite it.
A number equal to its own negative is zero.
This conclusion needs both expressions for det(I−Q) above.
A square matrix with determinant 0 is not invertible, so its null space contains more than the zero vector.
This needs the determinant to be 0 first.
Beyond the course: for understanding· Why only odd dimensions
The proof used (−1)3=−1. In even dimensions it fails: R90° in the plane fixes no direction. In R4 a rotation can turn two perpendicular planes at once and fix nothing.
Worked example Spagnolie Lecture 8
Find the axis and angle of the rotation Q that sends (x,y,z) to (z,x,y).
Solution. Step through it below. The stages are: confirm it is a rotation, find the axis, find the angle from the trace, solve.
Answer. A rotation by 120° about the line through (1,1,1).
Your answerA 3×3 rotation matrix has trace 2. By what angle in degrees (between 0 and 180) does it turn?
Use trQ=1+2cosθ.
trQ=1+2cosθ=2, so cosθ=21 and θ=60°.
Worked example classic
Let P=010100001 (swap x and y). It has detP=−1. Write it as a rotation followed by x↦−x, and find an eigenvalue −1 eigenvector.
Solution.
Check orthogonal. The columns are the standard basis vectors in a different order, so PTP=I. Orthonormal columns.
Negate it.−P is orthogonal too, and det(−P)=(−1)3detP=(−1)(−1)=1. Negating all three columns multiplies the determinant by (−1)3. Now −P is a rotation.
Apply Euler. There is v=O with (−P)v=v. Solving, Pv=−v gives v=(1,−1,0): P(1,−1,0)=(−1,1,0)=−v. Euler’s theorem gives an axis for the rotation −P, and that axis is a −1-eigenvector of P.
Find the angle.tr(−P)=−1=1+2cosθ, so θ=180°. Trace formula for rotations.
Answer.P=−R where R=−P is a half-turn about (1,−1,0), and −1 is an eigenvalue of P with eigenvector (1,−1,0). ■
Complex version and eigenvalues
Definition A
Unitary matrix
A complex n×n matrix U is unitary if U∗U=I, where U∗=UT. Real unitary matrices are exactly the orthogonal ones.
In one lineA complex square matrix with U∗U=I (conjugate transpose); the complex version of orthogonal.
Why it existsIt preserves complex lengths, and it is how quantum states evolve.
Theorem AApostol 5.10
Eigenvalues of an orthogonal matrix
If Q is unitary (in particular real orthogonal) and Qv=λv with v=O, then ∣λ∣=1.
In one lineEvery eigenvalue of an orthogonal (or unitary) matrix has absolute value 1.
Why it is trueQ preserves length, so Qv = λv forces |λ| = 1.
ProofApostol 5.10
The idea: Length is preserved: ‖v‖ = ‖Qv‖ = ‖λv‖ = |λ|‖v‖.
∥v∥=∥Qv∥.
Unitary matrices preserve length: with the complex inner product of 3.1, ∥Uv∥2=(Uv,Uv)=(v,U∗Uv)=(v,v) by the adjoint property and U∗U=I.
∥Qv∥=∥λv∥=∣λ∣∥v∥.
Qv=λv, and a scalar comes out of a length with its absolute value: ∥λv∥2=λλˉ(v,v)=∣λ∣2∥v∥2.
∣λ∣=1. ■ For Rθ the eigenvalues are e±iθ, on the unit circle (0.6).
Combining the two lines gives ∥v∥=∣λ∣∥v∥, and ∥v∥=0, so divide.
Worked example
Find the eigenvalues of Rθ and check they have absolute value 1. For which θ is an eigenvalue real?
Solution.
Characteristic polynomial.det(Rθ−λI)=(cosθ−λ)2+sin2θ=λ2−2cosθλ+1. Determinant of [cosθ−λsinθ−sinθcosθ−λ], using cos2θ+sin2θ=1.
Solve.λ=cosθ±cos2θ−1=cosθ±isinθ=e±iθ. Quadratic formula, and cos2θ−1=−sin2θ. Euler’s formula from 0.6.
Absolute value.∣cosθ±isinθ∣=cos2θ+sin2θ=1. Matches the theorem.
Real cases. The eigenvalues are real only when sinθ=0: θ=0 gives 1,1 and θ=π gives −1,−1. Otherwise no direction of the plane stays on its own line, as the picture at the top shows for 90°.
Answer.λ=e±iθ, on the unit circle.
Quick checkA 3×3 matrix is orthogonal with determinant −1. Which is guaranteed?
−Q is a rotation, so by Euler's theorem it fixes a direction v, and then Qv=−v. A matrix with determinant −1 is not a rotation. The other two eigenvalues can be a complex pair e±iθ.
Quick checkWhich of these could be an eigenvalue of a real orthogonal matrix?
Eigenvalues of orthogonal matrices have absolute value 1. −1 occurs for a reflection (the direction across the mirror flips). 2 or 21 would mean some direction is stretched or shrunk.
Your answerWhat is the determinant of the reflection [cosθsinθsinθ−cosθ]?
−cos2θ−sin2θ=−1. Reflections reverse orientation.
Proof workshopRebuild: an orthogonal matrix preserves lengthsAxler 7.42
Tap the lines in the order a proof would write them. Each line can only use what is already above it.
A squared length is a dot product with itself.
Write the dot product as a matrix product and transpose the product.
First express the length as a dot product.
QTQ=I.
You need QTQ to appear before you can replace it by I.
Where it is used
Used inside maths· Inside maths: the SVD and QR
Chapter 3.4 writes every matrix as UΣVT: rotate, stretch along axes, rotate, with U,V orthogonal. The QR factorisation A=QR (2.10) is Gram–Schmidt in matrix form, with Q orthogonal.
Used in the real world· Numerical computing: why orthogonal matrices are numerically safe
Multiplying by an orthogonal matrix cannot magnify errors, because it preserves lengths: an error vector of size 10−16 stays size 10−16. That is why reliable algorithms (QR for least squares, the eigenvalue algorithms inside NumPy and MATLAB) are built from sequences of rotations and reflections (Givens rotations and Householder reflections) rather than general row operations.
Used in the real world· Graphics and robotics: orientation
A robot arm’s pose is a chain of joint rotations, each a rotation matrix about the joint’s axis; multiplying them gives the hand’s orientation (forward kinematics). Game engines store orientations as quaternions and convert to rotation matrices for drawing; interpolating between two orientations smoothly (“slerp”) follows the shortest arc on the space of rotations. Because rounding slowly destroys orthogonality, a program that multiplies many rotations re-orthonormalises (for example with a Gram–Schmidt step) from time to time.
Traps
Watch out· Orthogonal columns are not enough
The columns must also have length 1. Check QTQ=I, not only that the columns are perpendicular.
Watch out· 3D rotations do not commute
RαRβ=RβRα in the plane, but in space two quarter-turns about different axes give different results in different orders (Spagnolie’s Lecture 8, chapter 2.4).
Problems
check
Is 51[34−43] orthogonal? A rotation or a reflection? By what angle?
Solution
Columns (53,54) and (−54,53) are unit and perpendicular, so yes. Determinant 259+16=1: a rotation, by θ with cosθ=53, sinθ=54, about 53.13°.
check
What is the inverse of Rθ? Check with RθT.
Solution
R−θ, turning back. RθT=[cosθ−sinθsinθcosθ]=R−θ, using cos(−θ)=cosθ, sin(−θ)=−sinθ.
use
Find the axis and angle of the rotation Q=1000010−10 (Spagnolie’s T from Lecture 8).
Solution
Q(1,0,0)=(1,0,0), so the axis is the x-axis. trQ=1=1+2cosθ gives cosθ=0, θ=90°.
use
Write the matrix of reflection across the line y=3x and check it fits the theorem on 2×2 orthogonal matrices.
Solution
The line is at angle φ=60°, so θ=2φ=120° and the matrix is [cos120°sin120°sin120°−cos120°]=[−21232321]. Determinant −41−43=−1. Check: it fixes (1,3), since −21+23=1 and 23+23=3.
prove
Prove that the product of two orthogonal matrices is orthogonal, and the inverse of an orthogonal matrix is orthogonal.
Solution
(PQ)T(PQ)=QTPTPQ=QTQ=I. For the inverse: Q−1=QT and (QT)TQT=QQT=I. (So the orthogonal matrices are closed under products and inverses, and contain I: they form a group.)
prove
Prove that an orthogonal matrix maps an orthonormal basis to an orthonormal basis.
Solution
If (ui) is orthonormal, (Qui)⋅(Quj)=ui⋅uj (dot products preserved), so the images are orthonormal; n orthonormal vectors in Rn form a basis.
stretchclassic
Show that every 3×3 orthogonal matrix with determinant −1 is a rotation followed by the reflection x↦−x. Conclude that −1 is always one of its eigenvalues.
Solution
−Q is orthogonal with det(−Q)=(−1)3detQ=1, so −Q=R is a rotation and Q=−R. By Euler’s theorem Rv=v for some v=O, so Qv=−v: −1 is an eigenvalue.
MATH 375: Spagnolie's Lecture 8 composed two 90° rotations about different axes and got different answers in the two orders. Those were orthogonal matrices; this chapter explains what all such matrices look like.
JEE / CBSE: Rotating axes in coordinate geometry used $x' = x\cos\theta + y\sin\theta$. That substitution is multiplication by a rotation matrix.
Graphics and robotics: Every camera orientation, robot-arm joint and game-character pose is stored as a rotation matrix or a quaternion.