Logarithm & Exponential

Exponential and logarithm functions appear throughout SLAM in the context of Lie groups and Lie algebras. Beyond their familiar scalar forms, their matrix versions are the bridge between rotations (which are hard to optimize) and vectors (which are easy to optimize).

Scalar refresher

The exponential ex=k=0xkk!e^x = \sum_{k=0}^{\infty} \frac{x^k}{k!} and its inverse log(x)\log(x) satisfy the identities that make them useful:

ea+b=eaeb,log(ab)=loga+logbe^{a+b} = e^a e^b, \qquad \log(ab) = \log a + \log b

The log identity already earns its keep in probability: likelihoods are products of many small numbers, which underflow floating point; taking the logarithm turns the product into a numerically stable sum — this is why estimators minimize a negative log-likelihood rather than maximize the likelihood itself.

The problem with rotations

Rotation matrices RSO(3)R \in SO(3) are not a vector space — you cannot add two rotations and get a rotation, so you cannot apply vanilla gradient descent to them. But their Lie algebra so(3)\mathfrak{so}(3) (the tangent space at the identity) is a vector space: an element is just a 3-vector ϕ\boldsymbol{\phi} (axis-angle), written as a skew-symmetric matrix [ϕ]×[\boldsymbol{\phi}]_\times.

Exponential and logarithm maps

The matrix exponential is defined by the same power series as the scalar one, exp(A)=k=0Akk!\exp(A) = \sum_{k=0}^{\infty} \frac{A^k}{k!}, and for skew-symmetric arguments the series collapses to a closed form:

exp([ϕ]×)=I+sinθ[n^]×+(1cosθ)[n^]×2\exp([\boldsymbol{\phi}]_\times) = I + \sin\theta\,[\hat{\mathbf{n}}]_\times + (1 - \cos\theta)\,[\hat{\mathbf{n}}]_\times^2

This is Rodrigues’ formula — a closed form of the matrix exponential series, obtained because powers of a unit skew-symmetric matrix cycle: [n^]×3=[n^]×[\hat{\mathbf{n}}]_\times^3 = -[\hat{\mathbf{n}}]_\times.

For small rotations, keeping only the first-order term gives the ubiquitous approximation

exp([ϕ]×)I+[ϕ]×(ϕ small)\exp([\boldsymbol{\phi}]_\times) \approx I + [\boldsymbol{\phi}]_\times \qquad (\|\boldsymbol{\phi}\| \text{ small})

which is exactly the linearization used when deriving Jacobians of residuals with respect to rotation perturbations.

The same construction extends to full rigid-body poses: exp\exp maps se(3)\mathfrak{se}(3) (6-vectors: translation + rotation) to SE(3)SE(3) (homogeneous transformation matrices), and log\log maps back.

Why the scalar intuition still helps

The familiar identities carry over in spirit: the exponential turns addition into composition (ea+b=eaebe^{a+b} = e^a e^b for commuting arguments), and the logarithm turns composition back into something additive. This is exactly what optimization needs: express a small correction as a vector ξ\boldsymbol{\xi}, apply it multiplicatively as TTexp(ξ^)T \leftarrow T\cdot\exp(\hat{\boldsymbol{\xi}}), and measure pose errors as log(T11T2)\|\log(T_1^{-1}T_2)\|.

One caveat worth remembering: for matrices, eA+B=eAeBe^{A+B} = e^A e^B holds only when AA and BB commute — and rotations about different axes do not. That non-commutativity is precisely why 3D rotations need Lie theory rather than plain vector addition.

Common pitfalls

Why it matters for SLAM

Logarithms and exponentials let us “linearize” rotations and poses, making them amenable to gradient-based optimization — every modern SLAM back-end (g2o, GTSAM, Ceres with manifold parameterizations) updates poses through the exponential map, and pose graph errors are defined through the logarithm map. Getting comfortable with exp/log\exp/\log now pays off directly when you study Lie groups properly at Level 2.