UPI Study › Courses › Discrete Mathematics › Free lessons › Lesson 12.4 Free with a free account
Translation Matrices and Their Applications
Discrete Mathematics · Chapter 12: Matrices and TransformationsSection 12.4 · lesson 80 of 8710 min · free with a free account
Free preview
Create a free account to keep watching
It takes a minute and costs nothing. Your free account unlocks all of Chapter 1 and 3 more lessons of Discrete Mathematics.
Lesson complete
Earn the 4 college credits for Discrete Mathematics
Enrolling adds a quiz after each lesson, the graded work and the official transcript. Recommended for credit by NCCRS.
Next lesson: Foundations of Boolean Logic →← Rotation Matrices and Their ApplicationsNext lesson: Foundations of Boolean Logic →
In this lesson
Homogeneous coordinates turn a slide into a matrix product.
- Explain why no 2 × 2 matrix can translate
- Translate with homogeneous coordinates
- Compose rotations and translations in order
- Chain joints in graphics and robot arms
Transcript
Everything said in the video, section by section (1,478 words). Read along, or search it.
Matrices and Transformations
Translation Matrices and Their Applications
This section completes chapter twelve by adding the one motion rotation can't produce: sliding a point somewhere else. We'll see why an ordinary matrix can't represent a slide, and how one extra coordinate fixes that. Then a single matrix product can describe a whole chain of rotations and translations, which is exactly what robot arms and graphics engines compute.
The Opening Problem
A Robotic Arm, Joint by Joint
A warehouse robotic arm must move its gripper to a bin, turn its wrist to the right orientation, and report the gripper's exact position many times per second. Section twelve point three showed how to rotate a point about the origin, using a two by two matrix. But the arm's shoulder joint doesn't just rotate the gripper. It also carries it a fixed distance away from the joint. And the next joint down does the same thing again. Rotation alone, applied at the origin, can never move a point somewhere else entirely. So we need translation. And it has to combine with rotation cleanly enough to chain through every joint, without the bookkeeping spiraling out of control. The clean way to do that is a trick called homogeneous coordinates.
Fact 12.4.1
Translation Is Not Linear
A translation by a, b sends the point x, y to x plus a, y plus b. Every point slides by the same amount. Here's why no two by two matrix can do that. Multiply any two by two matrix by the origin, zero, zero. Every entry of the product is a sum of terms that each contain a factor of zero. So the result is always zero, zero, whatever the matrix is. But translating the origin by a, b produces the point a, b. So unless a and b are both zero, no matrix can send the origin there. That's the dividing line. Rotation, reflection and scaling all leave the origin fixed, so two by two matrices handle them fine. Translation moves the origin, so it needs a different representation entirely.
Definition 12.4.1
Homogeneous Coordinates
Here's that representation. In homogeneous coordinates, the point x, y is written as a column vector with three entries: x, y, and one. Translation by a, b then becomes a three by three matrix. Its top row is one, zero, a. Its middle row is zero, one, b. And its bottom row is zero, zero, one. Why does this work? In each of the first two rows, a or b gets multiplied by that final one in the vector. So it's simply added on. The extra coordinate is what turns an addition into a multiplication.
Worked Example
Translating (2, 3) by (4, −1)
Let's translate the point two, three, by four, minus one. Write the point as two, three, one, and multiply by the translation matrix. The first row gives one times two, plus zero times three, plus four times one. That's six. The second row gives zero times two, plus one times three, plus minus one times one. That's two. The third row gives just one. Drop the final one, and we get the point six, two, which is two plus four, and three minus one. Exactly the translated point. The third coordinate stays one throughout. It exists only to make the multiplication work, and it's discarded at the end.
12.4.2
Rotation in the Same Format
To combine translation with rotation, put the rotation matrix from section twelve point three into the same three by three format. Its top-left two by two block is the familiar rotation matrix. Its last column is zero, zero, one, because a pure rotation doesn't slide the origin. Now both transformations are ordinary three by three matrices, so they multiply like any others. The product represents applying both, in sequence. But in which sequence? For matrices A and B and a point p, A B times p equals A times B p. So the right-hand factor acts on the point first, and the left-hand factor acts second. That means T times R h says rotate, then translate. And R h times T says translate first, then rotate about the origin.
Worked Example
Same 2 Steps, Different Orders
Let's test both orders. Rotate by ninety degrees, translate by three, zero, and apply each to the point one, zero. Rotate then translate gives a product matrix with rows zero, minus one, three, then one, zero, zero, then zero, zero, one. Applied to one, zero, it gives three, one. Rotating one, zero by ninety degrees gives zero, one, and sliding that by three gives three, one. Translate then rotate gives a different matrix, with rows zero, minus one, zero, then one, zero, three, then zero, zero, one. Applied to one, zero, it gives zero, four. Sliding first gives four, zero, and rotating that by ninety degrees gives zero, four. The two orders land on genuinely different points. Since matrix multiplication isn't commutative, the order of composition isn't a technicality. It changes the answer.
12.4.3
Chains in Computer Graphics
This is exactly how computer graphics works. A rendering pipeline stores each on-screen object's position and orientation as a single homogeneous matrix, often called its model matrix. It's built just as we did, by multiplying a rotation and a translation. Objects can be nested. A car's wheel spins relative to the chassis, while the chassis itself moves through the scene. The wheel's position on screen is the chassis matrix, multiplied by the wheel's matrix relative to the chassis. Adding a new joint or a nested part never means re-deriving geometry by hand. It just means multiplying in one more three by three matrix, or four by four in three D engines.
Forward Kinematics
Where Does the Gripper End Up?
The same chaining tells a robot where its gripper ends up. That calculation is called forward kinematics. Take a two-link arm. Each link has a length, and turns by an angle relative to the link before it. The matrix for link i is a rotation by its angle, times a translation by its length along x. Let both angles be ninety degrees, with the first link two units long and the second one unit. That gives A one, with rows zero, minus one, zero, then one, zero, two, then zero, zero, one. And A two is the same, but with a one in place of the two. Multiplying them gives the total transform, with rows minus one, zero, minus one, then zero, minus one, two, then zero, zero, one. Apply that to the gripper's local origin, zero, zero, one, and the result is minus one, two, one. So the gripper sits at minus one, two.
Figure 12.4.2
The Two-Link Arm
Here's the arm. Link one starts at the base and rotates ninety degrees, so it points straight up and carries the joint to zero, two. Link two rotates a further ninety degrees relative to link one. So it now faces one hundred eighty degrees overall, the sum of the two angles. It carries the gripper one more unit in the negative x direction, to minus one, two. That's exactly the point the matrix product computed, without any step-by-step vector arithmetic.
Listing 1
Forward Kinematics in Code
Here's the computation in code, using NumPy. One function builds the homogeneous rotation matrix, and another builds the translation matrix. The joints are listed as pairs, angle and length. The chain starts as the identity. For each joint, the loop multiplies in one more rotation times translation. Finally the chain is applied to the local origin, and it prints minus one, two. Nothing here depends on there being two joints. The same loop handles an arm of any length.
Table 12.4.1
Linear, Affine and Homogeneous
Here's how the three kinds of transformation compare. A linear map, y equals A x, always fixes the origin, and in two D it's a two by two matrix. An affine map, y equals A x plus b, moves the origin to b. It can't be written as one two by two matrix. It needs the pair A and b. And composing affine maps needs an extra formula. In homogeneous form, though, any of them is a single three by three matrix, and composition is just a matrix product. A rigid motion is an affine map built only from rotation and translation. It preserves every distance and every angle.
Takeaways
One Extra Coordinate
To summarize. Translation moves the origin, so it isn't linear, and no two by two matrix can represent it. Homogeneous coordinates fix that, by writing points as x, y, one, and using three by three matrices. Rotation and translation multiply into a single matrix for a full rigid motion. But order matters: the two orders generally send a point to different places. Chaining the joints of a robot arm, or the nested objects of a graphics scene, comes down to multiplying their matrices in the right order. And three D uses four by four matrices, built the same way. Here's something to think about. Rotate then translate sent one, zero to three, one. Translate then rotate sent it to zero, four. Where exactly does that difference come from? Think about what rotating about the origin does to a point that's far from it. And is there any choice of shape, angle or translation where the two orders would agree?
About Discrete Mathematics at UPI Study
Discrete Mathematics (Math 230) is a self-paced online course of 87 video lessons in 13 chapters, from logic and proof to counting, probability, graph theory and trees. It carries a NCCRS credit recommendation for 4 semester credits.
Every lesson transcript is free on pages like this one, and the videos are free with a free UPI Study account. Enrolling adds a practice quiz after each lesson, the graded work and final exam that earn the credit, lifetime access, and an official transcript on completion. UPI Study has helped over 130,000 students with college credits. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.
Enroll now → Course details Download the syllabus Every course with PRO →
Why take it here
Why students take Discrete Mathematics with UPI Study
Where the credit goes
Universities that work with NCCRS
Discrete Mathematics carries a NCCRS credit recommendation. These universities work with NCCRS; some are UPI Study's signed partners. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.
Thomas Edison State UniversitySigned partner
University of the PeopleSigned partner
Charter Oak State CollegeSigned partner
Strayer UniversitySigned partner
Columbia Southern UniversitySigned partner
Indiana TechSigned partner
Penn StateWorks with NCCRS
Southern New Hampshire UniversityWorks with NCCRS
SUNYWorks with NCCRS
+many more cooperating universitiesFind my college →Find my college → Not listed? Ask Athena in the corner of this page, or book a 15-minute call.
FAQ
Questions students ask us
About Translation Matrices and Their Applications
Why can't a 2 × 2 matrix represent a translation?
How do homogeneous coordinates let a matrix translate a point?
In what order do I multiply matrices to rotate and then translate?
Does the order of a rotation and a translation change the result?
About the Discrete Mathematics course
How many college credits is Discrete Mathematics?
How much does Discrete Mathematics cost and what is included?
Which universities accept UPI Study credits?
How long does Discrete Mathematics take?
How are the exams done?
How do my credits reach my college?
Ready for the full course? Earn 4 credits in Discrete Mathematics.
87 video lessons, a quiz after each one, and the graded work that earns the credit. Recommended for credit by NCCRS.
4 credits · NCCRSEnroll →