In Chapter 6.1, we wrote a matrix with linearly independent columns as . The columns of form an orthonormal basis of , and records how to recover the original columns from that basis. If has shape , then has shape and has shape .
For example,
What does having orthonormal columns tell us about as a matrix? We’ll see that it describes a transformation that preserves lengths and angles. To show this, we’ll first introduce the transpose.
The transpose¶
The transpose of a matrix , written , is obtained by turning its columns into rows, in the same order. Thus, if has shape , then has shape . For example,
The entry in position moves to position . In particular, the transpose of a column vector is a one-row matrix. This lets us write a dot product as a matrix product:
Strictly speaking, is a matrix, while is a scalar. In this equation, we’re identifying a matrix with its single entry.
Transposing twice brings us back to the original matrix. Transposing also respects addition and scalar multiplication:
When we transpose a product, the order of the factors reverses.
The shapes must allow to be formed. If has shape and has shape , then both sides have shape .
Why does the order reverse? The entry of is the sum of the pairwise products of the entries in row of with those in column of . In , that same calculation appears in position : row of comes from column of , and column of comes from row of .
Orthogonal matrices¶
Write the columns of an matrix as . Then
If the columns are orthonormal, the diagonal entries are 1 and all other entries are 0. Conversely, those entries tell us exactly that the columns are orthonormal. Thus,
What if is square? The equation implies that is invertible, with . We therefore also have .
Despite the name, orthogonal columns alone aren’t enough: they must also have length one. For instance, has perpendicular columns but is not an orthogonal matrix.
For the from our QR example,
So, to find the inverse of an orthogonal matrix, we just transpose it.
The rows are orthonormal too¶
The equation says that the vectors formed from the rows of an orthogonal matrix are orthonormal too. We imposed conditions only on the columns; the conditions on the rows follow automatically.
For example, consider
Each column has squared length , with the terms in a different order for the other columns. The dot products between distinct columns are
So the columns are orthonormal. Without any further calculation, we know that the vectors
formed from its rows are also orthonormal. For instance, the dot product of the first two is , just as predicted.
For another example, consider
The squared lengths of its columns are
and their pairwise dot products are
So is orthogonal, and the vectors formed from its rows,
are also orthonormal. For example, the first two have dot product .
Why the square condition matters¶
A rectangular matrix can have orthonormal columns without having an inverse. For example,
For another example, take the first two columns of the first example above:
Its columns are still orthonormal, so . But
We reserve the term orthogonal matrix for square matrices.
Orthogonal matrices in ¶
Let’s classify all orthogonal matrices. Suppose the first column is
The vectors perpendicular to it lie on the line spanned by . There are exactly two unit vectors on that line, so the second column must be either
Every point on the unit circle can be written as . Therefore, every orthogonal matrix has one of the following forms:
Let’s see what these two possibilities mean geometrically.
The first possibility: a rotation¶
Recall that the columns of a matrix tell us where the standard basis vectors go. A counterclockwise rotation through angle sends
So its matrix is
We take positive angles counterclockwise and negative angles clockwise. Angles differing by give the same rotation. For example, a quarter-turn has matrix
To undo a rotation through , rotate through : . This also follows by transposing the rotation matrix. The identity is rotation through angle zero, and is rotation through .
The second possibility: a reflection¶
A reflection here means reflection across a line through the origin. Let that line make angle with the positive -axis, and write its reflection matrix as .
Think about a ray making angle with the positive -axis. Reflecting it across the line at angle sends it to the ray at angle : the two rays make equal angles with the reflecting line, on opposite sides.
In particular, starts at angle zero and goes to angle . The vector starts at angle and goes to angle . Thus,
These are the columns of the reflection matrix:
This is exactly our second possibility, with . Notice the factor of two: the reflecting line is at angle , while the entries involve . A line at angle is the same line, so it gives the same reflection.
For example, reflection across the -axis and reflection across have matrices
The first sends to ; the second sends it to .
For a less familiar example, reflection across the line at has matrix
It fixes the unit vector along the line and reverses the perpendicular unit vector . In general, a reflection leaves the component along the reflecting line unchanged and negates the perpendicular component.
So, every orthogonal matrix represents either a rotation or a reflection. Conversely, all these rotation and reflection matrices are orthogonal, since their columns are orthonormal.
Lengths and angles stay the same¶
Rotations and reflections preserve lengths and angles. Let’s see why the same is true for any matrix with orthonormal columns, even if it isn’t square.
Suppose has shape and orthonormal columns, so . For any ,
In the second equality, we used . In the third, we used . We didn’t need to be square. This shows that any matrix with orthonormal columns preserves dot products, which gives us the following three properties.
Lengths: Set . Then
so .
Angles: For nonzero , the cosine of the angle between their images is
This is the cosine of the original angle. Since the angle between vectors is taken in , the angle itself is unchanged. In particular, perpendicular vectors stay perpendicular.
Distances: The distance between two points is preserved too, since
The converse is true too. If a linear transformation with domain and codomain preserves lengths and angles, then its matrix is orthogonal. In fact, preserving the length of every vector is enough; preserving angles then follows automatically.
When is square, we call the transformation an orthogonal transformation. These may also be viewed as rigid (distance-preserving) transformations of that fix the origin. In fact, any rigid transformation of that fixes the origin is automatically linear. As with any linear transformation, , so an orthogonal matrix cannot represent a nonzero translation.
Composing orthogonal transformations¶
Suppose and are orthogonal matrices of the same shape. Apply first, then :
The matrix on the right acts first. Keeping track of this order matters when we combine rotations and reflections.
Both transformations are linear and preserve lengths and angles. Their composition has these properties too, so it is orthogonal. We can also check directly:
Two rotations: the angles add¶
Rotate through , then through . The product is
A quarter-turn followed by a half-turn is a three-quarter-turn. The same geometric reasoning works for any angles:
For rotations in the plane, the order doesn’t matter: . Thus . This is a special feature of planar rotations; two orthogonal matrices need not commute.
Trigonometric identities from matrix multiplication¶
We know geometrically that . Multiplying the matrices gives
The top-left and bottom-left entries give the familiar angle-addition formulas:
They express a simple geometric fact: successive rotations add their angles. For example, take and . Their sum is , or , and
Thus,
Combining rotations and reflections¶
A product of orthogonal matrices is orthogonal. In , this means that composing rotations and reflections always gives another rotation or reflection. Let’s determine which one we get and how it depends on the order.
Use the widget below to explore the same transformations. Choose the first transformation and the second transformation , then press Play both steps. The original figure is blue, its image after is orange and dashed, and its image after is pink. All rotations are about the origin, and all reflecting lines pass through the origin. Angles in the controls are in degrees.
A rotation and a reflection give a reflection, in either order. The reflecting line can change when we reverse the order:
Reflect across the -axis, then rotate counterclockwise: the final figure is the mirror image of the original across .
Rotate counterclockwise, then reflect across the -axis: the final figure is the mirror image of the original across .
Two reflections give a rotation:
Reflect across the -axis, then across : the final figure is a quarter-turn counterclockwise from the original.
Reflect across , then across the -axis: the final figure is a quarter-turn clockwise from the original.
In general, two reflections give a rotation through twice the directed angle from the first reflecting line to the second. Reversing the order reverses the rotation. Reflecting twice across the same line gives the identity, a rotation through . We won’t prove these general rules here.
Orthogonal transformations in ¶
In , every orthogonal transformation is a rotation or a reflection. In , we also need to consider a rotation followed by a reflection.
Every orthogonal transformation of is one of the following:
A rotation about a line through the origin.
A rotation about a line through the origin, followed by reflection across the plane through the origin perpendicular to that line.
In the second case, the axis and the reflecting plane are perpendicular. The order of these two particular operations does not matter.
Handedness, also called orientation, distinguishes the two kinds. Turn yourself around however you like: your left hand is still a left hand. A rotation preserves handedness. A reflection across a plane acts like a mirror: the reflected shape of your left hand is a right-hand shape. It reverses handedness. Adding a rotation before the reflection does not undo this change.
To picture the two possibilities, imagine that the axis is the -axis. In the first case, we rotate the horizontal component of each vector and leave its height unchanged. In the second, we perform the same rotation and then change the sign of its height. The matrices are
These are the forms when the axis is the -axis; the classification allows an axis in any direction. This includes several transformations we have already seen:
The identity is a rotation through .
Reflection across a plane is the second case with rotation angle .
Reflection across a line keeps the component along the line and reverses the perpendicular component. This is a rotation through about that line, so it is included in the first case.
Reflection through the origin, , is the second case with rotation angle . For example, a half-turn about the -axis followed by reflection across the -plane gives
So, in three dimensions, a rotation followed by a reflection across a plane need not be a reflection across a plane.
We won’t prove the classification here. Eigenvalues, which we have not yet studied, help explain why such an axis exists and how to find it.
Two rotations in space give another rotation¶
The composition of two rotations about axes through the origin is another rotation about an axis through the origin. Its axis need not be either of the original axes.
To see why, recall that the composition is orthogonal. Both rotations preserve handedness, so their composition does too. It therefore belongs to the first case above: a rotation.
For example, first make a quarter-turn about the -axis, then a quarter-turn about the -axis, with the directions specified by
The composition has matrix
Notice that
So the resulting rotation is about the line spanned by , rather than the - or -axis. In fact, its angle is , not the we would get by simply adding the two angles.
If two rotations have the same axis, we can add their angles just as in the plane. For different axes, the result is still a single rotation, but finding its axis and angle takes more work. The order generally matters too. As usual, the identity counts as rotation through ; any line through the origin can then serve as its axis.
A drone and its camera¶
A drone describes directions using three perpendicular unit arrows attached to its body: forward, left, and body up. Someone on the ground uses east, north, and vertical up. Each choice gives an orthonormal basis, or a coordinate frame. We will describe velocities and directions first, so the locations of the origins do not matter.
The two frames give different coordinates for the same physical vector. Its length and the angle it makes with another vector are the same in either frame. So, the matrix that converts between these coordinates must preserve lengths and angles.
Suppose the drone faces north with its nose tilted upward through an angle , where and . Its left direction is west, while body up is tilted away from vertical.

