Chapter 11: Change of basis
Previous: LA 10 Singular Value Decomposition | LA 00 Course Map | Next: LA 12 Matrix Calculus and Numerical Practice
A vector is a geometric object; its coordinates are only a description of it, relative to a chosen set of axes. Change the axes and the numbers change, but the object does not. The same is true of linear maps. Choosing good axes (a good basis) can turn a hard problem into an easy one. Diagonalization, PCA and every coordinate-frame calculation in robotics are applications of this one idea.
- Find the coordinates of a vector in any basis, and convert back.
- Rewrite a linear map in a new basis using .
- Explain diagonalization as “choosing the eigenvector basis”.
- Convert points and directions between robot coordinate frames, and chain frames.
- Write matrices for linear maps on spaces of polynomials and functions.
You need bases (LA 05 Subspaces Basis and Rank), inverses (LA 03 Matrices as Linear Maps), diagonalization (LA 08 Eigenvalues and Eigenvectors) and orthonormal bases (LA 06 Orthogonality and Least Squares).
11.1 Coordinates depend on the basis
The same arrow, different numbers
When we write , we secretly mean
“3 steps along the first standard axis and 2 along the second”. The numbers are coordinates relative to the standard basis.
Now pick different axes: and . These form a basis of (two independent vectors). The same arrow can be written as
for some unique numbers . Those are the coordinates of in the basis , written .
Finding the new coordinates
Put the new basis vectors as columns of a matrix . Then
so the equation is just , and
Worked example 11.1. , , .
Solve and : adding gives , so , .
So . Check: ✓.
The arrow is the same. Its description changed from to .
A way not to mix up the directions
The two formulas are easy to swap by accident. Test with a basis vector: itself must have new coordinates . And indeed first column of ✓. So takes new coordinates to standard ones.
Orthonormal bases: no inverse needed
If the new basis is orthonormal, is an orthogonal matrix and . Then each new coordinate is a single dot product:
Worked example 11.2. Orthonormal basis , , and :
and . So .
- Find the coordinates of in the basis .
- In the basis , a vector has coordinates . What is it in standard coordinates?
- A vector has coordinates in some basis. What vector is it?
Answers. 1. , : . 2. . 3. The first basis vector.
11.2 The same linear map in a new basis
The question
A matrix describes a linear map in standard coordinates: feed it standard coordinates, get standard coordinates out. What matrix describes the same map if we work in -coordinates throughout?
Follow a vector through
Start with a vector given in -coordinates, . To apply the map:
- Convert to standard coordinates: .
- Apply the map (which we know in standard coordinates): .
- Convert the result back to -coordinates: .
So
Read it right to left: into standard coordinates, apply , back out to -coordinates.
Similar matrices
Two matrices related by (for some invertible ) are called similar. They are the same map seen from different viewpoints. So they share every property that belongs to the map rather than to the description:
| Shared by similar matrices | Why |
|---|---|
| eigenvalues | same stretch factors (chapter 8, exercise C5) |
| determinant | same volume scaling (chapter 7, exercise C2) |
| trace | sum of eigenvalues |
| rank | same number of independent output directions |
What is not shared: the individual entries, and the eigenvectors’ coordinates (they are re-described in the new basis).
11.3 Diagonalization is choosing the right basis
Take the basis of eigenvectors of , so . Then
In the eigenvector basis, the map is diagonal: each coordinate is scaled independently, with no mixing.
That is what diagonalization really means. The matrix was never complicated; it only looked complicated because we were describing it with axes that did not match its natural directions.
Worked example 11.3. with the basis , (its eigenvectors, eigenvalues 3 and 1).
In standard coordinates, the map mixes and . In eigen-coordinates, it is “triple the first coordinate, keep the second”.
Worked example 11.4 (a non-eigen basis, for contrast). Same , but with basis , :
Not diagonal, but it is still the same map: trace ✓, determinant ✓, eigenvalues ✓.
11.4 Coordinate frames in robotics
Frames
A robot uses many coordinate frames: the world frame, the robot base, each link, the camera, the gripper, the object. The same physical point has different coordinates in each.
Writing the frame next to every quantity prevents most bugs. Notation: means “point described in frame ”.
Rotations between frames
A rotation matrix is built so that its columns are the axes of frame , written in frame . Then
This is exactly from section 11.1: frame ‘s axes play the role of the new basis.
Because rotation matrices are orthogonal, going the other way is free:
Chaining frames
To go from frame to frame via frame :
The inner labels cancel, like fractions: . If adjacent labels do not match, the product is a bug.
Worked example 11.5
A camera is mounted rotated counterclockwise relative to the world (in 2-D). The camera sees an object at : two units straight ahead along the camera’s own -axis. Where is it in the world?
The camera’s -axis, written in world coordinates, is ; its -axis is . So
“Straight ahead of the camera” is “north” in the world, because the camera faces north.
Adding translation: homogeneous coordinates
Frames are usually shifted as well as rotated: , where is the position of ‘s origin in . Adding a shift is not linear (chapter 3), but a trick makes it linear: append a 1 to every point and use a (in 3-D) matrix:
Now chaining frames is again matrix multiplication, . This is the language of 02 Geometry and Kinematics.
Points get the shift; directions (velocities, surface normals) do not. In homogeneous coordinates, append 1 to a point and 0 to a direction: the 0 automatically removes the shift.
11.5 Why change basis at all?
| Purpose | Chosen basis | Effect |
|---|---|---|
| decouple a dynamical system | eigenvectors | becomes separate scalar equations |
| remove correlation | eigenvectors of the covariance | variables become uncorrelated: PCA |
| compress signals | Fourier or wavelet basis | smooth signals need few coefficients (JPEG, MP3) |
| simplify a task description | gripper or object frame | ”move forward 5 cm” is one coordinate |
| numerical stability | orthonormal basis | no amplification of errors |
11.6 Beyond arrows: polynomials and functions
Vectors do not have to be lists of numbers. Anything you can add and scale, with the usual rules, forms a vector space.
Polynomials as vectors
Polynomials of degree at most 2, such as , can be added and scaled, and they form a vector space with basis . The coordinates of in this basis are .
A linear map: differentiation
Differentiation is linear: and . Find its matrix by the chapter 3 recipe: where does each basis vector go?
- , coordinates .
- , coordinates .
- , coordinates .
Write these as columns:
Check. , which is the polynomial . And indeed ✓.
Notice: has a null space (constants differentiate to zero) and is not invertible, matching the fact that you cannot recover the constant term after differentiating. Integration “inverts” it only up to that constant.
Once you choose a basis, every linear map between finite-dimensional spaces becomes a matrix. That is why linear algebra applies to signals, images, functions and quantum states, not just to arrows.
Summary
| Idea | Formula |
|---|---|
| new to standard | |
| standard to new | |
| orthonormal basis | |
| map in new basis | |
| similar matrices | same eigenvalues, det, trace, rank |
| diagonalization | eigenvector basis makes diagonal |
| frames | , , |
Three facts to remember:
- Coordinates describe a vector; they are not the vector.
- : into standard, apply, back out.
- Label every frame; adjacent labels must match before you multiply.
Exercises
Part A: warm-up
A1. Find the coordinates of in the basis .
A2. The orthonormal basis , . Find the coordinates of using dot products.
A3. If and , , what are and ?
A4. Write the matrix of differentiation on polynomials of degree at most 3, in the basis .
A1. and . Subtract: , , .
A2. , .
A3. and .
A4. .
Part B: core
B1. Let . Using its eigenvectors and as a basis, compute and confirm it is diagonal.
B2. A robot base frame is rotated counterclockwise from the world frame and its origin is at in the world. A point is at in base coordinates. Find its world coordinates.
B3. In the situation of B2, a point is at in the world. Where is it in base coordinates?
B4. The map “reflect across the line ” has matrix . Write it in the basis . Why is the result so simple?
B5. Show that the trace of equals the trace of , using the fact .
B1. , . . ✓.
B2. . .
B3. . The point is the base’s origin.
B4. is kept and is flipped, so in that basis the matrix is . These are the reflection’s eigenvectors.
B5. .
Part C: explain and prove
C1. Prove that if , then . Why is this useful?
C2. Explain why the same vector can be an eigenvector of but have different coordinates in different bases, and how its coordinates in the new basis relate to the eigenvectors of .
C3. Explain why, in robotics code, writing R_world_cam @ R_gripper_world is a warning sign.
C4. Is “the set of all polynomials of degree exactly 2” a vector space? Why or why not?
C1. , since each inner . It means you can compute powers in whichever basis is easiest (such as the eigenbasis, where they are trivial), then convert.
C2. If , then . So , the coordinates of in the new basis, is an eigenvector of . It is the same geometric direction, described differently.
C3. Adjacent labels “cam” and “gripper” do not match; the product does not correspond to any meaningful chain of frames.
C4. No. It does not contain the zero polynomial, and it is not closed under addition: has degree 1.
Part D: practise with code
D1. Write to_basis(v, B) using np.linalg.solve(B, v) and from_basis(c, B) using B @ c. Check that they undo each other on random inputs.
D2. Build 2-D homogeneous transforms T(theta, tx, ty) as matrices. Compose three of them and check that applying them one at a time gives the same result as applying the product.
D3. For a random symmetric matrix , compute Q.T @ S @ Q where Q comes from np.linalg.eigh(S). Confirm it is diagonal (up to rounding).
D2. For angle and shift the rows are [c, -s, tx], [s, c, ty] and [0, 0, 1], with c, s = cos(theta), sin(theta). Points are [x, y, 1].
Where this is used
- Every pose computation in 02 Geometry and Kinematics is a change of basis.
- Choosing whether a policy outputs actions in the camera, gripper or base frame changes how well it generalizes (12 Human Data and Embodiment).
- Fourier analysis, PCA and modal analysis of vibrations are all changes to a well-chosen basis.
Next: LA 12 Matrix Calculus and Numerical Practice: derivatives with vectors and matrices, and computing safely.