Riemannian gradients and metric choice
Recover a gradient from a differential using the chosen metric and recognize metric design as structured preconditioning.
On this page
The question for today
What you’ll understand
- Define the gradient through the metric duality identity.
- Explain why Euclidean tangent projection gives the gradient only for the induced metric.
- Compute gradients on a sphere with two different metrics.
The differential of an objective is a linear map on tangent vectors. A gradient represents that differential as an inner product, so its vector value depends on the metric used for the representation. Changing the metric can improve conditioning without changing the objective or feasible set. It also changes lengths, steepest directions, Hessians and the interpretation of step sizes. Treating an ambient Euclidean gradient as an intrinsic geometric object obscures this dependence and can quietly mix incompatible formulas within one algorithm.
The differential precedes the gradient
At x, the differential dfₓ assigns a directional derivative to each tangent η. A Riemannian metric is a smoothly varying positive-definite inner product on tangent spaces. The Riemannian gradient is the unique tangent vector satisfying gₓ(grad f,η)=dfₓ[η] for all η. Positive definiteness ensures uniqueness. In a coordinate frame with metric matrix G, its coordinate vector is G⁻¹ times the differential coefficients, not necessarily the ordinary list of coordinate partial derivatives. The frame and metric must both be specified.
The negative gradient gives the largest first-order decrease among tangent vectors of fixed metric norm, after normalization when it is nonzero. Its derivative of the objective is minus its squared metric norm. A different metric therefore changes which ambient direction qualifies as steepest while leaving the scalar differential along each fixed tangent direction unchanged. Critical points, where the differential vanishes, are metric independent, although gradient norms and rate constants are not. This distinction is central when comparing a geometric algorithm with an apparently different preconditioned method.
Projection is a special metric-duality formula
For an embedded manifold with the metric induced by its ambient Euclidean space, an ambient gradient can be orthogonally projected onto the tangent space. The normal part does not contribute to directional derivatives along tangents. This yields the intrinsic gradient of the restricted objective, independent of how the smooth objective was extended off the manifold. If the tangent metric changes, projecting the same ambient gradient with the old Euclidean projector generally no longer satisfies the required duality identity.
For a sphere with a metric induced by a constant ambient positive-definite matrix M, solve the duality equation together with xᵀgrad f=0. The answer involves M⁻¹ and a weighted normal correction. Preconditioning first and then using an unmodified Euclidean projection can be wrong, because the weighted normal direction is M⁻¹x rather than x. When M preserves the current tangent space the expression simplifies, but that is a special alignment condition rather than a general rule for weighted manifold gradients.
A useful metric must remain computationally coherent
A metric can incorporate problem scales, approximations to curvature or quotient symmetry, acting as geometric preconditioning. To define a Riemannian metric it must be smooth and strictly positive on every nonzero tangent vector; a singular approximate Hessian is not automatically an admissible metric. A practical implementation must also solve the metric-duality system efficiently. A metric that makes a formal condition number attractive but requires an expensive dense inverse may lose the intended computational benefit.
On Stiefel manifolds, the induced Frobenius metric and the canonical metric differ in how they weight rotations within the current frame relative to changes of subspace. Their gradient formulas should not be interchanged. On a quotient, the metric must respect the equivalence action before it descends consistently. These are separate constraints from choosing a retraction, which only preserves the local first-order update structure. Rates or comparisons between methods must state the metric in which gradients, smoothness constants and trust-region radii are measured.
Work it through
Two gradients for one sphere differential
On S² at x=e₁ let an ambient objective have gradient G=(2,8,9). Compare the induced Euclidean gradient with the gradient for M=diag(1,4,9), and test the latter on η=e₂.
The tangent plane has first coordinate zero. Euclidean projection gives grad_E f=(0,8,9).
Preconditioning gives M⁻¹G=(2,2,1). The weighted normal correction removes its first coordinate, so grad_M f=(0,2,1).
For η=e₂, the metric pairing is (0,2,1)ᵀM e₂=8, exactly the differential Gᵀη. Also the squared metric norm of grad_M is 4·2²+9·1²=25, so its negative direction has derivative −25.
The same differential is represented by different gradient vectors. Each must be paired with its own metric; comparing their raw coordinates alone does not compare steepest-descent performance.
The living notebook
Explore the model
Interactive lab · matrix
A linear scaling changes a flat metric
Pause and Reset, then set scale a=2,shear b=0. Interpret M=AᵀA=diag(4,1): for differential coefficients (1,1), predict metric-gradient coordinates (1/4,1). The instrument’s singular values are 2 and 1. For a fresh comparison Reset and set a=1,b=0; predict M=I and gradient (1,1). The readouts describe the selected final A, not the gradient or a curved-manifold optimizer; the duality calculation is supplied separately.
- Area scale · det A
- 1.4
- Singular values · σmax, σmin
- 1.597, 0.876
- Condition number · κ₂(A)
- 1.823
The selected matrix is A = [[a,b],[0,1]]. Playback interpolates geometry between the identity and A; readouts always describe A. Its determinant is a and its singular values come from AᵀA. Positive a makes every supported matrix invertible. This two-dimensional family is not a general eigensolver or a learned network. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forChanging a positive metric rescales the gradient representation even before any manifold curvature is introduced.
Pause & reason
Check your understanding
Your turn
Try it yourself
On the unit circle take x=(1,1)/√2, M=diag(1,4), and f(x)=x₁. Compute the weighted gradient and verify tangent feasibility and its squared metric norm.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Use M⁻¹G=(1,0), xᵀM⁻¹x=5/8 and the weighted normal correction.
Compare with the solution
The correction coefficient is (1/√2)/(5/8)=8/(5√2). Multiplying it by M⁻¹x=(1,1/4)/√2 gives (4/5,1/5). Hence grad_M f=(1/5,−1/5). Its dot product with x is zero, while its squared metric norm is 1/25+4/25=1/5. The differential along that vector is its first coordinate, also 1/5, as required by metric duality. Euclidean projection would instead give (1/2,−1/2).
Keep the idea
Take it with you
- A gradient is the metric representation of an objective differential.
- Ambient orthogonal projection yields the gradient for the induced metric.
- Metric design changes conditioning and algorithmic constants while preserving critical points.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.