Lie Theory: A Visual Introduction without the Maths

A starting point to understanding Lie theory and optimisation on curved spaces with intuitive demos.

Important Note: This is a visual introduction to Lie groups without any mathematical formalism. The reader is highly encouraged to read A micro Lie theory for state estimation in robotics for an excellent and very intuitive understanding.

Lie Theory in a Nutshell

A Lie group is a smooth curved space containing "things" representing transformations, for example, rotations or poses.

We can't do optimisation and maths directly on the curved space, so we temporarily work in a flat "tangent space", then convert the result back to the curved space.

Many resources for Lie Theory immediately go deep into mathematical details. This one won't.

The SO(3) Lie group (the space of all 3D rotations) visualised as a sphere (blue), along with its Lie algebra (green).

Functions and Optimisation

A function takes an input, does something, and returns an output.
We often need to optimise: find the best input that minimises some constraint (a cost function).

Let's say we have a starting guess for the best input (which is often random). Other than randomly trying different inputs, how do we actually find the optimal input?

  1. Perturb: Nudge the input in each of its dimensions and plug in to the cost function.
  2. Gradient: calculate the gradient.
  3. Step: update your input by taking a small step against the gradient direction.

This is easy if your function operates on Euclidean space (vectors).

Let's say the input is a vector, (a 2D point) (x_1, x_2).
If you perturb x_1 by a tiny \delta: you get (x_1 + \delta,\, x_2), still a perfectly valid 2D point which you can feed into your function.

Figure 1. Optimisation in Euclidean space.
Drag the input x on the grid to see the cost function output change. On the right, the cost function is shown as a surface: height is f(x). Click through the optimisation steps to see how the optimal input is found.

Optimising over a rotation

That was easy because the input was a plain vector. What if the input is a rotation? Take the simplest case — 2D rotations, like a robot's heading or a steering angle.

A 2D rotation is usually written as a matrix:

R(\theta)=\begin{bmatrix}\cos\theta & -\sin\theta \\ \sin\theta & \cos\theta\end{bmatrix}

It has four numbers, but they're not independent: the columns must be unit-length and perpendicular, and the determinant must be +1. There is only one real degree of freedom: the angle \theta.

Now try to perturb each element by \delta to estimate a gradient. The result has columns that are no longer orthonormal and a determinant that is no longer 1. It is not a rotation anymore, just a 2×2 grid of numbers, which we can't feed back into our cost function.

Figure 2. Invalid perturbations on a rotation matrix
Perturb any matrix element of a rotation matrix by dragging it to add some \delta, and it stops being a rotation. Watch as the two basis vectors stop being perpendicular and unit length — the determinant is no longer 1.
Key line: you cannot "perturb one number" of a rotation and stay a rotation. The naive gradient step is illegal.

Manifolds: the shape of "all valid inputs"

Not every matrix is a rotation. In 2D, only orthogonal matrices with determinant 1 are rotations. Together they form the SO(2) Lie group. Because every such matrix is determined by a single angle, θ, we can represent the SO(2) manifold (space) as a circle in 2D, with each point on the circle representing an element of the group.

Similarly, SO(3) is the set of all 3×3 orthogonal matrices with determinant 1. These 3D rotations form a three-dimensional curved manifold. This can't be drawn directly, so we'll use a sphere to represent it.

SO(2) and SO(3) are Lie groups: they are both manifolds and groups; elements of the group can be composed (combined) together, inverted, interpolated smoothly, and include an identity element (a "do-nothing" operation).

Figure 3. Points on a Manifold
Two manifolds side by side: the SO(2) circle and the SO(3) sphere. Drag the point on either one — each point is a group element, and the cutaway shows the coordinate frame it represents. The group Identity is shown at ε.

Tangent Space, Exp and Log maps

