Translation Matrices and Their Applications | Free Discrete Mathematics Lesson (4 College Credits) | UPI Study

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

← Rotation Matrices and Their ApplicationsNext lesson: Foundations of Boolean Logic →

Earn 4 college credits for Discrete MathematicsRecommended for credit by NCCRS · Math 230 · self-paced · one payment, lifetime access

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.

Why take it here

Why students take Discrete Mathematics with UPI Study

The math behind computer scienceDiscrete Mathematics is the mathematics of computer science: logic, proofs, sets, counting, probability and graphs underpin algorithms, data structures, cryptography and databases. Completing it now lets you qualify for those courses at your university.
Credit at a fraction of the priceThe same 4 credits can cost $750 or more at a US college. Here it is one payment, self-paced, with lifetime access.
Finish your degree soonerTransfer credits reduce the courses you still owe, so you can graduate earlier or lighten a heavy semester.
Strengthen an applicationA completed college-level course on an official transcript shows admissions and scholarship committees you can do the work.
Study on your own scheduleNo start dates, no deadlines. Watch the lessons, practice, and take the final when you are ready.
130,000+students helped with college creditsACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.

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.

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?
A 2 × 2 matrix always sends the origin (0,0) to (0,0), because every term in the product contains a zero factor. A translation by (a,b) sends the origin to (a,b). Unless a and b are both zero, no 2 × 2 matrix can do that. Translation moves the origin, so it is not a linear map.
How do homogeneous coordinates let a matrix translate a point?
Homogeneous coordinates write (x,y) as the column (x, y, 1) and use a 3 × 3 matrix with rows (1,0,a), (0,1,b), (0,0,1). The a and b get multiplied by the extra 1, so they are simply added to x and y. For example, translating (2,3) by (4,-1) gives (6,2,1), which is the point (6,2).
In what order do I multiply matrices to rotate and then translate?
Write the rotation matrix on the right and the translation matrix on the left, as T R_h p. The right-hand factor acts on the point first, since (AB)p = A(Bp). So T R_h means rotate, then translate. Reversing it to R_h T means translate first, then rotate about the origin.
Does the order of a rotation and a translation change the result?
Yes, the order generally changes the final point, because matrix multiplication is not commutative. Take a 90° rotation and a translation by (3,0) applied to (1,0). Rotating then translating gives (3,1). Translating then rotating gives (4,0) rotated to (0,4). Rotation about the origin also swings the translated point around.

About the Discrete Mathematics course

How many college credits is Discrete Mathematics?
Discrete Mathematics (Math 230) carries a NCCRS credit recommendation for 4 semester credits. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.
How much does Discrete Mathematics cost and what is included?
$250, paid once, with lifetime access: all 87 video lessons, a practice quiz after each, the graded work and final exam, and an official transcript when you finish. Students who want several courses choose UPI Study PRO instead.
Which universities accept UPI Study credits?
UPI Study has signed partner agreements with universities such as Thomas Edison State University, University of the People and Charter Oak State College, and works with universities such as Penn State, SNHU and SUNY. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities. Use "Find my college" on this page to check yours.
How long does Discrete Mathematics take?
It is self-paced with no deadlines. The 87 lessons total about 13 hours of video; most students add reading and practice time and finish in a few weeks to a few months, on their own schedule.
How are the exams done?
Quizzes and assignments are online in the course. The final exam is taken online with proctoring; a person on the UPI Study team checks assignments, usually within two days.
How do my credits reach my college?
When the course shows 100% complete, request the official transcript from your dashboard. It is sent to the college you name, and you can send it to more than one. Check your college first with "Find my college" on this page, or ask Athena.

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.

Discrete Mathematics
4 credits · NCCRS
Enroll →