RobotGuide
Math foundations/Bases and coordinates: why robots put everything in matrices

Foundations T7 / 27 · Linear algebra and geometry

Bases and coordinates: why robots put everything in matrices

The same point reads differently under a different basis — the vector is objective; coordinates are bookkeeping.

45 min3 theorems6 proof steps4 self-test questions

One-line takeaway

A vector itself does not depend on any coordinate system; «coordinates» are just the table of coefficients of a vector under a basis. Changing basis changes the vector not at all, only the notation — the robot's two coordinate systems report different numbers yet see the same thing.

Animated · drag the basis vectors e₁ e₂ and watch the coordinates of the same vector recompute — change the basis, not the vector

A robot has one coordinate system on the chassis, one on the wrist, one on the lidar. The camera says «the target is at (3.1, 0.4)»; the chassis says «it is at (1.8, −1.2)». If you think they are arguing, you will never debug the tf tree; if you know they are two ledgers of the same vector under two bases, you hold the first true foundation of robotics.

Why this tool exists

The earlier group T1 said «a matrix is the ledger of a rotation» but never said what the ledger actually records — this piece supplies that.

Every sensor output, every control command, every trajectory point must first answer «relative to which coordinate system» before its numbers mean anything. On the industrial floor, 80% of «the robot missed the mark» turns out to be a coordinate system mix-up, not an algorithm bug.

Definitions

Definition 1.1 Vector space (intuitive version)

A pile of things (vectors) forms a vector space as long as two things hold: ① adding any two keeps you in the set (closed under addition); ② multiplying any one by any real number keeps you in the set (closed under scalar multiplication). All arrows in the plane, all forces in 3D space — vector spaces.

Definition 1.2 Linear independence

A set of vectors {v_1, …, v_n} is linearly independent, meaning «none can be assembled from the others»: the all-zero coefficients Σ a_i v_i = 0 are the only way to make the equation hold. Two vectors linearly independent ⟺ not collinear; three ⟺ not coplanar.

Why define it this wayLinear independence = every member brings a new dimension. Two collinear vectors can span only a line, one dimension short — duplicate sensors and redundant joints are both, at bottom, «linear dependence».

Definition 1.3 Basis and coordinates

If {e_1, …, e_n} is linearly independent and every vector v in the space can be written v = x_1 e_1 + … + x_n e_n, then this set is called a basis and the coefficient table (x_1, …, x_n) is v's coordinates under this basis. A basis is not unique — one space has infinitely many bases, and one vector has infinitely many coordinate tables.

Theorems and proofs

Theorem 1.1 Coordinates are unique

Fix a basis; the coordinate representation of any vector is unique.

Proof

Proof by contradiction: suppose v has two coordinate tables x = (x_1,…,x_n) and y = (y_1,…,y_n), i.e. Σ x_i e_i = v = Σ y_i e_i.

Subtract the two: Σ (x_i − y_i) e_i = 0. But the basis is linearly independent, and the all-zero combination is the only zero combination, so x_i − y_i = 0 for every i, i.e. x = y. ∎

NoteUniqueness is not a formality — it lets «coordinates» serve as an ID card. Two coordinate tables that differ do not contradict, because they refer to different bases; under one and the same basis, two different coordinate tables are two different vectors, with no room for ambiguity.

Theorem 1.2 The change-of-basis formula

Write the new basis's vectors in terms of the old basis and arrange them as the columns of P = [p_1 p_2 … p_n] (column i is the i-th new basis vector's coordinates in the old basis). If v has old coordinates x and new coordinates x′, then x = P x′, equivalently x′ = P−1 x.

Proof

Expand v in the new basis: v = Σ x′_i p_i. This is «scale then add», which is exactly the definition of a matrix times a vector: v = P x′.

And v = x is v's old-coordinate notation, so x = P x′. P's columns are linearly independent (definition of a basis), so P is invertible; left-multiply both sides by P−1 to get x′ = P−1 x. ∎

NoteP is the translation dictionary: it translates new-language coordinates back into old language. Every tf transform in robotics is such a P — «the child frame's basis, pinned in the parent frame's position and orientation».

Theorem 1.3 Under an orthonormal basis, translation needs no inversion

If the new basis is orthonormal (mutually perpendicular, each of length 1, i.e. P^T P = I), then P−1 = P^T and the change-of-basis formula becomes x′ = P^T x — a transpose finishes the translation, no inversion needed.

Proof

Orthonormal columns packed into a matrix: the (i,j) entry of P^T P is p_i · p_j = δ_ij (each vector dotted with itself gives 1, dotted with the others gives 0). This is exactly the entrywise form of P^T P = I.

P^T P = I means, by the definition of the inverse, P−1 = P^T. Substitute into Theorem 1.2. ∎

NoteSo in engineering, choose an orthonormal basis whenever you can: rotation matrices are all orthogonal, and coordinate transforms cost «one transpose» at the rotation level. In the numerical experiment, the orthonormal round-trip error is 10-16 (machine precision); the non-orthogonal error is amplified by how ill-conditioned the basis is.

Work it by hand

