Covariant Derivatives and Connections in the Calculus
Covariant Derivatives and Connections in the Calculus
Revised Edition
Brian Beckman
Jan 2026
Abstract
Abstract
In this installment of the series, we address a central issue of differential geometry: how to take a derivative in (or on) a curved manifold without breaking coordinate invariance. Ordinary partial differentiation is not tensorial, producing garbage terms that don’t transform properly. The solution is the covariant derivative and its correction term, the connection coefficient .
Γ
We begin with the non-tensorial transformation law of Γ. Then, applying the constraints of metric compatibility and torsion freedom (symmetry on lower indices of Γ), we derive the particular connection coefficients needed for general relativity, the Christoffel Symbols. This derivation specializes differential geometry to Riemannian geometry as needed for the general relativistic theory of gravitation. Step-by-step derivation in automates tiresome and risky algebraic operations for high assurance in the results.
(∇g=0)
At this early stage of development, we expose as a script rather than hiding details in a package. This glass-box approach delivers better pedagogy and incremental validation.
Preface to the Revised Edition
Preface to the Revised Edition
In this revised edition, I invert the relationship between comments and code. I break up the blocks of code-with-essential-comments from the first edition into alternating prose and code cells, as is usual with notebooks. The motivation for the original style was to promote the script versions, but I have since learned that the .wl script format is more flexible than I had originally assumed: it can host notebook-formatted comments—Section, Item, and so on—not just ASCII/Unicode comments. The result is that script versions of this notebook can follow the notebook format very closely.
I also take the opportunity to improve the presentation in some trivial, non-material ways.
◼
A .wl script version of code for this notebook, minus the prose, is available at https://github.com/rebcabin/RelativityToolkit/blob/main/covariant_derivative_revised.wl.
Audience
Audience
◼
Except for MTW, I do not put standard textbooks in the References section, but offer clickable (non-affiliate!) links instead in the prose of this notebook.
I also invite readers to “think like a physicist,” that is, to demand conceptual cogency, but not always full mathematical rigour.
Transparent Implementation
Transparent Implementation
In developing , we made a conscious decision, for the time being, to expose the implementation as a glass-box script rather than to hide it in a Package, prioritizing transparency over encapsulation at this stage of development. When the toolkit is finalized in the future, we’ll address encapsulating it in a Package.
Let’s load ’s implementation, the RelativityToolkit, directly into your notebook context.
Initialize the Relativity Toolkit
Initialize the Relativity Toolkit
The code is hosted on GitHub. The implementation, tests, and visualizations are not explained in this notebook. Explanations appear in an earlier notebook. But we can run them here, for assurance.
The toolkit is currently implemented as a Script rather than as a package for development speed and for transparency. That means that all symbols will be loaded into the Global namespace, including internal variables in Module constructs. This minor inconvenience will be mitigated in a future version.
Optional: Quit for a Fresh Kernel
Optional: Quit for a Fresh Kernel
◼
Note, if you call Quit in a notebook, evaluation may hang. If you want to “Evaluate Notebook,” mark the following two cells “Evaluatable” in the CellProperty menu, call Quit and FrontEndTokenExecute once each, then comment out the cells, or mark them unevaluatable again. Alternatively, you can quit the kernel via the Evaluation menu (last item). At that point, you can “Evaluate Notebook” in a clean environment. Otherwise, you can evaluate cells in this notebook individually.
->
In[]:=
Quit[];
In[]:=
FrontEndTokenExecute["DeleteGeneratedCells"]
Set Download Loci and Load Main Script
Set Download Loci and Load Main Script
In[]:=
RTbranch="main";RTbase="https://raw.githubusercontent.com/rebcabin/RelativityToolkit/"<>RTbranch<>"/";RTbase="/Users/brian/Documents/GitHub/RelativityToolkit/";RTbust="?t="<>ToString[Round[AbsoluteTime[]]];RTbust="";(*freshendownload*)RTrules=RTbase<>"RelativityToolkit.wl"<>RTbust;RTtests=RTbase<>"RelativityToolkit_RegressionTests.wl"<>RTbust;RTviz=RTbase<>"RelativityToolkit_VisualShowcase.wl"<>RTbust;Get[RTrules];
»
Relativity Toolkit version :1.8.0
»
Relativity Connection Symbol :Γ
Optional: See all Tests and Results from Prior Works
Optional: See all Tests and Results from Prior Works
Make any of the following cells evaluatable if you wish. They’re unevaluatable by default to keep this notebook trim.
Get[RTtests];
In[]:=
Get[RTviz](*nosemicolon,onpurpose*)
In[]:=
Get[RTbase<>"covariant_derivative.wl"]
In[]:=
Get[RTbase<>"law_of_gamma.wl"]
Get[RTbase<>"connections_to_christoffels.wl"]
Get[RTbase<>"calculate_riemann.wl"]
Optional: Configure Relativity Connection Symbol
Optional: Configure Relativity Connection Symbol
To properly compose covariant derivatives, must know the user’s reserved symbols for non-tensorial objects like connection coefficients. In gravitational physics, these force-producing connections are called Γ (capital gamma). Other theories like electrodynamics and Yang-Mills that can benefit from use other connection symbols.
We’re going with Γ for this relativity/gravitation notebook, it’s the default, so the following cell is optional.
In[]:=
SetConnection[Γ];
Relativity Engine: Connection set to Γ
Need for Covariant Derivative
Need for Covariant Derivative
We Want a Derivative!
We Want a Derivative!
Consider a curve with invertible, continuous, differentiable coordinate functions (λ) along the curve, and tangent (contravariant) vectors ≡d/dλ. Also consider a (contravariant) vector field ((λ)) defined in neighborhoods around every point (λ) along the curve. We’d like a “derivative” of the vector field, schematically:
α
x
α
u
α
x
α
A
β
x
α
x
d
α
A
d
β
x
?
≡
α
A
β
x
β
x
α
A
β
x
d
β
x
(
1
)◼
We’ll have a better, “cool” notation for soon enough. For now, read it as “the derivative we’re trying to define.”
d
α
A
d
β
x
Seems a reasonable thing to ask: “How much does component α of change when I change coordinate β a little?”
A
However, Equation don’t point in the same directions as the coordinate axes at because the manifold bends and twists away between the two points! The components of are not commensurable at the two points because the two vectors are in different tangent spaces. Subtracting components as prescribed by Equation
1
is not a cogent definition of derivative on a manifold. We cannot subtract vectors at different points, not even infinitesimally different points. The coordinate axes at (+d)
β
x
β
x
β
x
A
1
, numerically, scrambles information from other directions. Conundrum of Parallel Transport
Conundrum of Parallel Transport
To answer this conundrum, we need backwards parallel transport, to move the vector (+d) smoothly and with a provable minimum of bending and twisting, back from +d to the point , so we can measure the components of the transported (+d) on the coordinate axes at point and then subtract the numbers.
α
A
β
x
β
x
β
x
β
x
β
x
α
A
β
x
β
x
β
x
d
α
A
d
β
x
?
≡
ParallelTransport(+d),to-()
α
A
β
x
β
x
β
x
α
A
β
x
d
β
x
(
2
)Conundrum of Coordinate-Independence
Conundrum of Coordinate-Independence
Now, with subtraction conceptually solved, how will that difference survive a coordinate transformation? How can I find out, when I change coordinates from to at the same point, how much component of changes when I change coordinate ? That is, what’s the value of when all I know is ?
β
x
β'
x
α->α'
A
β->β'
d
α'
A
d
β'
x
d
α
A
d
β
x
To answer this conundrum, we insist, as always, that the intrinsic geometry and physics not depend on choice of coordinates. But what does intrinsic mean when all we have are numerical components whose values depend on choice of coordinates?
Intrinsic Means Tensorial
Intrinsic Means Tensorial
Tensorial quantities encapsulate both intrinsic and coordinate-dependent information. If our desired, derivative-like quantities transform like a tensor when we change the basis vectors at point β, we’ll capture both:
d
α
A
d
β
x
(1,1)
◼
intrinsic geometric and physical properties of a tensor
◼
extrinsic artifacts arising from choice of coordinates
◼
Think of changing from Cartesian to spherical coordinates in flat Euclidean 3-space: the numbers change but the geometry and physics don’t.
Plus, we will be able to separate intrinsic (coordinate-dependent) from extrinsic (coordinate-independent) quantities cleanly.
◼
TODO: How?
◼
The first couple of chapters of Lovelock & Rund address this issue of intrinsic, geometry-dependent effects versus extrinsic, coordinate-dependent effects rigorously. Thinking like physicists, let’s be satisfied with the conceptual description above for now.
Tensorial and Linear Requirements
Tensorial and Linear Requirements
Agree that the components of our desired derivative, , transform between coordinate frames in exactly the way components of any other tensor—with one up and one down index—would change. These components are projections of the vector on the β basis vectors of the coordinate system , and measure both intrinsic and extrinsic information.
d
α
A
d
β
x
(1,1)
A
β
x
It turns out that simply demanding that our new derivative be tensorial and linear suffices to solve all the conundrums above, including optimality.
◼
TODO: This claim of optimality may not be good enough, even for a physicist otherwise happy with mathematical hand-waving. Misner, Thorne, and Wheeler [MTW] devote many chapters (8-15) to a more careful, physicist’s level of understanding, including demonstrations that the covariant derivative performs parallel transport! Those are missing pieces in this notebook.
◼
A mathematician will demand rigorous proofs. For those, see the many mathematical texts on differential geometry, perhaps starting with do Carmo's Differential Geometry of Curves and Surfaces. Other texts such as Tristan Needham, Visual Differential Geometry and Forms, and Michael Spivak's 5-volume Comprehensive Introduction to Differential Geometry are recommended.
The Partials are Not Tensors
The Partials are Not Tensors
First, let’s check that is not tensorial. It’s not enough for our desired derivative, but we’ll figure out how to correct it.
α
A
,β
◼
The comma notation, , is short for , also written . Though we don’t yet know how to define , is just good-ol’ partial derivative from ordinary calculus, a mechanical, symbolical calculation that Wolfram automates very well.
α
A
,β
∂
α
A
∂
β
x
∂
β
α
A
d
α
A
d
β
x
∂
α
A
∂
β
x
◼
embraces the comma notation as you can see from the Visual Showcase gallery above.
Let’s transform bases and calculate , contravarian components in basis , from , contravariant components in basis . transforms as follows:
α'
A
α'
x
α
A
α
x
A
α'
A
∂
α'
x
∂
α
x
α
A
(
3
)◼
A mnemonic for “contravariant:” let measure feet (primed) per inch (unprimed), that is (). Any unprimed contravariant vector is, mnemonically, like a velocity in inches per second, and its primed partner is, mnemonically, like a velocity in feet per second. Multiply (inches per second) by (feet per inch, ) to get (feet per second), i.e., =. The same rule goes for any kind of coordinate change, curvilinear, non-orthogonal, whatever: Contravariant? Multiply by .
∂
α'
x
∂
α
x
1/12
α
A
α'
A
α
A
∂
α'
x
∂
α
x
1/12
α'
A
α'
A
∂
α'
x
∂
α
x
α
A
∂
α'
x
∂
α
x
◼
Covariant tensors transform with the matching index co-wise in the numerator of the Jacobian. The mnemonical example is a gradient, say degrees of temperature per foot or inch.
Now calculate partial derivatives with respect to the primed frame:
Calculus Via
Calculus Via
Let’s have do this bit of calculus.
Define the Input
Define the Input
Express the partial via ’s inert Partials head:
Expand Derivatives
Expand Derivatives
Apply Leibniz (product) and chain rules repeatedly until stable:
Definition of Covariant Derivative
Definition of Covariant Derivative
The Way Out: Covariant Derivative
The Way Out: Covariant Derivative
There’s a way out: insist on a certain form.
require that it transform as follows:
◼
The form of a term plus a correction is ubiquitous in linear theories such as that for the Kalman filter (see my notebook Kalman filtering as a functional fold).
◼
SPOILER: We want our new derivative ∇ (aka the semicolon) to behave like any other derivative. That means it must satisfy two properties:
Connection Coefficients
Connection Coefficients
◼
We shall see, over the course of future notebooks, that connections produce forces in all of physics, classical and quantum! Existence of forces depends both on coordinate (gauge) choices and on intrinsic properties like mass and charge.
◼
In restricting connection coefficients for gravitation in general relativity, we’re saying “only certain kinds of manifold geometries and topologies are useful for describing gravitation.” Connection coefficients are more general than Christoffel symbols, pertaining to a broader class of manifolds.
Covariant Derivative and Connections in
Covariant Derivative and Connections in
’s CD functions shows off the evaluated covariant derivative:
CD’s held form exhibits semicolon notation!
◼
Lovelock & Rund write dire warnings about these theorems, that misapplication is the occasion of many published errors. Here, because we know the answer is correct, even by comparison to Lovelock & Rund, we’re going to hand-wave the issue, here.
As before, we’ll write primed indices in a brutal way as ap and bp, and prettify them on the way out.
The Transformed Tensor We Want
The Transformed Tensor We Want
Calculate How Γ Must Transform
Calculate How Γ Must Transform
Convenience Variables
’s robustTransformRules works on the primed, not differentiated tensor. Define a couple of convenience variables:
Prepare a Custom Chain Rule
Combine ’s general differentiation rules with this special rule, showing nothing broke:
Fetch the Broken Partial
Just set a variable to the broken partial we already know about:
Get the Residual
Coalesce and Simplify (Magic)
Coalesce and Simplify (Magic)
Transformation Law 1
Transformation Law 1
Final Transformation Law
Final Transformation Law
Christoffel Symbols
Christoffel Symbols
Up to this point, we have not actually used a metric tensor! MTW devote seven whole chapters to differential geometry without a metric (9-15), stressing that many general results in differential geometry—the topological results—can be derived without the metric. In particular, the covariant derivative and the connection coefficients do not, actually, depend on any metrical ability to measure distances, but only on assumptions of continuity and differentiability.
But gravitation via general relativity requires a special case: Riemannian Geometry. For that, we need a metric, and even a bit more: symmetry conditions on both the connection coefficients and on the metric. From these additions, we derive the ultra-famous gravitational Christoffel symbols:
This is equation 8.24 of MTW, after renaming some indices. It is also called “The Fundamental Theorem of Riemannian Geometry” in mathematical texts like do Carmo and Lee (see References).
Let’s do a step-by-step derivation via .
Start by reserving some symbols.
Physical Constraints
Physical Constraints
Torsion-Free Geometry
Torsion-Free Geometry
By MTW, Box 10.2, page 250, Γ is symmetric in its covariant (down) indices:
Metric Symmetry
Metric Symmetry
Metric Compatibility Postulates
Metric Compatibility Postulates
By MTW, Equation 8.23 and Chapter 14:
Koszul Cyclic Permutation
Koszul Cyclic Permutation
Solve for Γ
Solve for Γ
Because the Koszul equation is zero, we’ll coalesce the terms with Γ and set them equal to the negative of the terms without Γ:
Pick the terms with a factor of Γ:
Coalesce (canonicalize) and simplify:
Pick out the terms with no Γ factor:
Isolate Γ
Isolate Γ
Find the metric inside the lhs:
Find the Γ inside the lhs:
Extract raw symbols from the indices:
Contract via a custom rule:
◼
TODO: promote the contraction rule to the main code base.
Solve the lhs:
Rewrite the RHS with the contravariant metric:
Final Equation
Final Equation
Conclusion
Conclusion
The form of the Christoffel symbols shows that gravitation, manifested in the connection, is solely determined by the metric and its ordinary partial derivatives.
With a working covariant derivative in ’s Relativity Toolkit, we are equipped for future installments on geodesics, geodesic deviation, tidal forces, accelerated observers, Schwarzschild and Kerr metrics, black holes, etc.
References
References
1
.Poisson, Eric. A Relativist's Toolkit: The Mathematics of Black Hole Mechanics. Cambridge University Press, 2004.
2
.Beckman, Brian. From the steam age to quantum fields: a unified approach via UD tensorial calculus. Wolfram Community post.
3
.4
.5
.[MTW] Misner, Charles W.; Thorne, Kip S.; Wheeler, John Archibald. Gravitation. Princeton University Press, 2017.
8
.9
.Wolfram Function Repository. MetricTensor, RiemannTensor, EinsteinTensor. For component-based calculations.
10
.