Skip to content
You Start with one site
Amounts in Start with one site
Mechanisms & Robots · Concept

Rotation matrices

One idea Intermediate 5 min read
Found this useful?

Lay a phone flat on a table. Turn it a quarter turn to the left, then lift its far edge until it stands upright. Start again and do the same two moves in the other order: the phone ends facing a different way. A rotation matrix is a small table of numbers that records one turn exactly, so that a machine can apply it to any point and can combine turns in the right order.

Turns on a flat page30° then 60° is the same as 60° then 30°. Both give 90°.Order does not matter
Turns in spaceA quarter turn about Z, then a quarter turn about X.Try it with a book
The other orderThe book ends in a different position.Order matters

See it

Predict first

A flat part lies on a table. It gets two quarter turns: 90° about the vertical axis Z and 90° about the horizontal axis X. Does it matter which turn is done first?

See it: one part, turned about fixed axes

Matrix of the Z turn, row 1
Matrix of the Z turn, row 2
Corner P is now at

The dotted outline is where the part started, with corner P at (2, 1, 0). The axes X, Y and Z do not move. The four numbers are cos γ and −sin γ in the first row, sin γ and cos γ in the second. With two turns, the only thing the second button changes is the order.

The idea

Take a point at (x, y) and turn it about the Z axis by the angle γ, counterclockwise. Its new place is found with four numbers, and those four numbers are the rotation matrix of the turn.

x′ = x cos γ − y sin γ
y′ = x sin γ + y cos γ

(x, y) is the point before the turn, (x′, y′) after it, γ is the angle of the turn

In space the matrix has three rows and three columns, because a point has three numbers. A turn about Z leaves z as it was and uses the same four numbers for x and y.

A turn changes direction only. Every length and every angle inside the part stays the same, which is how you can test whether a matrix is a true rotation.

To combine two turns, multiply their matrices. The matrix written on the right is applied first: Rx Rz means the Z turn, then the X turn. Only turns about one and the same axis can be swapped.

One worked number

The question

Corner P of a part is at (2, 1, 0). The part turns 30° about the Z axis. Where is P now? Use cos 30° = 0.866 and sin 30° = 0.500.

Show the worked solution, 3 steps
  1. Find the new x

    x′ = 2 × 0.866 − 1 × 0.500 = 1.732 − 0.500 = 1.23.

  2. Find the new y

    y′ = 2 × 0.500 + 1 × 0.866 = 1.000 + 0.866 = 1.87. The turn is about Z, so z stays 0.

  3. Check the length

    Before: √(22 + 12) = 2.24. After: √(1.232 + 1.872) = 2.24. The length did not change, as it must. The figure opens on this case and shows P at (1.23, 1.87, 0.00).

The mistake to avoid

Turns in space do not add like numbers. On a flat page, 30° then 60° equals 60° then 30°. In space, a turn about Z followed by a turn about X is a different result from X followed by Z. A list of angles has no meaning until the axes and the order are stated with it.

Check yourself

Question 1

A point is at (2, 1). It turns 90° counterclockwise about the origin. Where is it now? Use cos 90° = 0 and sin 90° = 1.

Question 2

A program for a robot wrist says: turn 90° about Z, then 90° about X. A technician enters the X turn first, because the two angles are the same. What happens?

Question 3

A link of a robot arm is 0.5 m long. A rotation matrix turns it by 37° about some axis. How long is the link after the turn?

Where you meet it

  • A robot armEach joint adds one turn, and the controller multiplies the matrices in order to know where the tool points.
  • A camera gimbal on a droneThe gimbal applies the opposite of the drone's turn, so the camera keeps looking at the ground.
  • A solar tracker with two axesThe panel turns about a vertical axis and then tilts. The two angles mean something only in that order.
  • A tilt sensor on a machineThe sensor reports gravity in its own axes, and a rotation matrix converts the reading to the axes of the machine.
Key points
  • A rotation matrix records one turn. For a turn about Z its four numbers are cos γ, −sin γ, sin γ and cos γ.
  • A rotation keeps every length and every angle of the part.
  • Two turns are combined by multiplying their matrices. The one on the right is applied first.
  • In space the order of the turns changes the result.
Found this useful?

Discussion

    Comments show your name. Be kind, stay on the topic.