Covariant Derivatives and Connections in the  Calculus

Revised Edition
Brian Beckman
Jan 2026

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
(∇g=0)
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.
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

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

    This series of notebooks is targeted at readers with an undergraduate’s STEM education—engineering, computer science, mathematics. Exposure to introductory courses in Classical Mechanics (e.g., Goldstein), Electrodynamics (e.g., Jackson), and Relativity (e.g., Schutz) will help.
    ◼
  • 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

    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

    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

    ◼
  • 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 Cell
    ->
    Property 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

    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

    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

    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

    We Want a Derivative!

    Consider a curve with invertible, continuous, differentiable coordinate functions
    α
    x
    (λ)
    along the curve, and tangent (contravariant) vectors
    α
    u
    ≡d
    α
    x
    /dλ
    . Also consider a (contravariant) vector field
    α
    A
    (
    β
    x
    (λ))
    defined in neighborhoods around every point
    α
    x
    (λ)
    along the curve. We’d like a “derivative” of the vector field, schematically:
    d
    α
    A
    d
    β
    x
    ?
    ≡
    α
    A
    (
    β
    x
    +d
    β
    x
    )-
    α
    A
    (
    β
    x
    )
    d
    β
    x
    (
    1
    )
    ◼
  • We’ll have a better, “cool” notation for
    d
    α
    A
    d
    β
    x
    soon enough. For now, read it as “the derivative we’re trying to define.”
  • Seems a reasonable thing to ask: “How much does component α of
    A
    change when I change coordinate β a little?”
    However, 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
    (
    β
    x
    +d
    β
    x
    )
    don’t point in the same directions as the coordinate axes at
    β
    x
    because the manifold bends and twists away between the two points! The components of
    A
    are not commensurable at the two points because the two vectors are in different tangent spaces. Subtracting components as prescribed by Equation
    1
    , numerically, scrambles information from other directions.

    Conundrum of Parallel Transport

    To answer this conundrum, we need backwards parallel transport, to move the vector
    α
    A
    (
    β
    x
    +d
    β
    x
    )
    smoothly and with a provable minimum of bending and twisting, back from
    β
    x
    +d
    β
    x
    to the point
    β
    x
    , so we can measure the components of the transported
    α
    A
    (
    β
    x
    +d
    β
    x
    )
    on the coordinate axes at point
    β
    x
    and then subtract the numbers.
    d
    α
    A
    d
    β
    x
    ?
    ≡
    ParallelTransport
    α
    A
    (
    β
    x
    +d
    β
    x
    ),to
    β
    x
    -
    α
    A
    (
    β
    x
    )
    d
    β
    x
    (
    2
    )

    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
    β
    x
    to
    β'
    x
    at the same point, how much component
    α->α'
    of
    A
    changes when I change coordinate
    β->β'
    ? That is, what’s the value of
    d
    α'
    A
    d
    β'
    x
    when all I know is
    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

    Tensorial quantities encapsulate both intrinsic and coordinate-dependent information. If our desired, derivative-like quantities
    d
    α
    A
    d
    β
    x
    transform like a
    (1,1)
    tensor when we change the basis vectors at point β, we’ll capture both:
    ◼
  • 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

    Agree that the components of our desired derivative,
    d
    α
    A
    d
    β
    x
    , transform between coordinate frames in exactly the way components of any other
    (1,1)
    tensor—with one up and one down index—would change. These components are projections of the vector
    A
    on the β basis vectors of the coordinate system
    β
    x
    , and measure both intrinsic and extrinsic information.
    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

    First, let’s check that
    α
    A
    ,β
    is not tensorial. It’s not enough for our desired derivative, but we’ll figure out how to correct it.
    ◼
  • The comma notation,
    α
    A
    ,β
    , is short for
    ∂
    α
    A
    ∂
    β
    x
    , also written
    ∂
    β
    α
    A
    . Though we don’t yet know how to define
    d
    α
    A
    d
    β
    x
    ,
    ∂
    α
    A
    ∂
    β
    x
    is just good-ol’ partial derivative from ordinary calculus, a mechanical, symbolical calculation that Wolfram automates very well.
  • ◼
  •  embraces the comma notation as you can see from the Visual Showcase gallery above.
  • Let’s transform bases and calculate
    α'
    A
    , contravarian components in basis
    α'
    x
    , from
    α
    A
    , contravariant components in basis
    α
    x
    .
    A
    transforms as follows:
    α'
    A
    ≡
    ∂
    α'
    x
    ∂
    α
    x
    α
    A
    (
    3
    )
    ◼
  • A mnemonic for “contravariant:” let
    ∂
    α'
    x
    ∂
    α
    x
    measure feet (primed) per inch (unprimed), that is (
    1/12
    ). Any unprimed contravariant vector
    α
    A
    is, mnemonically, like a velocity in inches per second, and its primed partner
    α'
    A
    is, mnemonically, like a velocity in feet per second. Multiply
    α
    A
    (inches per second) by
    ∂
    α'
    x
    ∂
    α
    x
    (feet per inch,
    1/12
    ) to get
    α'
    A
    (feet per second), i.e.,
    α'
    A
    =
    ∂
    α'
    x
    ∂
    α
    x
    α
    A
    . The same rule goes for any kind of coordinate change, curvilinear, non-orthogonal, whatever: Contravariant? Multiply by
    ∂
    α'
    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 

    Let’s have  do this bit of calculus.

    Define the Input

    Express the partial via ’s inert Partials head:

    Expand Derivatives

    Apply Leibniz (product) and chain rules repeatedly until stable:

    Definition of 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

    ◼
  • 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 

    ’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

    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)

    Transformation Law 1

    Final Transformation Law

    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

    Torsion-Free Geometry

    By MTW, Box 10.2, page 250, Γ is symmetric in its covariant (down) indices:

    Metric Symmetry

    Metric Compatibility Postulates

    By MTW, Equation 8.23 and Chapter 14:

    Koszul Cyclic Permutation

    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 Γ

    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

    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

    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
    .
    Beckman, Brian. General relativity in the UD calculus. Wolfram Community post.
    4
    .
    Beckman, Brian. Formal Differential Geometry in the UD Calculus: Part 1. Wolfram Community post.
    5
    .
    [MTW] Misner, Charles W.; Thorne, Kip S.; Wheeler, John Archibald. Gravitation. Princeton University Press, 2017.
    6
    .
    [L&R] Lovelock, David and Rund, Hanno. Tensors, Differential Forms, and Variational Principles. Dover.
    7
    .
    John M. Lee, Riemannian Manifolds: An Introduction to Curvature. Springer.
    8
    .
    Manfredo P. do Carmo, Riemannian Geometry. Springer.
    9
    .
    Wolfram Function Repository. MetricTensor, RiemannTensor, EinsteinTensor. For component-based calculations.
    10
    .
    Wolfram Research. Mathematica Documentation. Tensor Calculus.