Linear Algebra · Theory · M4
M4-T2 — Orthogonal and Orthonormal Bases
In an orthonormal basis, finding coordinates needs no equation solving at all: each coordinate is a single dot product.
In the basis lesson you solved a linear system to find coordinates. If the basis vectors are perpendicular unit vectors, that work disappears: coordinates are just dot products, lengths are preserved, and errors do not blow up. That is why every robot frame is chosen to be orthonormal.
Learning objectives
After this lesson, you should be able to:
- Define an orthonormal basis and compute coordinates of a vector in it with dot products.
- Derive the coordinate formula ci = qi · v and the length identity ‖v‖² = Σ ci².
- Write the basis as the columns of a matrix Q and show QᵀQ = I.
- Explain why orthonormal bases are numerically ideal and where robots use them.
Introduction and motivation
A robot's forward, left and up axes are perpendicular unit vectors. The principal axes of a point cloud are perpendicular unit vectors. Every time you convert a measurement between such frames, you do it with dot products, not with a solver. This lesson explains why: an orthonormal basis is the one coordinate system in which the answer to “how much of v lies along this axis?” is a single multiplication and addition, and in which errors stay the size they started.
The intuition
A basis is orthogonal if its vectors are mutually perpendicular and orthonormal if, in addition, each has length 1. Like the ordinary x, y, z axes, but possibly rotated.
To find how far a vector reaches along a basis direction, shine a light perpendicular to that direction: the shadow length is the coordinate. With unit basis vectors the shadow is exactly the dot product, and because the axes are perpendicular, the coordinates do not interfere with each other.
Interactive figure. Two basis vectors b1 and b2 and a vector v with a skewed grid built from the basis. When the basis is orthonormal the grid is a rotated square grid and the coordinates are dot products. This figure needs JavaScript to be interactive.
Geometric and physical interpretation
Geometric view. An orthonormal basis is a rotated (possibly reflected) copy of the standard axes. Using it changes how you describe a vector but not its length or the angles between vectors: only the point of view has turned. Physical view. A robot frame with forward, left and up axes is an orthonormal basis. The components of a velocity along them are its forward speed, lateral slip and vertical rate; the squared components add up to the squared speed, so energy-like quantities are the same in either description.
The mathematics
- q₁, …, qn
- an orthonormal basis: qi · qj = 0 for i ≠ j and qi · qi = 1.
- Q
- the matrix whose columns are q₁, …, qn.
- ci
- the coordinate of v along qi.
Orthonormal means this
qi · qj = 0 (i ≠ j), qi · qi = 1 ⇔ Qᵀ Q = I
What it means. Perpendicular, unit-length columns. Stacking the pairwise dot products into a matrix, QᵀQ has the dot product qi·qj in entry (i, j): that is the identity matrix exactly when the basis is orthonormal.
Coordinates are dot products
v = c1 q1 + ... + cn qn, ci = qi · v i.e. c = Qᵀ v
What it means. No equation solving is needed: each coordinate is the shadow of v on one basis vector. In matrix form the coordinate vector is just Qᵀv, because Q⁻¹ = Qᵀ.
Lengths are preserved
‖v‖² = c1² + c2² + ... + cn² (Parseval)
What it means. The squared length of v equals the sum of the squared coordinates in any orthonormal basis: changing from one orthonormal basis to another cannot change a length.
Orthonormal basis: coordinates are dot products, c = Qᵀv, the inverse is the transpose, and lengths are preserved.
Step-by-step derivation: coordinates as dot products, and Parseval
Let q₁, …, qn be an orthonormal basis and write v = c₁q₁ + … + cnqn (such coordinates exist because a basis spans).
- Dot both sides with
qj:qj·v = c₁(qj·q₁) + … + cn(qj·qn). - By orthonormality every dot product
qj·qiis 0 for i ≠ j and 1 for i = j. All terms vanish exceptcj. - Therefore
cj = qj·v. No system of equations was solved.
The matrix form. Collect the basis as the columns of Q. Then v = Q c. The entry (i, j) of QᵀQ is qi·qj, which is 1 on the diagonal and 0 elsewhere, so QᵀQ = I. Multiplying v = Qc by Qᵀ gives Qᵀv = QᵀQ c = c: the coordinates are c = Qᵀv, confirming Q⁻¹ = Qᵀ for a square Q.
Parseval. Compute the squared length using the expansion:
‖v‖² = v·v = (Σi ci qi)·(Σj cj qj) = Σi Σj ci cj (qi·qj) = Σi ci²
What it means. Only the terms with i = j survive, each contributing ci² times 1. The cross terms vanish because the basis vectors are orthogonal.
Equivalently, for a square Q: ‖c‖² = cᵀc = (Qᵀv)ᵀ(Qᵀv) = vᵀQQᵀv = vᵀv = ‖v‖², because QQᵀ = I for a square orthonormal Q. The coordinate vector has the same length as v.
A worked example: a rotated orthonormal basis
Let q₁ = (0.6, 0.8) and q₂ = (−0.8, 0.6), and v = (2, 1).
- Orthonormal?
q₁·q₁ = 0.36 + 0.64 = 1,q₂·q₂ = 0.64 + 0.36 = 1,q₁·q₂ = −0.48 + 0.48 = 0. ✓ - Coordinates.
c₁ = q₁·v = 1.2 + 0.8 = 2andc₂ = q₂·v = −1.6 + 0.6 = −1. - Rebuild.
2 q₁ − q₂ = (1.2 + 0.8, 1.6 − 0.6) = (2, 1) = v. ✓ - Parseval.
‖v‖² = 4 + 1 = 5andc₁² + c₂² = 4 + 1 = 5. ✓ The lengths agree. - Matrix form.
Q = [[0.6, −0.8], [0.8, 0.6]]andQᵀQ = I;Qᵀv = (0.6·2 + 0.8·1, −0.8·2 + 0.6·1) = (2, −1).
Contrast with a skewed basis. For b₁ = (1, 1), b₂ = (−1, 2) (the earlier lesson) the coordinates of (3, 0) were (2, −1) but required solving a system, and the dot products b₁·v = 3 and b₂·v = −3 are not the coordinates.
Robotics application
Robot frames. A frame's three axes form an orthonormal basis, so converting a velocity or point into the frame is multiplication by Qᵀ (Module 7: a rotation matrix). That is why the inverse of a rotation is cheap: it is the transpose.
Principal axes. The directions of greatest and least spread of a point cloud, found with PCA (Module 6), are orthonormal. Expressing the cloud in them removes correlations and makes a flat object (a wall, the ground) one coordinate thin.
Numerical stability. Computations in an orthonormal basis do not magnify errors: ‖Qx‖ = ‖x‖, so any error in x reaches the output at the same size. Algorithms built on orthonormal factors (QR, SVD) are the most reliable in numerical linear algebra, an advantage Module 5 makes concrete.
Sensor fusion. Decomposing an acceleration into components along known orthogonal axes (gravity direction and the horizontal plane) is how attitude is estimated from an accelerometer; see attitude representation and rotation matrices.
Engineering implications and limitations
Practical rules
- Use Qᵀ, not Q⁻¹. For an orthonormal basis the transpose is the exact inverse. Calling a general inverse is slower and less accurate.
- Check orthonormality numerically. After constructing a basis, verify
max|QᵀQ − I|is at the level of machine precision (about 10⁻¹⁵). A value of 10⁻³ means your frame has drifted or been mis-specified. - Normalise first. The dot-product formula assumes unit-length basis vectors. For an orthogonal but unnormalised basis use
ci = (v·bi)/(bi·bi). - Re-orthonormalise after updates. Accumulated rounding degrades orthonormality (see Gram-Schmidt and QR next); do it periodically for integrated rotations.
- Mind handedness. An orthonormal basis can be right- or left-handed; the determinant of Q is +1 or −1. Frames used for rotations must be right-handed (det +1).
Limits
Orthonormal bases are not always available in the coordinates you were given: a camera pixel grid is not square in metres, and a set of joint angles is not an orthonormal basis of hand motion. You then use a general basis and a solve, or convert to an orthonormal one first.
Common misconceptions
“A basis whose vectors are perpendicular is orthonormal.”
Orthogonal is not enough: orthonormal also requires every vector to have length 1. For an orthogonal basis of unequal lengths the coordinate formula needs the division by bi·bi.
“Coordinates are always dot products with the basis vectors.”
Only for an orthonormal basis. For a skewed basis, bi·v is not the coordinate; you must solve B c = v.
“An orthonormal basis changes lengths of vectors because the axes are rotated.”
It cannot: Parseval shows ‖v‖ equals the length of the coordinate vector. The same arrow is just described from a different direction.
“The transpose of a basis matrix is always its inverse.”
Only for orthonormal bases. For a general invertible B, Bᵀ and B⁻¹ are different matrices.
Engineering takeaways
- An orthonormal basis has mutually perpendicular unit vectors: QᵀQ = I.
- Coordinates are dot products, ci = qi·v, or c = Qᵀv in matrix form.
- Parseval: ‖v‖² = Σ ci², so changing orthonormal basis never changes length.
- For a square Q, the inverse is the transpose, the cheapest and most accurate inverse there is.
- Robot frames and principal axes are orthonormal bases, which is why they are used so widely.
References and further reading
Primary papers and authoritative documentation.
- MIT 18.06SC Linear Algebra (OCW): lectures on orthogonal bases and Gram-Schmidt
- Mathematics for Machine Learning: the chapter on analytic geometry: orthonormal bases
- Modern Robotics (Lynch and Park), free preprint: chapter 3: rotation matrices as orthonormal frames
- Immersive Linear Algebra: chapters on the dot product and linear mappings
Knowledge check
Three conceptual questions. Write an answer, then reveal the explanation. Your answers stay in your browser.
Question 1
Show that q₁ = (1/√2)(1, 1) and q₂ = (1/√2)(1, −1) are an orthonormal basis, and find the coordinates of v = (3, 1).
Explanation
q₁·q₁ = (1 + 1)/2 = 1, q₂·q₂ = 1 and q₁·q₂ = (1 − 1)/2 = 0, so the basis is orthonormal. Coordinates are dot products: c₁ = q₁·v = (3 + 1)/√2 = 2√2 ≈ 2.828 and c₂ = q₂·v = (3 − 1)/√2 = √2 ≈ 1.414. Check Parseval: c₁² + c₂² = 8 + 2 = 10 = ‖v‖².
Question 2
An IMU axis frame is slightly mis-specified so that QᵀQ = [[1, 0.02], [0.02, 1]]. Is the frame orthonormal? What is the numerical consequence of treating Qᵀ as the inverse?
Explanation
No: the off-diagonal 0.02 means the two axes are not perpendicular (their cosine is 0.02, about 1.1° off). Using Qᵀ as the inverse then gives coordinates that are wrong at the 2% level: Qᵀ(Qc) = (QᵀQ)c = c + 0.02-type cross terms. Measure max|QᵀQ − I| to detect this, and re-orthonormalise (for example with Gram-Schmidt or the SVD) before using the transpose.
Question 3
Why does the coordinate formula ci = bi·v fail for the basis b₁ = (1, 0), b₂ = (1, 1), and what should you do instead?
Explanation
The basis is not orthogonal (b₁·b₂ = 1 ≠ 0), so dotting v = c₁b₁ + c₂b₂ with bi leaves cross terms such as c₂(b₁·b₂). You must solve the 2 × 2 system B c = v, for example c = B⁻¹v, or first convert the basis to an orthonormal one with Gram-Schmidt.
What’s next
Orthonormal bases make decomposition easy. The next lesson uses this machinery to answer a different question: what is the closest point to a given vector inside a line or plane? That is projection.
Related content
Nothing below is required to finish this lesson.
- BeforeM4-T1: Orthogonal Vectors
Test orthogonality with the dot product, split a vector into orthogonal parts, and use right angles in robot geometry.
Get notified when the next lesson and new labs are released.
One email per new lesson or lab.