Loading editor...

Lie algebra

6. Lie groups and Lie algebra

We have already seen, but not formally acknowledged, that the set of all rotations in an -dimensional space forms a group. This group is called the special orthogonal group and is denoted by .

Let be rotation matrices. Then:

  • Closure: the product of any two rotation matrices is also a rotation matrix, i.e. .
  • Associativity: matrix multiplication (and hence composition of rotations) is associative, i.e. .
  • Identity: the identity matrix is a rotation matrix, and .
  • Inverse: for every rotation matrix there is an inverse rotation matrix , such that .

Another interesting property about this set of rotations is that one can find two elements that are arbitrarily close to each other. You can imagine the elements of this set as points in a space. The points are so close to each other that they form a surface (or a manifold).

Now we will move on this smooth manifold, which is also a group, and try to gain some insights from it. A group which is also a smooth manifold is called a Lie group. Thus the set of all rotations in an -dimensional space is a Lie group.


6.1 First approach - taking a small step on this manifold

Say you're moving along a smooth curve in the rotation manifold. At time , you are at point corresponding to the identity matrix . You take a small step in the direction of a matrix . You reach a point where is a small number. Since is a rotation matrix, we can see that:

where the last step drops the term since is small.

Thus, any small step on this manifold should satisfy . In other words, is skew-symmetric.

6.1.1 What exactly is here:

can be seen as the velocity at point as one moves along the curve .

Recall the familiar rotation matrices from earlier chapters. In 2D, a rotation by angle is:

In 3D, rotations by angle about the -axis, about the -axis, and about the -axis are:

None of these matrices are themselves skew-symmetric, but , so each one sits at the identity when its angle is . If we differentiate any of them with respect to its angle and evaluate at that point, we get exactly the kind of "small step direction" from §6.1:

Notice the mirrored pair of entries at position and : sits opposite across the diagonal, so swapping the two indices negates the value, i.e. . That is exactly skew-symmetry, matching what we found in §6.1.

This is the bridge between the abstract argument above and the concrete rotation matrices we already know: the skew-symmetric matrices are the generators of rotations, obtained by differentiating the rotation matrices at the identity.

6.1.2 Action of skew-symmetric matrices

Every skew-symmetric matrix is a scalar multiple of the generator we just found:

Now let's see what applying once, does to a whole ring of points at once.

  • Applying once maps to .
  • Note that for any input point, the output point is perpendicular to it.
    • First
    • Second
    • Third
  • Changing only changes the length of the output vector, not its direction. It continues to remain perpendicular to the input vector.
    • Set
    • Set
    • Set
    • Set

Geometrically, a skew-symmetric step pushes every point in a direction perpendicular to its position vector.

On the , take and draw . Every arrow lands along the tangent, so a small step never leaves the circle.


6.2 Lie algebra for 2D Rotations

In 2D, any skew-symmetric matrix can be written as a scalar multiple of a single generator matrix :

Now, a small step in the direction of this matrix can be represented as:

where is a large number. In §6.1 we saw that this is a rotation matrix, let's call it .

A rotation by angle can be seen as a composition of rotations of angle each:

As gets large, this expression can be approximated to:

Now let's see what happens as we compute higher powers of :

Since , the powers of cycle with period 4, repeating the pattern forever (, , and so on). Grouping the even powers and odd powers of in the exponential series therefore separates it into the Taylor series for and :

This is the matrix representation of a 2D rotation by an angle . The key insight here is:

A rotation matrix is an exponential of a skew-symmetric matrix

The outcome is that a finite rotation can be seen as taking a large number of extremely small steps on the Lie group of 2D rotations. Let's see it in action:

We can watch this convergence directly. On the , start from . The true rotation carries it along to .

Each Euler step instead lands slightly outside the circle, so a run of steps traces that spirals outward and lags behind. shows the current step count.

  • Increase the number of steps and you get a better approximation to the rotation.
import numpy as np
from scipy.linalg import expm, logm
angle = np.pi/4
base_skew = np.array([[0, -1], [1, 0]])
skew = base_skew * angle
# same as np.array([[np.cos(angle), -np.sin(angle)], [np.sin(angle), np.cos(angle)]])
print(expm(skew))

'''
Output:
array([[ 0.70710678, -0.70710678],
       [ 0.70710678,  0.70710678]])
'''

# it can also be written as cos(angle) * I + sin(angle) * skew_symmetric_matrix
R = np.cos(angle) * np.eye(2) + np.sin(angle) * base_skew
print(R)

'''
Output:
array([[ 0.70710678, -0.70710678],
       [ 0.70710678,  0.70710678]])
'''

# logm takes a matrix and returns the skew-symmetric matrix
print(logm(R))

'''
Output: (equal to angle * base_skew up to floating point errors)
array([[-2.84558859e-16, -7.85398163e-01],
       [ 7.85398163e-01, -4.85080479e-17]])
'''

6.3 Second approach - differentiating the constraint

Imagine you are moving along a curve on the Lie group of rotations, just as in §6.1. At time , you are at the identity matrix. At any given time, you are at a point given by the rotation matrix .

The constraint that you are always on the Lie group of rotations is given by . For simplicity, we write . Since , we can differentiate this equation with respect to :

where . The last line says that is a skew-symmetric matrix .

Thus we have:

This is a differential equation with the initial condition of . The solution to this equation is: .

We arrived at the same conclusion as before, that any element of the Lie group of rotations can be represented as an exponential of a skew-symmetric matrix.


6.4 Lie algebra for 3D Rotations

Now we look at how to create general skew-symmetric matrices for 3D rotations. We can write any skew-symmetric matrix as:

Here can be considered the basis vectors for the Lie algebra of 3D rotations. It can be shown that it is isomorphic to the vector space. In other words

An element of the 3D vector space can be converted into a skew-symmetric matrix which can be exponentiated to get a rotation matrix.

Write , where:

Then is the angle of rotation, and is the (unit) axis of rotation, by the right-hand rule. This is the 3D analogue of §6.2: there, was directly the coefficient of the fixed generator . Here, the magnitude of plays that role, while its direction additionally picks out the axis, something 2D didn't need since it only had one possible axis (perpendicular to the plane).

Exponentiating the skew-symmetric matrix gives a closed form known as Rodrigues' rotation formula:

where denotes the hat map (skew-symmetric matrix) of .

The three stages above map: Vector space → Lie algebra → Lie manifold.

def hat_map(x:float, y:float, z:float) -> np.ndarray:
    return np.array([[0, -z, y], [z, 0, -x], [-y, x, 0]])

def exponential_map(skew_symmatric_matrix:np.ndarray) -> np.ndarray:
    return expm(skew_symmatric_matrix)

# a very small rotation around the x-axis
print(exponential_map(hat_map(0.01, 0, 0)))

'''
Output:
[[ 1.          0.          0.        ]
 [ 0.          0.99995    -0.00999983]
 [ 0.          0.00999983  0.99995   ]]
'''

There is a lot more to be said about Lie algebras but it may require another series of articles.


← Geometric algebra