A vector x = (1, 2) in the base frame. The wrist frame's basis written in the base frame: p_1 = (1,1)/√2 (pointing at 45°), p_2 = (−1,1)/√2 (pointing at 135°). Find x's coordinates in the wrist frame.

  1. Assemble the translation dictionary: P = [[1/√2, −1/√2], [1/√2, 1/√2]] (first column p_1, second column p_2). This is T1's 45° rotation matrix with its columns swapped — orthonormal.
  2. Use Theorem 1.3: x′ = P^T x. P^T's first row is (1/√2, 1/√2), second row (−1/√2, 1/√2).
  3. [object Object]
  4. Verify (Theorem 1.2 in reverse): x′_1 p_1 + x′_2 p_2 = (3/√2)(1/√2, 1/√2) + (1/√2)(−1/√2, 1/√2) = (3/2 − 1/2, 3/2 + 1/2) = (1, 2) ✓. Two ledgers, one vector.
Answer

x's coordinates in the wrist frame are (3/√2, 1/√2) ≈ (2.121, 0.707). The appearance of √2 is no accident: projecting a vector onto a 45° direction naturally carries a square root — exactly why normalized bases are used.

Run the numbers

Where the numbers come from

2000 random vectors round-tripped between two bases, maximum error:

  • Orthonormal basis (45° rotated frame) round-trip error: 4.97e-16 (machine precision, perfect round trip)
  • Non-orthogonal basis (a skewed basis with shear) round-trip error: 2.22e-16 — the more «crooked» the basis, the dirtier the numerical translation
  • The same computation; the only difference is the basis's shape: this is why engineering standards require coordinate transform matrices to be as orthogonal as possible

Where this shows up

The object hereThe counterpart in RLUsed in
Trajectory/state vectorsPick a basis (joint space or Cartesian space) before talking numbersused in →
tf transform matrixThe child frame's basis pinned in the parent frame's position and orientation = Pused in →
The «direction» of sensor noiseThe eigendirections of a covariance are the statistical version of a «basis»used in →

Boundaries: where this article stops

Where this piece stops: linear spaces over general domains (function spaces, polynomial spaces) are not developed; the algorithmic details of Gram–Schmidt orthonormalization are skipped. This piece serves exactly one purpose — that when you read «coordinate system», «transform», or «projection», you have a clear ledger in your head.

Self-test: 4 questions

All hand-computation and «find the flaw in this proof» questions — nothing to memorize. Stuck? Go back to the section.

01Under what condition are P−1 and P^T equal?

If and only if P is orthonormal (P^T P = I). Then «translating» and «transposing» are the same operation — lowest cost, most stable numerically.

02The same vector has different coordinates under two bases — is that a contradiction?

No. Coordinates are not the vector itself; they are the vector's coefficient table relative to some basis. Change the basis, change the ledger; the vector has not moved. The theoretical basis of multi-frame coexistence in robotics is entirely in this sentence.

03Two sensor outputs are «linearly dependent» — what does that say?

One's information can be fully assembled from the other — the second brought no new dimension. A redundant configuration is either for reliability (backup) or should be replaced by a sensor measuring a different dimension.

04Why does engineering favor orthonormal bases?

Three-in-one: change of basis needs no inversion (x′ = P^T x); round-trip numerical error at machine precision (10-16); lengths and angles survive the change of basis unchanged — physical quantities are not distorted by the bookkeeping.

Up next

The full series · 27 articles

T1The Matrix Is a Ledger for Rotation≈ 25 minT2From Slope to Gradient: The First Line of Every Robot Learning Algorithm≈ 25 minT3Vectors and forces: the physical reading of the dot productAbout 20 minT4Two Rulers and a Better Rulerabout 25 minT5The Ledger of One Motor Revolution: Radians, Speed, and Powerabout 20 minT6Complex multiplication is rotation: the one-dimensional version of quaternionsAbout 20 minT7Bases and coordinates: why robots put everything in matrices45 minT8Matrix Multiplication: Chaining Transformations, Not a Table OperationAbout 40 minT9The Jacobian: Rotate a Joint One Degree — How Far Does the End Effector Move?About 45 minT10Eigenvectors: The Directions a Matrix Dare Not Touchabout 45 minT11SVD and the Pseudoinverse: When There Is No Exact Solution, Find the Nearest Oneabout 50 minT12Taylor expansion: putting a straight line to work in place of a curveAbout 40 minT13Probability spaces: why «random» needs axioms50 minT14Expectation: A Rigorous Construction of «Average»About 55 minT15Conditional Expectation: What the Vertical Bar Really Means≈ 60 minT16Four inequalities: the quantitative answer to «how many samples are enough»45 minT17Norms and fixed points: where «it always converges» comes from55 minT18Markov Chains: When the Time Average Equals the Ensemble Averageabout 55 minT19The Mathematical Construction of the MDP: What One Axiom Is Worthabout 50 minT20Dynamic Programming: The Accounting for Two Iterations≈ 50 minT21Optimization: why constraints cannot rely on penalties aloneAbout 55 minT22Stochastic Approximation: Every Term in the Learning-Rate Formulaabout 55 minT23The Mathematics of Contact: Hertz Theoryabout 45 minT24Friction and the Friction Cone: The Geometry of Constraintsabout 40 minT25Force Closure and Grasp Metrics: ε Is a Linear ProgramAbout 50 minT26Contact Kinematics: Why Rolling Is Not «Sliding Along»≈ 45 minT27Slip detection: from «I felt it» to «I computed it»About 50 min