TL;DR
A 2D point is written as the three numbers . Written this way, moving a point by a fixed offset is a matrix multiplication, just like rotating or scaling it. Two triples that are scalar multiples of each other, such as and , name the same point.
Where you'll see it: computer graphics pipelines, camera and projection models such as the pinhole camera, and robotics code that chains many transforms.
Intuition
Suppose you want to move every point of a drawing 5 units to the right. A rotation about the origin can be written as a 2 by 2 matrix. A shift cannot. Multiplying a matrix by always gives when the input is , so the origin never moves. A shift has to move the origin, and that is impossible for a linear map of .
The trick is to add one more coordinate. Imagine the plane floating in three-dimensional space, and identify each point with the 3D point on that plane. Now a shift is a linear map in three dimensions. It is a shear of the plane, so the origin of the flat picture moves, but in 3D the transformation is still linear.
The extra coordinate also carries a second meaning. If you scale a 3D vector by a nonzero number, you get the same point on the plane, because you divide by to recover the flat coordinates. So means the flat point , and all its scalar multiples mean the same thing. This is what makes perspective projection work: a perspective camera divides by depth, and the division can be done in one step at the end.
flowchart LR P["Flat point (x, y)"] --> H["Homogeneous (x, y, 1)"] H --> M["Multiply by a 3x3 matrix"] M --> D["Divide by w to get flat (x', y')"]
The math
Definition
For a point in the plane, a homogeneous representation is any triple with such that
Two triples and with represent the same point. The standard representative has , which is why you append a 1 to a point.
Triples with are called points at infinity. They represent directions rather than locations. For example, is the point at infinity in the direction of the positive -axis, where every horizontal line meets "at infinity". Dividing by is not possible, which is why these points have no flat counterpart.
Translations as matrices
A 2D affine map sends to . In homogeneous form, this is one matrix product:
The top-left block is the linear part (rotation, scale, shear). The last column holds the translation. The bottom row keeps the coordinate at 1 for affine maps. Translation is , , with the shift.
Composition
If is applied first and then , the combined map is , computed once as a matrix product. This is why graphics engines store a single matrix per object and multiply them together. Order matters, as with any matrix product: rotating then translating is not the same as translating then rotating.
Directions versus points
A direction vector has . Multiplying it by the translation matrix leaves it unchanged, because the translation column is multiplied by zero. That is the right behaviour: moving a vector does not change its direction or length. Rotation and scale still act on directions, so one matrix formula handles both points and vectors.
Worked examples
Move the point by and .
- Write the point as .
- Build the translation matrix .
- Multiply: the first row gives . The second gives . The third gives .
- Result: , which is the flat point .
Interpretation: one matrix multiply moved the point, and no addition was written separately.
Rotate counterclockwise about the origin, then shift by . The rotation is and the shift is .
- Combine them: . Row 1 of is , and multiplying by the columns of gives . Row 2 of is , which gives . Row 3 is . So .
- Apply to . The first coordinate is . The second is . The third is .
- Result: .
- Check by hand: rotating by counterclockwise gives . Shifting by gives . They agree.
Interpretation: a whole chain of transforms can be stored as one matrix, and the hand check is a good way to catch a sign error.
The triples and both give the flat point and . Multiplying all three numbers by 2 leaves and unchanged. So a homogeneous point is an equivalence class, and the scale is not meaningful on its own.
Tradeoffs and failure modes
| Situation | What goes wrong | Better choice |
|---|---|---|
| Plain 2 by 2 matrices for a scene with shifts | The origin is fixed, so the shift cannot be expressed | Use 3 by 3 homogeneous matrices |
| Forgetting to divide by at the end | Points are off by a scale factor, and the picture is wrong | Divide by once, when leaving homogeneous form |
| Using for a direction | The direction gets shifted as if it were a point | Use for directions |
| Lots of transforms every frame | Repeated per-point work adds up | Multiply the matrices once, then apply the product to each point |
| Numerical error when is near zero | Division blows up for points near infinity | Clip or handle points near infinity separately |
The most common bug is mixing up the convention for points and vectors. A translation that moves the ground plane but also moves the lighting direction is almost always a mistake.
History
The idea comes from projective geometry in the 19th century, where coordinates are defined only up to a scale. Those coordinates let parallel lines meet at a point at infinity, which simplified many geometric statements. Computer graphics adopted the same representation to treat shifts, rotations and perspective in one framework. In 3D the analogue is a 4 by 4 matrix acting on , which is the form graphics pipelines use for perspective projection.
Check yourself
QuestionWhat is the homogeneous form of the point , and which other triple also represents it?Show answer
The standard form is . The triple also represents it, because it is the standard form scaled by 2, and dividing by gives again.
QuestionApply the translation by to the point using a homogeneous matrix. What is the result?Show answer
Write and multiply by . The first row gives , the second gives , and the third is 1. The result is .
QuestionWhy does a direction vector use , and what happens to it under a translation?Show answer
A direction describes which way to go, not where you are, so shifting it should leave it unchanged. Setting makes the translation column multiply by zero, so the direction is not shifted. The linear part still rotates or scales it, which is the behaviour you want.
QuestionYou compose a rotation and then a translation into . A colleague writes instead. Give a point where the two results differ, and explain why.Show answer
Take the point with a counterclockwise rotation and a shift by . Applying first and then : sends to , and then gives . Applying first and then : sends to , and then gives . The results and differ. Matrix multiplication is not commutative, so the order of the transforms matters, and and are different maps.