Chapter 02 · Turn the maths into robot motion
Today in the field story
One problem, then the next
A technician rotates the Camera-Crane Recovery’s cardboard axis triad and accidentally sketches a mirror image that still preserves lengths. Test the orientation with perpendicular unit axes, transpose-inverse behavior, and determinant +1. The mission needs this gate because a reflected camera frame can make a plausible overlay while reversing the physical handedness used by every later pose.
- Why now
The frame chain needs a rule for accepting real rigid rotations and rejecting reflections or distorted matrices.
- Ignore today
Ignore arbitrary matrix decompositions and numerical optimization beyond a documented tolerance.
- Unlocks next
Valid 3D orientations for quaternions and SE(3).
Understand
Build the physical picture first
A proper rotation matrix is three unit rulers bolted together at right angles. You may turn the whole triad, but you may not stretch a ruler, change a right angle, or flip the triad into a mirror image.
A 3D rotation matrix R has three columns. Under the common convention, those columns are the rotated frame's x, y, and z unit axes written in the reference frame. Nine numbers appear, but they cannot vary independently because the three axes must stay unit length and perpendicular.
The compact check RᵀR=I says exactly that: each column dotted with itself is 1, and different columns have dot product 0. It also gives the useful inverse R⁻¹=Rᵀ. A rigid rotation therefore preserves vector lengths and angles, which is why a solid gripper does not change shape when its orientation changes.
Orthogonality alone still allows a mirror reflection. The extra check det(R)=+1 keeps the axes right-handed and excludes reflections with determinant -1. SO(3), read 'special orthogonal group in three dimensions', is the set of all 3×3 matrices satisfying both conditions. 'Group' means valid rotations remain valid when composed and each has a valid inverse.
Computer results are rarely exact because floating-point arithmetic rounds values. Production code checks that RᵀR is close to I and det(R) is close to +1 using a justified tolerance. A determinant near +1 by itself is not enough; a shearing or scaling matrix may still have determinant 1 while failing orthonormality.
Words you need
Name each idea precisely
- SO(3)
The set of proper 3D rotation matrices.
Physical example:Every rigid orientation of a three-axis tool frame belongs to SO(3).
- Orthonormal
Axes are mutually perpendicular and each has length one.
Physical example:A carefully built x-y-z triad with equal unit arrows and 90° angles.
- Transpose
A matrix formed by exchanging rows and columns.
Physical example:For a proper rotation, the transpose provides the exact reverse orientation map.
- Determinant
A scalar that helps detect volume scaling and handedness.
Physical example:A mirror reflection preserves lengths but changes a right-handed triad into a left-handed one, giving -1.
- Reflection
A mirror-like transformation that reverses handedness and is not a proper rotation.
Physical example:Your right hand's arrangement cannot be rotated to become your left hand's arrangement.
Math, one line at a time
Work through today’s relationship
Prerequisite rescue · optionalStart at zero: turns, triangles, and pose chains
A joint turn becomes a tool position only after we define the angle, split a link into horizontal and vertical parts, and follow frame order.
- θ
- theta: the amount a joint has turnedUnit: degrees (°) or radians (rad)
- cos θ, sin θ
- horizontal and vertical fractions of a turned unit linkUnit: no unit
- Tᴬ_B
- position and direction of frame B described by frame AUnit: unitless rotation + metres
A full turn is 360° = 2π rad, so 90° × π/180 = π/2 rad. π is about 3.1416.
For a 1 m link at 90°, x = 1 cos 90° = 0 m and y = 1 sin 90° = 1 m.
For several frames, follow the physical path in order. Multiply transforms only when the touching frame names match, then verify by reversing the path.
Like nested UI transforms, each child inherits its parent's transform; unlike UI, the order can move metal into an obstacle.
What are x and y for a 2 m link at 0 rad?
x = 2 cos 0 = 2 m; y = 2 sin 0 = 0 m.
For a grid ,
A quarter-turn has
Adding an unchanged z-axis makes the 3D z-rotation determinant . Every must also satisfy .
Prove a quarter-turn is a proper rotation
Use the z-axis quarter-turn R=[[0,-1,0],[1,0,0],[0,0,1]].
Read the columns: c1=(0,1,0), c2=(-1,0,0), c3=(0,0,1).
Compute each length: c1·c1=c2·c2=c3·c3=1.
Compute pairwise dots: c1·c2=c1·c3=c2·c3=0.
Therefore RᵀR=I and R⁻¹=Rᵀ.
Calculate det(R)=+1, so it preserves right-handedness.
Apply R to (1,0,0) and get (0,1,0), with unchanged length 1.
R satisfies both SO(3) conditions and represents a +90° rotation about z.
A proper rotation must pass orthonormality and determinant checks; neither a convincing drawing nor one check alone is sufficient.
Physical examples
Where this appears in real life
Gripper tool frame
A robot wrist turns a rigid gripper from horizontal to vertical while the three tool axes remain fixed to its body.
All axis lengths and pairwise right angles stay unchanged; composing two wrist turns still yields a proper orientation.
IMU orientation sanity check
An IMU or conversion library returns a 3×3 orientation matrix after numerical processing.
RᵀR should be near I and det(R) near +1. A failed check signals corrupt data, convention misuse, or numerical drift.
Hands-on exercise
Make the idea observable
Build a rigid x-y-z triad from three labelled paper strips or safe craft sticks and use a mirror.
Arrange x and y at 90° and define +z with the right-hand rule.
Rotate the entire triad 90° about +z and record each new axis direction as a matrix column.
Check the three column lengths and three pairwise dot products.
Compute the determinant of the corresponding 2D x-y block and include the unchanged z axis.
Observe the triad in a mirror and write the reflected axis mapping.
Explain which test rejects the mirror mapping even though all axis lengths are preserved.
A physical turn preserves handedness; the mirror reverses it. Both may preserve lengths, so determinant and orthogonality answer different questions.
The proper turn passes RᵀR=I and det=+1, while the reflection is explicitly rejected by det=-1.
Build today
Extend the browser notebook into a two-link arm visualizer with frame composition, forward kinematics, and a bounded numerical IK trace.
Evidence to save
DONE when a deterministic “SO(3): safe 3D rotation matrices” failure test reports expected versus actual behavior and passes after the documented fix.
Common mistakes
Catch the wrong mental model
Accepting any 3×3 matrix as an orientation.
Require RᵀR≈I and det(R)≈+1.
Checking determinant only.
Also check unit-length, mutually perpendicular axes; determinant 1 does not exclude shear.
Confusing whether axes are stored in rows or columns.
State the library convention and verify with a known 90° mapping.
Comparing floating-point matrices with exact equality.
Use a documented numerical tolerance appropriate to the calculation and data quality.
Job connection
How this becomes employable evidence
A 3D HMI, calibration pipeline, or motion stack receives orientations from sensors and transforms. Engineers validate matrices before using them so a malformed orientation does not distort geometry or send planning into an invalid state.
Relevant target roles
- Robot HMI / Control & Monitoring Engineer
- Robotics Application / ROS 2 Integration Engineer
- Robotics Software Engineer — ROS 2 / AMR
Chapter 02 interview drill
Interview questions: SO(3): safe 3D rotation matrices
Practise a 60–90 second answer: define the idea, connect it to a physical robot, state assumptions, frames, and units when relevant, then finish with the failure signal or evidence you would inspect.
Primary interview scenario
A 3×3 matrix has determinant 1. Is it definitely a rotation? State the remaining test, tolerance issue, and one physical invariant.
Answer shape: clarify the situation → trace the physical and software path → test the most likely boundaries → name the evidence that would confirm the result.
Technical follow-up questions
Q1What do diagonal and off-diagonal entries of RᵀR test?
Diagonal entries test each column's squared length; off-diagonal entries test pairwise perpendicularity.
Q2Why is a reflection excluded from SO(3)?
It reverses handedness and has determinant -1 even though it may preserve lengths.
Q3Why is Rᵀ useful?
For a proper rotation, Rᵀ=R⁻¹, so it reverses the orientation mapping without a general matrix inversion.