Linear Algebra · Theory · M7
M7-T5 — Homogeneous Transformations
A rotation fixes the origin, so a rigid motion needs a translation too. Appending a 1 to every point turns "rotate then shift" into a single matrix multiplication.
A rigid motion is a rotation followed by a translation: p ↦ Rp + t. That is affine, not linear, so it cannot be a plain 3 × 3 matrix product. Homogeneous coordinates add one extra coordinate that lets a 4 × 4 matrix do both at once, and chains of motions then become products of matrices.
Learning objectives
After this lesson, you should be able to:
- Explain why a translation is not a linear map and how a trailing 1 fixes this.
- Build a 3 × 3 (2D) and 4 × 4 (3D) homogeneous transform from R and t.
- Apply it to points (w = 1) and to vectors (w = 0) and explain the difference.
- Chain several transforms as one matrix product and read off the combined rotation and translation.
Introduction and motivation
A LiDAR point sits in the sensor frame; the sensor sits on the robot; the robot sits in the world. Converting a point by hand takes a rotate and a shift at every link. With homogeneous matrices the whole chain is a single product T_WB T_BL that you precompute once and apply to every point in a scan of 100 000 returns. Every robotics library (ROS tf, Eigen's Isometry3d, g2o, GTSAM) stores poses this way.
The intuition
A pure rotation matrix leaves the origin where it is, so it cannot move a robot; translations move the origin but are not linear maps (they send 0 to something non-zero). The trick: represent a point p as (p, 1), one dimension higher. In that bigger space, “add t” becomes a shear that mixes the extra coordinate into the others, and a shear is a linear map. One extra column stores the shift.
Interactive figure. A world frame, a robot with position and heading, and a sensor mounted on it with an offset and a yaw. A point is shown with coordinates in world, robot and sensor frames. This figure needs JavaScript to be interactive.
Geometric and physical interpretation
Geometric view. In 2D the point (x, y) becomes (x, y, 1), a point on the plane w = 1 in 3D. A matrix with an extra column (tₓ, t_y, 1) shears that plane sideways, which shifts the points in it by (tₓ, t_y). Directions (free vectors) are written with w = 0: they live at infinity and are unaffected by the shear. Physical view. Positions get translated when you change frames; velocities and normals do not, only rotated. The 1 versus 0 encodes that difference automatically.
The mathematics
- p̃
- the homogeneous version of a point: (x, y, z, 1).
- ṽ
- the homogeneous version of a free vector: (vₓ, vy, vz, 0).
- T
- the 4 × 4 homogeneous transform [[R, t], [0ᵀ, 1]].
The transform
T = [ R t ; 0ᵀ 1 ], T [p; 1] = [ R p + t ; 1 ], T [v; 0] = [ R v ; 0 ]
What it means. The top block does R p + t for a point (w = 1). For a direction (w = 0) the translation column is multiplied by zero, so only the rotation acts. The bottom row (0, 0, 0, 1) keeps w unchanged.
Composition
T₁ T₂ = [ R₁R₂ R₁t₂ + t₁ ; 0ᵀ 1 ]
What it means. Apply T₂ first, then T₁. The result has rotation R₁R₂ and translation R₁t₂ + t₁: the second translation is rotated by the first rotation before the first translation is added.
T = [[R, t], [0, 1]]. Points get w = 1 and are rotated and shifted; vectors get w = 0 and are only rotated. T₁T₂ applies T₂ first.
Step-by-step derivation: why the extra coordinate works, and the product rule
- Translation is not linear. A linear map sends 0 to 0, but
p ↦ p + tsends 0 tot, and(p + q) ↦ p + q + t ≠ (p + t) + (q + t). - The lifting trick. Write
p̃ = (p, 1)and use the block matrix[[I, t], [0ᵀ, 1]] [p; 1] = [p + t ; 1]. The map on the lifted vector is linear, and the first block of the result is the translated point. - Rotate and translate together.
[[R, t], [0ᵀ, 1]] [p; 1] = [R p + t ; 1]: the block multiplication gives the top rowR p + t·1and the bottom row0·p + 1·1 = 1. - Composition. Multiply blockwise:
[[R₁, t₁], [0, 1]] [[R₂, t₂], [0, 1]] = [[R₁R₂, R₁t₂ + t₁], [0, 1]]. This agrees with applyingp ↦ R₂p + t₂thenq ↦ R₁q + t₁:R₁(R₂p + t₂) + t₁ = R₁R₂p + R₁t₂ + t₁. - Vectors. For
ṽ = (v, 0):T ṽ = (R v + t·0, 0) = (R v, 0). Translations cannot move a direction. - Difference of points is a vector.
(p, 1) − (q, 1) = (p − q, 0): subtracting two points gives a free vector, and the transform of that difference is justR(p − q). This is why rigid motions preserve distances.
Same idea in 2D. A planar pose (x, y, θ) becomes the 3 × 3 matrix [[cos θ, −sin θ, x], [sin θ, cos θ, y], [0, 0, 1]]. Rotation about a centre c is T(c) R T(−c): shift to the origin, rotate, shift back.
Where perspective cameras come in. If the bottom row is allowed to be anything, the last coordinate is not 1 and a division is needed afterwards. That is the projective generalisation used for camera models; rigid motions keep the bottom row (0, 0, 0, 1).
A worked example: a 2D and a 3D transform
- 2D pose. A robot at
(2, 1)with heading 90°:T = [[0, −1, 2], [1, 0, 1], [0, 0, 1]]. The point(1, 0)in the robot frame is(1, 0, 1), soT p̃ = (0·1 − 0 + 2, 1·1 + 0 + 1, 1) = (2, 2, 1): world position(2, 2), matching the first lesson. - 3D point.
R = Rz(90°),t = (1, 2, 3)andp = (1, 0, 0):R p = (0, 1, 0), soT p̃ = (0 + 1, 1 + 2, 0 + 3, 1) = (1, 3, 3, 1). - The same transform on a vector.
ṽ = (1, 0, 0, 0)gives(0, 1, 0, 0): no translation applied. - Composition (2D). The robot-in-world pose above times a LiDAR mount
T_BL = [[1, 0, 0.3], [0, 1, 0], [0, 0, 1]](30 cm forward, no rotation) givesT_WL = [[0, −1, 2], [1, 0, 1.3], [0, 0, 1]]; indeedR₁t₂ + t₁ = (0, 0.3) + (2, 1) = (2, 1.3). The LiDAR origin is at (2, 1.3) in the world. - A LiDAR return in the world. A return of 4 m at 30° in the sensor frame is
(3.464, 2, 1); thenT_WL (3.464, 2, 1) = (−2 + 2, 3.464 + 1.3, 1) = (0, 4.764, 1).
Robotics application
SLAM. Every pose in a pose graph is stored as a homogeneous transform (or its equivalent), and each edge constraint is a relative transform; see pose graphs and rigid transforms in 2D.
LiDAR registration. A scan is transformed by a single 4 × 4 matrix [R t; 0 1] applied to all points as one matrix multiplication; ICP estimates this matrix; see scan registration and point-cloud preprocessing.
Calibration. The extrinsic transform between the camera, IMU and LiDAR of a UAV is one fixed 4 × 4 matrix per sensor; see extrinsic calibration.
Manipulators. Forward kinematics multiplies one homogeneous transform per joint; the result gives the hand pose (Module 8).
Engineering implications and limitations
Practical rules
- Keep the bottom row exact. After many operations it can pick up rounding; reset it to (0, 0, 0, 1). For a rigid transform it must never change.
- Use w = 0 for directions. Normals, velocities, accelerations and gravity directions must not be translated.
- Apply transforms to batches. Stack N points as a 4 × N matrix and multiply once:
T @ P. It is faster and easier to read than a loop. - Name the transform with frames.
T_world_basetakes base coordinates to world coordinates; use the inner-subscripts-match rule to check every product. - Do not invert generally. Use the closed form
[[Rᵀ, −Rᵀt], [0, 1]](next lessons). It is exact, cheaper and numerically stable. - Do not interpolate the 4 × 4 entries. Interpolate the translation linearly and the rotation with slerp.
Limits
Homogeneous matrices represent rigid motions in the sense of a single fixed transformation. They do not by themselves handle scaling (use a separate similarity model), time-varying poses (interpolate between timestamps) or uncertainty (Module 9 and 10).
Common misconceptions
“Translation can be a 3 × 3 matrix.”
Not as a linear map: it moves the origin. You need the extra homogeneous coordinate (a 4 × 4 matrix in 3D).
“The fourth coordinate is just padding.”
It carries meaning: 1 for a point (affected by translation) and 0 for a direction (not affected).
“T₁T₂ means apply T₁ first.”
Matrix products act on the right-most factor first: T₂ is applied first, then T₁.
“The translation of T₁T₂ is t₁ + t₂.”
It is R₁t₂ + t₁: the second translation is first rotated by R₁.
Engineering takeaways
- Translation is not linear; appending a 1 to each point lets a 4 × 4 matrix do rotate-and-translate in one product.
- T = [[R, t], [0, 1]] sends points (w = 1) to R p + t and vectors (w = 0) to R v.
- The product T₁T₂ has rotation R₁R₂ and translation R₁t₂ + t₁ and applies T₂ first.
- A chain of frames, world to base to sensor, becomes one precomputed matrix applied to every point.
- Keep the bottom row exact and use the closed-form inverse.
References and further reading
Primary papers and authoritative documentation.
- Modern Robotics (Lynch and Park), free preprint: chapter 3.3, homogeneous transformation matrices
- Boyd and Vandenberghe, Introduction to Applied Linear Algebra (VMLS): affine functions and the augmented matrix; the site did not load when we last checked
- Buss, Introduction to Inverse Kinematics with Jacobian Transpose, Pseudoinverse and Damped Least Squares: homogeneous coordinates and rigid motions; the site did not load when we last checked
- UCSD ECE276A: Sensing and Estimation in Robotics: homogeneous coordinates and rigid-body transformation
Knowledge check
Three conceptual questions. Write an answer, then reveal the explanation. Your answers stay in your browser.
Question 1
A planar robot is at (4, −2) with heading 180°. Write its 3 × 3 pose and find the world position of a point (1, 2) in its frame.
Explanation
T = [[−1, 0, 4], [0, −1, −2], [0, 0, 1]]. T (1, 2, 1) = (−1 + 4, −2 − 2, 1) = (3, −4, 1). The point is at (3, −4).
Question 2
Compose T₁ = rotation of 90° about z with translation (1, 0, 0), and T₂ = pure translation (0, 2, 0). Give the translation part of T₁T₂ and of T₂T₁.
Explanation
T₁T₂: t = R₁t₂ + t₁ = Rz(90°)(0, 2, 0) + (1, 0, 0) = (−2, 0, 0) + (1, 0, 0) = (−1, 0, 0). T₂T₁: t = I·t₁ + t₂ = (1, 2, 0), with rotation R₁. The two products differ, so order matters.
Question 3
Why does the gravity direction (0, 0, −1) get w = 0 when it is moved from world to body frame?
Explanation
It is a direction, not a position. With w = 0 the translation column does not act, so only the rotation is applied, which is what we want: gravity points the same way no matter where the sensor is.
What’s next
The set of all homogeneous transforms with an orthonormal rotation block is itself a group, SE(3). The next lesson studies its structure: the inverse, the group properties and the six degrees of freedom.
Related content
Nothing below is required to finish this lesson.
- BeforeM7-T4: SO(3)
State what makes a matrix a rotation (orthogonal, determinant +1) and why such matrices form a group.
- BeforeM3-T1: Systems of Linear Equations
Write a set of constraints as A x = b, picture it as lines and planes meeting, and say how many solutions to expect.
- LabM7-L1: Robot Coordinate Frame Explorer
Chain frames from the world to a sensor on an arm, find the wrong-order and inverse bugs, and bring a measured point back to the world.
Get notified when the next lesson and new labs are released.
One email per new lesson or lab.