Derivatives in tangent charts
The derivative of a map between manifolds, its gradient and its Hessian product, all read in the tangent charts a retraction provides, and why automatic differentiation computes them unchanged.
A retraction gives every point of a manifold a chart, its tangent space. This note reads derivatives in those charts: the derivative of a map between manifolds as a matrix, the gradient of a scalar function as a vector, and its second derivative along a direction. Each is what an optimizer or a sampler needs at a point, and none needs a metric.
The derivative#
Let be smooth, between manifolds of dimensions and , each with a retraction, and let . The derivative of at is the matrix of read in the chart at and the chart at :
Equivalently, is the ordinary Jacobian at of the local representative , a map from a neighbourhood of in to . Because each is the identity, it is also the intrinsic differential of , written in the bases that identify the tangent spaces with and .
For smooth and , , every derivative taken in tangent charts.
Near , , with , because is the identity near . The ordinary chain rule at , with , gives the claim.
∎So derivatives in charts compose exactly as Jacobians do, and the passes of automatic differentiation apply unchanged to a program whose steps are maps between manifolds, as long as each step’s derivative is taken in charts. To derive one by hand:
- perturb the input, ;
- push it through, ;
- solve for ;
- the Jacobian–vector product is , and the vector–Jacobian product is its transpose.
The transpose is taken in coordinates: a cotangent at is a row of numbers acting on tangent coordinates, and maps it to a cotangent at . No inner product on the tangent spaces is involved.
The gradient#
For a scalar function , its gradient in the chart at is
the cotangent that a reverse pass seeded with delivers. It says how changes along a step: . With no metric in play, it is the differential of written in chart coordinates, not a Riemannian gradient.
The Hessian product#
The second derivative needs a choice that the first does not, because moving along a direction moves the chart as well. The chart Hessian differentiates the gradient along a direction , reading the gradient at each point in that point’s own chart:
The other candidate is the Hessian of the pull-back , which keeps the chart at fixed. On a flat manifold the two are the same matrix, the ordinary Hessian. On a curved one they differ by a term proportional to the gradient.
Let and , defined near for small . Then
so at every stationary point, where .
For small and near , , with the identity and by (3). So near , and
Differentiating at , with and , gives the claim.
∎On the rotations, with the retraction , the Baker–Campbell–Hausdorff formula gives , up to terms of order and , so the correction is : the chart Hessian is the Hessian of the pull-back plus the skew-symmetric matrix , and it is not symmetric away from a stationary point. On the positive reals, with , the charts commute instead: , whose derivative does not move with , so the correction vanishes and the two Hessians agree everywhere. Which symmetric matrix to use where they differ, if one is needed, is the algorithm’s decision. At a stationary point, which is where curvature is most often read (a Laplace approximation, a Newton step’s convergence), the two agree.
Programs over manifolds#
The chart Hessian is the one a forward-over-reverse pass computes, provided each step’s second-order map is read in charts the same way.
Let a program’s steps be maps between manifolds, with partial derivatives taken in tangent charts, and define each step’s second-order map at its inputs , with velocities , by
Then for a scalar target , the reverse pass delivers the chart gradient at the roots, and forward-over-reverse with velocities delivers the chart Hessian product .
First order is Proposition 2 applied step by step. For the second, the reverse recurrence holds identically in , with every evaluated at the slot values computed from and read in the charts at those values. Differentiate it along . Each slot traces a curve through whose velocity in the chart at is , the velocity the forward pass computes. The derivative of the smooth function along a curve depends only on the curve’s velocity, so it equals the derivative along , which is . The product rule then gives the forward-over-reverse recurrence, and at a root the differentiated quantity is , whose derivative is (4).
∎Built on by
- Product manifolds A product of manifolds is a manifold whose tangent space stacks its factors', and whose retraction acts factor by factor; derivatives in its charts are block matrices of the factors'.
- The problem The mathematics the core rests on, from quantities, their charts and their products, through operations and their derivatives of first and second order composed over programs, to queries, terms, importance weights, random keys and retirement.