explainer
Manifolds and tangent spaces: move along a constraint
Use the unit circle to understand local coordinates and tangent vectors. Compare straight steps, exact rotation, and normalization, then examine why averaging headings and rotations needs care.
What you will learn
- Explain how one local coordinate describes the unit circle inside a two-dimensional space.
- Derive the tangent constraint and distinguish tangent vectors from points.
- Compare a straight tangent step with exact rotation and a normalized update.
- Identify coordinate seams, cancelled means, and rotation representation ambiguities.
Before you start
- Dot products and orthogonal directions
- Derivatives and the chain rule
- Sine, cosine, and radian angles
Start at (1, 0) on the unit circle and step straight upward by 1. The direction is tangent to the circle, yet the new point (1, 1) has length √2. A valid local direction has produced an invalid constrained point.
Manifolds and tangent spaces give us language for that distinction. You will derive the allowed directions, compare two updates that stay on the circle, and check what can go wrong when averaging headings or rotations.
Describe a curved set with local coordinates
The unit circle S¹ contains all points (x, y) satisfying x² + y² = 1. Its points use two ambient coordinates, x and y. Its intrinsic dimension is one: locally, one number locates a point along the curve.
A smooth manifold has neighborhoods that admit Euclidean coordinates with smooth changes between overlapping coordinate descriptions. For this circle, a small arc behaves locally like an open interval. The full circle wraps around, so its global shape differs from a straight line.
For a concrete local coordinate, consider the right half of the circle, where x > 0. Choose y in (−1, 1), then recover x = √(1 − y²). This gives a smooth coordinate description of that open arc; a different description covers the left side.
Angles give another useful local description:
γ(θ) = (cos θ, sin θ)
Angles θ and θ + 2π identify the same point. Any single wrapped angle convention has a seam, such as the jump from +180° to −180°. The circle remains smooth at that location; the chosen coordinate jumps. Modern Robotics illustrates this distinction between a configuration space and its coordinates.
Differentiate the constraint to find tangent vectors
Let p(t) trace any differentiable curve on the unit circle. The constraint says p(t) · p(t) = 1. Applying the chain rule gives:
2p · p′ = 0
p · v = 0
Every tangent velocity v is perpendicular to the radius p. Conversely, every vector perpendicular to p occurs as the initial velocity of a circle curve. The tangent space T_pS¹ contains exactly these vectors, including zero.
At p = γ(θ), differentiating with respect to a radian angle gives the unit tangent u = (−sin θ, cos θ). Every tangent vector has the form v = αu for a real scalar α. This one-dimensional vector space contains directions and magnitudes, with vector addition and scalar multiplication.
We represent tangent vectors as free vectors in ℝ². At p = (1, 0), they have components (0, α), so this vector space passes through the origin. Drawing those vectors with their tails at p produces the affine tangent line p + T_pS¹, the vertical line x = 1.
The base point matters. At p = (0, 1), the tangent vectors are horizontal. A vector tangent at one point can fail the tangent constraint at another point.
Check what a straight tangent step does
Choose a tangent displacement ξ = hu, where h is an angle in radians on this unit circle. The straight update is s = p + ξ. The coordinates are dimensionless; h describes a displacement, with no time interval implied.
Use ‖p‖ = ‖u‖ = 1 and p · u = 0 to calculate:
‖p + hu‖² = 1 + h²
‖s‖² − 1 = h²
Every nonzero straight tangent step leaves the circle. Tangency enforces the constraint's first-order change at the starting point. The quadratic term records the finite step's departure.
This is the same local limitation that appears in Taylor linearization. A tangent line matches the curve's position and direction at one point. Curvature separates them as the step grows.
Return to the circle in two different ways
An exact rotation through h radians follows the circle:
r = cos(h)p + sin(h)u
r = γ(θ + h)
With the circle's usual length measurement, this is its exponential map applied to ξ = hu. It follows a constant-speed circular arc with the requested initial tangent displacement over a unit parameter interval.
The geodesics lesson compares these circular paths with a straight chord and shows why a constant-speed arc can take the longer route. The exponential and logarithm maps lesson develops the related Lie-group construction for planar poses, where translation and rotation interact.
A normalized update first forms s = p + hu, then divides by its length:
n = (p + hu)/√(1 + h²)
This normalization is a retraction: it returns a point on the manifold, fixes p at zero step, and has the correct tangent derivative there. Boumal's optimization text, Example 3.49, gives both sphere updates and explains their local agreement.
For this formula, the denominator is always positive. The unit base point and its tangent displacement cannot cancel. Returning arbitrary vectors to the circle needs a separate nonzero check.
In the orthonormal basis (p, u), the normalized point has coordinates (1, h)/√(1 + h²). Its signed turn is atan(h), which lies between −π/2 and π/2. Exact rotation turns by h; the two endpoints generally differ.
Both updates have the same first derivative at zero. Their angle difference starts with h − atan(h) = h³/3 + O(h⁵) near zero. Small steps make this discrepancy small, but unit norm alone does not establish that an update follows the intended motion.
Work through a one-radian step
Set θ = 0, so p = (1, 0) and u = (0, 1). Choose h = 1 radian, about 57.3°. The tangent displacement is ξ = (0, 1), and p · ξ = 0.
The three results are:
- Straight: s = (1, 1), with norm √2 ≈ 1.414214 and squared constraint error 1.
- Rotated: r = (cos 1, sin 1) ≈ (0.540302, 0.841471), with norm 1.
- Normalized: n = (1/√2, 1/√2) ≈ (0.707107, 0.707107), with norm 1.
The normalized step turns by π/4 ≈ 0.785398 radians. Its angular shortfall is 1 − π/4 ≈ 0.214602 radians, about 12.3°. It satisfies the circle constraint while reaching a different point from the requested one-radian rotation.
Move the base point and change the step
The experiment uses the same formulas as the worked example. Its tangent arrow starts at p; the dashed line shows the affine tangent line. Both plot axes use the same scale.
Try these comparisons:
- Small tangent step: h = 0.1 makes the signed angle gap about 0.000331 radians. Close markers can overlap, so compare their coordinate readouts.
- Negative tangent step: h = −1 reverses the direction. Both circle updates turn clockwise, and the signed angle gap becomes −0.214602 radians.
- Zero tangent step: every endpoint equals p, and all norms equal 1. The tangent displacement is zero.
- Base point at 90 degrees: p moves to (0, 1), and the positive tangent direction becomes (−1, 0). The same local calculation now points left.
The Tangency p · ξ readout checks the starting direction. The Constraint error checks the straight endpoint. These answer different questions, even when the first readout is zero.
Check the meaning of an average
Suppose two robot heading estimates are +179° and −179°. Their arithmetic mean is 0°, which points almost opposite both observations. This failure comes from averaging across the wrapped coordinate's seam.
A common circular mean averages the unit vectors and takes the resulting direction. Here their average is approximately (−0.999848, 0). Normalization gives (−1, 0), the 180° heading. SciPy defines this circular mean using the mean resultant vector.
For opposite headings (1, 0) and (−1, 0), the average vector is zero. It has no direction to normalize. Near cancellation, small data changes can produce a large change in the reported direction.
Choosing the midpoint of a shortest circular arc also needs care. Opposite points admit two equally short arcs, whose midpoints are (0, 1) and (0, −1). State the averaging rule and check the data's spread; there is no universally unique mean for every configuration.
Rotation coordinates have related problems. Averaging the identity matrix and a 180° z-rotation component by component gives diag(0, 0, 1). Its columns are not orthonormal, so it fails the rotation-matrix constraints.
For unit quaternions, q and −q represent the same rotation, yet their component average is zero. Quaternion signs, distance definitions, and ambiguous configurations need deliberate handling when estimating a mean orientation.
Connect tangent updates to learning and robotics
A learning model can constrain a parameter p to unit norm. With the usual Euclidean inner product, project an ambient gradient g into the sphere's tangent space:
g_tan = g − (p · g)p
The subtracted part points radially. The remainder satisfies p · g_tan = 0. A constrained optimization step can use ξ = −ηg_tan and a retraction, where η is the step size. Pymanopt's sphere implementation distinguishes this projection, normalization, and exponential update.
Projection uses the chosen inner product, which sets lengths and angles. A zero tangent gradient marks a constrained stationary point; it can also occur at a maximum or saddle. Constraint preservation by itself gives no guarantee of a lower loss.
In robotics, an ideal periodic joint angle has circle-valued configuration. Joint limits and collision constraints restrict the usable states further. Differentiating a regular position constraint gives permitted instantaneous velocities, which connects tangent spaces to Jacobian matrices.
Spatial orientations require a different manifold. SO(3) has three dimensions, with rotation matrices satisfying RᵀR = I and det R = 1. Unit quaternions lie on S³ in ℝ⁴ and represent each rotation twice through q and −q.
The circle is one-dimensional, and opposite circle points are distinct headings. Its topology is not the topology of SO(3). The shared lesson is to respect the state constraint and its local tangent directions while using the correct geometry for the actual state.
For a moving system, numerical integration turns a rate model into repeated finite steps. An update can preserve a manifold and still accumulate timing or trajectory error. Physical dynamics, numerical stability, and valid state representation require separate checks.
Reproduce the circle calculations in Python
This Python 3 example uses only the standard library. It reproduces the default update and two averaging cases. The opposite headings use exact components so the zero sum is explicit.
from math import atan, cos, hypot, radians, sin
def pair(v):
return '(' + ', '.join(
f'{0.0 if abs(x) < 0.5e-6 else x:.6f}' for x in v
) + ')'
theta = 0.0
h = 1.0
p = (cos(theta), sin(theta))
xi = (-h*sin(theta), h*cos(theta))
straight = tuple(a+b for a, b in zip(p, xi))
norm = hypot(*straight)
normalized = tuple(x/norm for x in straight)
rotated = (cos(theta+h), sin(theta+h))
print('Base:', pair(p))
print('Tangent:', pair(xi))
print(f'Tangency: {sum(a*b for a, b in zip(p, xi)):.6f}')
print('Straight:', pair(straight), f'norm={norm:.6f}')
print(f'Constraint error: {sum(x*x for x in straight)-1:.6f}')
print('Rotated:', pair(rotated))
print('Normalized:', pair(normalized))
print(f'Turns: rotation={h:.6f}, normalization={atan(h):.6f} rad')
angles = [radians(179), radians(-179)]
mean = (sum(cos(a) for a in angles)/2, sum(sin(a) for a in angles)/2)
mean_norm = hypot(*mean)
print('Mean heading:', pair(tuple(x/mean_norm for x in mean)))
opposites = ((1.0, 0.0), (-1.0, 0.0))
mean = tuple(sum(values)/2 for values in zip(*opposites))
print('Opposite-heading mean:', pair(mean), 'has no direction')
Expected output:
Base: (1.000000, 0.000000)
Tangent: (0.000000, 1.000000)
Tangency: 0.000000
Straight: (1.000000, 1.000000) norm=1.414214
Constraint error: 1.000000
Rotated: (0.540302, 0.841471)
Normalized: (0.707107, 0.707107)
Turns: rotation=1.000000, normalization=0.785398 rad
Mean heading: (-1.000000, 0.000000)
Opposite-heading mean: (0.000000, 0.000000) has no direction
The first normalization is safe because p is unit and ξ is tangent. The heading average needs its own nonzero-norm check before division in reusable code. Display rounding also cannot certify exact constraint satisfaction in floating-point arithmetic.
Try it yourself
Exercise 1. At p = (0, 1), project w = (2, 3) into the tangent space. Then use the tangent displacement ξ = (0.5, 0). Calculate the straight point and its normalized version. Which signed rotation h produces the corresponding exact circle update?
Show solution 1
The radial component is (p · w)p = 3(0, 1) = (0, 3). Subtracting it gives the tangent vector (2, 0). The displacement ξ = (0.5, 0) is tangent too.
The straight point is (0.5, 1), with norm √1.25. Normalizing gives (1/√5, 2/√5) ≈ (0.447214, 0.894427).
At θ = π/2, the positive unit tangent is u = (−1, 0). Thus ξ = hu requires h = −0.5. Exact rotation reaches (sin 0.5, cos 0.5) ≈ (0.479426, 0.877583), which differs from the normalized point.
Exercise 2. Average the headings 0° and 180° as unit vectors. Can you normalize the result? Find both shortest-arc midpoints. Then explain why the pair q and −q creates a different interpretation when q is a unit quaternion.
Show solution 2
The heading vectors are (1, 0) and (−1, 0). Their average is (0, 0), whose norm is zero, so normalization is undefined.
The two shortest circular arcs have length π and midpoints (0, 1) and (0, −1). The observations alone do not choose between these midpoint directions.
The opposite heading vectors describe different headings. In the quaternion pair, q and −q describe the same spatial rotation. Their zero component average reflects the duplicated representation, even though their physical orientations agree.
Continue with unit quaternions to work through that sign ambiguity using complete rotations.
Sources and further study
- Modern Robotics: Configuration Space Topology. Intrinsic dimension, periodic coordinates, and the shapes of robot configuration spaces.
- Nicolas Boumal: An Introduction to Optimization on Smooth Manifolds. Example 3.49 compares normalized sphere retractions with circular motion; later chapters develop metrics and exponential maps.
- Pymanopt: Sphere implementation. Tangent projection, exponential updates, and normalized retractions as separate operations.
- SciPy: Circular mean. The mean resultant vector, wrapped output conventions, and the zero-resultant case.