When working with Lie groups, we want the best of both worlds: ensure the input is always on the manifold (always a valid rotation), but do any maths in an easy-to-work-with flat (Euclidean-like) space, known as the tangent space. Every point on the manifold has a tangent space at that point. (If the manifold is a ball, imagine the tangent plane at a point on the ball.)

Technically the tangent space contains infinitesimal increments that update elements of a Lie group. e.g. for SO(2), a tangent-space element is a small angle dθ.

The tangent space at the identity element ε is called the Lie Algebra.

Two mappings (functions) connect a Lie group (manifold) to its Lie algebra (tangent space at the identity element ε), and they are inverses of each other:

Don't worry about the superscript \wedge for now, we'll explain it in the next section.

In this demo, press log to lift a point into the Lie algebra (tangent space at the identity ε), and exp to retract (wrap) it back onto the Lie group (manifold).

Figure 4. The log and exp maps.
Click the log and exp map buttons to see the relationship between points on the manifold and points in the tangent space.

The Cartesian Workspace as a Proxy Tangent Space

What we'd really like is to do the tangent-space maths in a nice Euclidean space \mathbb{R}^n — where everything is a vector that you can add, subtract, and differentiate freely.

But a tangent space isn't necessarily that. Its elements can be strange objects: an element of SO(2)'s tangent space is actually an imaginary number i\theta, despite the single degree of freedom \theta. A member of SO(3)'s tangent space is actually a 3×3 skew-symmetric matrix, even though there are only 3 degrees of freedom here.

Luckily, the tangent space of a Lie group with n degrees of freedom is isomorphic to \mathbb{R}^n — a nice one-to-one mapping with a Euclidean space (\mathbb{R}^1 for SO(2), \mathbb{R}^3 for SO(3)).
Let's call this the Cartesian Workspace. Working here is equivalent to working in the tangent space, just a lot easier so we can think of it as a proxy to the tangent space.

Since we will always work with Cartesian Workspace vectors, we just need to introduce two operators:

Figure 5. The isomorphism between the Lie algebra and the Cartesian Workspace.
Edit the Cartesian Workspace vectors on the right to see how the Lie algebra elements change. The hat (\cdot)^\wedge operator lifts vectors up onto the Lie algebra, and the vee (\cdot)^\vee operator brings Lie algebra elements back down to the Cartesian Workspace.
Key line: the tangent space is isomorphic to plain \mathbb{R}^n, so you get minimal, constraint-free coordinates to optimise in.

The Importance of Lie Groups

Lie groups, tangent spaces, and the log and exp maps underpin a huge amount of robotics optimisation:

When dealing with uncertainty over Lie groups, a Gaussian distribution is defined in the tangent space around a mean Lie group element.

Figure 6. Points are randomly sampled from an isotropic Gaussian distribution in the flat tangent space at the Lie group identity. Each sample is visualised on the manifold, where the round shape of the Gaussian blob becomes warped. Drag the mean far from the base and increase \sigma to exaggerate it — this is why flat-space statistics on rotations fail.

Summary

Robotics and Engineering often involve dealing with mathematical objects in curved spaces known as Lie groups. Optimisation on these spaces is tricky because the objects are constrained and can't be perturbed freely.

The whole idea is to journey across three spaces. We want to optimise on the Lie group (the curved space of valid transformations) but can't do maths there directly.
So we hop via the log map to its Lie algebra, and then, via the vee operator, to the plain Cartesian Workspace \mathbb{R}^n, where ordinary vector maths just works. Do the maths there, then travel back to the Lie group using the hat operator and exp map.

Lie Group
Want to do maths here
Can't do maths here
\log
\exp
Tangent Space / Lie Algebra
Can do maths here
but it's unwieldy
(\cdot)^\vee
(\cdot)^\wedge
Cartesian Workspace
Can do maths here
easy to work with
Next Steps:
Make sure to read A micro Lie theory for state estimation in robotics which was an inspiration for this work.

For an application of Lie theory in robotics, see DANCeRS: A Distributed Algorithm for Negotiating Consensus in Robot Swarms.