The forward, left, and body-up unit vectors, expressed in ground coordinates, form the columns of
These columns describe perpendicular unit arrows, so they are orthonormal and . This is why changing between any two orthonormal coordinate frames gives an orthogonal matrix.
Converting a velocity¶
Drone coordinates mean times its forward unit vector, plus times its left unit vector, plus times its body-up unit vector. Matrix multiplication forms exactly this combination of the columns of :
A velocity of 5 m/s forward and 1 m/s left is therefore 1 m/s west, 4 m/s north, and 3 m/s upward. Both descriptions give speed m/s. We have changed the coordinates, not the physical velocity.
Converting back¶
Suppose we want a velocity of 5 m/s vertically upward. Since , its drone coordinates are
This velocity has a forward component of 3 m/s and a body-up component of 4 m/s. The horizontal contributions cancel, leaving only vertical motion. The two conversion rules are
Adding a camera¶
A camera mounted on the drone has its own forward, left, and up directions. Let have as columns the camera’s three unit directions expressed in drone coordinates. Then converts camera coordinates into drone coordinates. It is orthogonal for the same reason as : the camera’s axes are perpendicular unit directions.
To describe a viewing direction in ground coordinates, first convert from camera to drone coordinates, then from drone to ground coordinates:
This explains the order in : acts first. The product is orthogonal because it converts from one orthonormal frame to another.
For example, aim the camera halfway between the drone’s forward and left directions, then tilt its lens downward relative to the drone. Keep the camera’s left axis in the drone’s forward-left plane. Its forward, left, and up unit directions give
The first column describes the lens direction: equally forward and left, and downward. Multiplying gives
All nine entries are nonzero. Each camera axis now has east-west, north-south, and vertical components in ground coordinates.
The direction straight ahead through the lens has camera coordinates , so its ground coordinates are the first column of . The signs tell us that the lens points west, north, and downward. With the camera fixed to the drone, stays the same as the drone turns, while changes. Their product tells us where the camera is looking.
Will the damaged connection be in the picture?¶
A drone is inspecting a tower. Its camera is at ground coordinates
The coordinates are east, north, and height. Use the orientation matrices and above. Model the camera’s field of view as a cone: an unobstructed point appears in the picture if its direction is within of the direction straight ahead through the lens.
Question: Find the displacement from the camera to the connection in camera coordinates. Will the connection appear in the picture? If not, through what smallest angle must the camera turn to put it at the center of the picture? Assume the drone stays fixed and the camera can turn freely.
Solution: First subtract the positions to get the displacement in ground coordinates:
The connection is 6 m west, 16 m north, and 13 m below the camera. To express this displacement in camera coordinates, reverse the two conversions. Apply first, then :
Relative to the camera, the connection is ahead, a little to the left, and below. Being ahead does not by itself mean it will be in the picture: we need the angle from the lens direction.
In camera coordinates, the lens points along . The distance to the connection is m in ground coordinates. Orthogonality tells us that its length is the same in camera coordinates. Thus, the angle satisfies
The connection is outside the picture, since . To center it, turn the camera through toward the connection, mostly downward and slightly left. Turning just toward it would bring it to the edge of the picture.