Tensor Playground for General Relativity from the metric gμν to Einstein's field equations, interactively

New here? What this page is, and the road to Einstein's equations

General Relativity makes one outrageous claim: gravity is not a force. The Earth doesn't pull the Moon — mass bends the geometry of spacetime, and the Moon simply travels in the straightest possible line through that bent geometry. This page lets you touch every mathematical object that claim is built from.

The whole theory is a chain, and each tab is one link: metric g → Christoffel Γ → geodesics → Riemann → Ricci & Weyl → Gμν = 8πTμν

Suggested order: start with 2D · constant (what a metric even is), then 2D · curved presets (metrics that vary in space), then Γ · geodesics (what "straight" means), then Riemann · holonomy (what curvature really is), then Weyl · tides (gravity you can feel) and finally Tμν · cosmology (the field equations running a universe). The 3D tabs deepen the geometry but add no new concepts.

Every tab has "What is this?" cards like this one — click them open as you go.

g = (
1.000.00
0.001.00
)
det g1.00
area element √det g1.00
signatureRiemannian (+,+)
Line element between A and B (drag them!)
ds² = g₁₁Δx² + 2g₁₂ΔxΔy + g₂₂Δy²
coordinate distance √(Δx²+Δy²)
ds² (proper)
proper distance ds
The grid you draw coordinates on never changes — the metric decides what those coordinates are worth in real distance. The right canvas shows space as a ruler would experience it.
Coordinate space — grid is just labels. The magenta curve is every point at proper distance 1 from the origin (a “circle” according to g).
Physical space — the same grid drawn with its true lengths and angles. The unit-distance curve becomes an honest circle.
What to notice: raising g₁₁ doesn’t move anything in coordinate space — it makes each step in x longer, so the unit “circle” shrinks in x while physical space stretches. g₁₂ ≠ 0 means the coordinate axes aren’t physically perpendicular. Push g₁₂ until det g < 0 and the metric stops being a valid Riemannian metric — ds² can go negative, which is exactly the structure spacetime uses to separate time from space (we’ll meet it properly when we add the time dimension).
What is the metric tensor?

Coordinates are just labels — like street names. Knowing two addresses doesn't tell you how far apart they are; you need a conversion table from "label differences" to "actual meters". The metric tensor is that table. Feed it a small coordinate step (Δx, Δy), and it returns the squared real distance: ds² = g₁₁Δx² + 2g₁₂ΔxΔy + g₂₂Δy².

Each component has a plain meaning: g₁₁ is the price of an x-step (squared), g₂₂ the price of a y-step, and g₁₂ is the cross-term — nonzero exactly when the two coordinate directions aren't physically perpendicular, so diagonal moves cost more (or less) than Pythagoras would say. With g = identity you recover the ordinary Pythagorean theorem; everything else is a generalization of it.

Why a tensor (a matrix, here) and not just a number? Because distance can be direction-dependent — an x-step and a y-step may have different prices — and the axes can mix. One number can't encode that; a symmetric matrix is the smallest thing that can.

Why does GR need it?

Einstein's starting point was that no coordinate system is special. An observer in a falling elevator, one on a spinning carousel, one floating in deep space — all must be able to write the same physics. That's only possible if coordinates carry no physical meaning by themselves, and one object holds all the actual geometry: the metric. Every other structure on this page (Γ, geodesics, curvature) is manufactured from g and nothing else.

And in GR the metric isn't just bookkeeping — it is the gravitational field. What we call gravity is the statement that g near a mass differs from the flat-space metric. The g_tt component (when we include time) directly sets how fast clocks tick: GPS satellites must correct for it or drift by kilometers per day. The metric is the most physically real object in the theory.

How to read this screen

The left canvas is the world as labels: the grid never moves because labels don't care about geometry. The magenta curve answers "which points are at real distance 1 from the origin?" — as you re-price steps with the sliders, that set deforms into an ellipse.

The right canvas is the world as a ruler experiences it: the grid is redrawn with its true lengths and angles (mathematically: an isometric embedding, g = LLᵀ). The unit-distance set becomes an honest circle there — proof that the ellipse on the left was a coordinate illusion. Drag A and B and compare coordinate distance (meaningless) with proper distance ds (physical).

At cursor (hover the canvas)
(x, y)
g₁₁
g₂₂
Gaussian curvature K
Path AB (straight in coordinates; drag)
coordinate length
proper length ∫ds
Each ellipse shows the set of points at one fixed small proper distance from its center — a tiny “circle” drawn in coordinates. Where ellipses are large, coordinates are cheap (little real distance per coordinate step); where small, expensive. Here the metric varies from point to point — that’s what lets space be genuinely curved.
What changes when the metric varies from point to point?

In the previous tab one matrix priced the whole plane. Now every point has its own metric — its own local conversion from coordinate steps to meters. The magenta ellipses make this visible: each is the set of points at one small fixed real distance from its center. Big ellipse = coordinates are cheap there; tiny ellipse = each coordinate step costs a lot of real distance.

To measure a path's true length you can no longer multiply once — you must add up ds segment by segment along the way: L = ∫ ds. That's what the A→B readout computes, and why its answer differs from the coordinate length.

The single most important lesson: varying g ≠ curved space

The first preset is a trap, on purpose. Polar coordinates on a perfectly flat table give a metric that varies everywhere (gθθ = r²) — yet the table is flat: K = 0. A wildly varying metric can be pure coordinate artifact.

The real question is: does there exist any choice of coordinates that makes g constant everywhere? For the polar preset, yes (just use ordinary x, y). For the sphere — provably no. That impossibility is what "intrinsically curved" means, and the Gaussian curvature K is the detector that doesn't care which coordinates you use. It's also why every flat map of the Earth must lie somewhere.

This distinction is the heart of GR: physicists needed machinery to tell real gravity apart from funny coordinates (an accelerating rocket mimics gravity!). The Riemann tab builds exactly that machinery.

Why these four presets?

Flat-polar is the control experiment (varying g, zero curvature). Sphere is the cleanest possible positively-curved space. Hyperbolic plane is its negative mirror — saddle-shaped everywhere, more room than flat space. Schwarzschild slice is real physics: this is the actual spatial geometry around any non-rotating mass (sun, black hole), where radial rulers shrink near the horizon, so there is literally more space packed around a mass than Euclid would allow.

g = (
1.000.000.00
0.001.000.00
0.000.001.00
)
det g1.000
volume element √det g1.000
eigenvalues1, 1, 1
signatureRiemannian (+,+,+)
ds² between A and B
ds² = gij Δxⁱ Δxʲ  (i,j = 1..3)
A
B
coordinate distance
ds²
proper distance ds
Drag the canvases to orbit, scroll to zoom. Axes: , , .
Coordinate space — fixed lattice; the magenta ellipsoid is every point at proper distance 1 from the origin.
det g ≤ 0 or g not positive-definite —
not a Riemannian metric. Some directions now have
negative squared length: spacetime territory.
Physical space — the same lattice with its true lengths and angles; the unit-distance set becomes an honest sphere.
Same story as 2D, one dimension up: 6 independent numbers now (a symmetric 3×3 matrix). Off-diagonal components tilt pairs of axes out of perpendicularity; diagonal ones re-price each axis. In full GR the metric is 4×4 with one negative eigenvalue — the “Break it” preset shows what losing positive-definiteness feels like.
Why bother with 3D if the idea is the same?

Two reasons. First, counting: a symmetric matrix in n dimensions has n(n+1)/2 independent components — 3 in 2D, 6 here, and 10 in the 4D spacetime of GR. Watching the component count grow makes the "10 gravitational potentials" of GR less mysterious: they're just the entries of a symmetric 4×4 matrix.

Second, the eigenvalue readout becomes interesting. Three positive eigenvalues = a valid space (signature +,+,+). In real spacetime exactly one eigenvalue is negative (signature −,+,+,+): that minus sign is time, and it's the entire reason ds² can vanish (light rays) or go negative (the paths of massive objects). "Break it" lets you create that minus sign by hand and watch why ordinary space can't accommodate it.

Probe point (r, θ, φ)
P
g₁₁
g₂₂
g₃₃
Ricci scalar R
Path AB (straight in coordinates)
A
B
coordinate length
proper length ∫ds
Each ellipsoid marks points at one small fixed proper distance from its center. Drag to orbit, scroll to zoom. Axes: 1st, 2nd, 3rd coordinate.
These aren't toy examples — they're candidate universes

If the universe is homogeneous (same everywhere) and isotropic (same in all directions) — which observations support on large scales — then mathematics permits only three possible spatial geometries: flat, the 3-sphere (closed, finite, positively curved), and hyperbolic 3-space (open, infinite, negatively curved). They are presets two and three here, and they are exactly what the Ωk readout in the cosmology tab selects between. Current measurements say our universe is flat to within about half a percent — but a closed universe only slightly bigger than our horizon is still allowed.

The fourth preset, Schwarzschild, is not a universe but the space around every star and black hole — the geometry your GPS corrections, Mercury's orbit precession, and light-bending measurements all probe.

Why does Schwarzschild show R = 0 if it's curved?

The Ricci scalar R is a single-number summary of curvature — an average over all directions. Averages can hide structure: around a mass, space is stretched radially and compressed tangentially in just the right proportions that the average cancels. R = 0, yet no coordinates can flatten this space.

The cancellation isn't an accident — it's the vacuum Einstein equations at work (no matter at this point ⇒ Ricci vanishes). The curvature that survives in vacuum is carried by the Weyl tensor, and you can feel it: it's the tidal stretch-and-squeeze in the Weyl · tides tab. Moral: to capture curvature fully you need the whole Riemann tensor; scalars and even Ricci are lossy compressions.

Christoffel symbols Γᵏᵢⱼ — derivatives of the metric; they define what “keep going straight” means. The geodesic equation d²xᵏ/ds² = −Γᵏᵢⱼ (dxⁱ/ds)(dxʲ/ds) is solved numerically (RK4) when you launch a particle. Γ computed from g by finite differences.
Γ at cursor
Γ¹₁₁
Γ²₁₁
Γ¹₁₂
Γ²₁₂
Γ¹₂₂
Γ²₂₂
Press, drag to aim, release to launch. The path is "straight" according to the metric — it only looks curved because the coordinates are. With the fan on, watch neighbours converge where curvature is positive, diverge where negative.
What are Christoffel symbols, really?

Imagine walking dead straight across a field while your map uses curved grid lines. On the map, your path appears to bend — not because you turned, but because the grid itself turns underneath you. The Christoffel symbols Γᵏᵢⱼ are the bookkeeping of exactly how much the grid turns: they're built from the derivatives of the metric, Γ ~ ∂g.

They are famously not a tensor, and that's not a defect — it's the point. At any single location you can always pick coordinates where all Γ vanish (the grid looks momentarily straight). A quantity you can erase by relabeling can't be a physical field by itself. What can't be erased is its derivative structure — that's the Riemann tensor, next tab.

Why does GR need them? (gravity is not a force)

Newton says: planets want to go straight; gravity forces them into ellipses. Einstein says: planets do go straight — through a spacetime that mass has bent. "Straight" (geodesic) means: never turn, as judged locally. The geodesic equation d²xᵏ/ds² = −Γᵏᵢⱼ ẋⁱẋʲ is just "acceleration = 0" written honestly in coordinates that bend — the Γ term subtracts the grid's own turning.

This is the equivalence principle made math: in a freely falling elevator (coordinates where Γ = 0 at your location), gravity vanishes — astronauts float not because they escaped gravity but because they're on a geodesic. Forces you can feel push you off geodesics; the floor pushing on your feet right now is what's accelerating you, not gravity pulling you down.

What the fan of geodesics shows (and why it's profound)

Launch the fan on the sphere: initially-parallel straight paths reconverge. On the hyperbolic plane they spread apart faster than flat space allows. Nobody steered; the convergence is the geometry itself. This relative acceleration of neighbouring geodesics — geodesic deviation — is the operational meaning of the Riemann/Ricci tensors and the seed of everything observable about gravity: tides, lensing, the collapse of dust clouds into stars. Two satellites in nearby orbits slowly drifting together are running this exact experiment.

The Riemann tensor measures holonomy: parallel-transport a vector around a closed loop and it comes back rotated. In 2D the rotation angle is exactly Δθ = ∬ K √det g dx dy — curvature × area. On flat presets it's zero no matter how weird the coordinates are.
holonomy Δθ (transported)
∬ K dA over loop
R¹₂₁₂ at loop center
Ricci scalar R = 2K
Drag the two corner handles to resize the loop. The orange arrow is the vector you start with; the cyan arrow is what comes back after one counterclockwise lap. The two numbers above should agree — that agreement is the Riemann tensor.
The vector is slid along each edge keeping it "as parallel as possible" (∇v = 0). It never rotates locally — yet globally it does. That impossibility of consistent parallelism is curvature.
What is the Riemann tensor?

It answers one question: if I carry a vector around a small closed loop, keeping it as parallel as I can at every step, does it come back unchanged? In flat space: always yes, in any coordinates. In curved space: no — it returns rotated, and the rotation per unit of enclosed area is the Riemann tensor. You're watching that measurement happen live on this canvas.

In 2D one number per point (K) suffices. In 4D spacetime the Riemann tensor has 20 independent components per point — rotation can happen in many planes. It's built from second derivatives of the metric: R ~ ∂Γ + ΓΓ ~ ∂²g.

Why is it needed? The elevator problem

The equivalence principle creates a crisis: any observer can free-fall and make gravity locally vanish (Γ → 0). So is gravity ever real, or always a coordinate choice? Einstein needed an object that survives every possible relabeling — the invariant residue of the gravitational field. Riemann is that object: if any component is nonzero, no observer anywhere can transform the gravity away. Riemann ≠ 0 is the coordinate-proof definition of "spacetime is curved here".

Try it yourself: switch to the flat-polar preset. The Christoffels are wildly nonzero, the grid looks bent — and the transported vector comes back exactly unrotated. Coordinates lie; holonomy doesn't.

From Riemann to Ricci — the part Einstein kept

Twenty components is too many to set equal to matter (Tμν has only 10). The Ricci tensor is the natural compression: average the Riemann rotations over directions. Physically, Ricci controls how the volume of a small cloud of free-falling particles changes — positive Ricci makes it shrink, which is gravity's attractive essence. Its full trace is the Ricci scalar R shown in the readout.

What the averaging throws away — shape distortion at constant volume — is the Weyl tensor (tides tab). So: Riemann = Ricci (volume, sourced by matter) + Weyl (shape, free to roam).

The Einstein field equations, live. Gμν = 8πG Tμν For a homogeneous universe they reduce to the Friedmann equation (ȧ/a)² = H₀²(Ωma⁻³ + Ωra⁻⁴ + Ωka⁻² + ΩΛ) You edit the matter content Tμν (right side); geometry a(t) responds (left side).
Tμν (
ρ000
0p00
00p0
000p
)
Ωk (spatial curvature)0.00
deceleration q₀ = Ωm/2 + Ωr − ΩΛ
age of universe
fate
Time in units of 1/H₀ ≈ 14.4 billion years. Ωk = 1 − ΣΩ closes the budget: total > 1 → positively curved 3-sphere universe, < 1 → hyperbolic. (Those are your two 3D presets!)
Scale factor a(t) — the size of the universe vs time. Orange dot = today (a = 1). Matter and radiation pull the curve down (attractive gravity); Λ with its negative pressure pushes it up.
What is the stress-energy tensor Tμν?

It's the complete ledger of "stuff" at a point, organized as a 4×4 table. T₀₀ is energy density (including mass, E = mc²). The diagonal space entries are pressure. The off-diagonal entries (zero for the smooth fluids here) would be momentum flux and shear — energy in motion.

Why must the source of gravity be a whole tensor instead of just mass density, like Newton had? Because of relativity itself: a moving observer sees the same matter with different density and momentum — the components mix under boosts exactly the way geometric tensors mix. A consistent theory must therefore couple geometry to the full tensor. This has real consequences: pressure gravitates. That's why Λ's negative pressure can push the expansion to accelerate — a possibility Newton's theory cannot even express.

Why Gμν = Rμν − ½R gμν? (the equation isn't arbitrary)

Energy-momentum is conserved: μTμν = 0, automatically, always. So whatever geometric object sits on the left side of the field equations must also be automatically conserved — otherwise the equations would contradict themselves the moment matter moved. Ricci alone fails this test. But a mathematical identity (the Bianchi identity) guarantees that precisely the combination Gμν = Rμν − ½R gμν has ∇G = 0 built in.

It is essentially the only tensor with that property that's built from g and at most two of its derivatives (up to the Λg term). Einstein didn't decorate the equation — the requirements forced it. That near-uniqueness is why physicists trust GR so deeply.

How this demo actually solves Einstein's equations

Ten coupled nonlinear PDEs sounds hopeless — but symmetry is the great simplifier. Assume the universe is the same everywhere and in every direction, and the metric collapses to a single unknown function: the scale factor a(t), with one spatial-curvature constant k (your Ωk). The ten equations collapse to the Friedmann equation, an ODE this page integrates numerically in real time as you move the sliders.

The sliders are real measured numbers: Planck-satellite values are Ωm ≈ 0.31, ΩΛ ≈ 0.69, Ωr ≈ 10⁻⁴. Set them and you get our universe: age ≈ 0.95/H₀ ≈ 13.8 billion years, accelerating forever. The 1998 supernova discovery of that acceleration (and hence ΩΛ > 0) won the 2011 Nobel Prize.

The Weyl tensor: curvature that isn't sourced locally. Around a black hole the Ricci tensor is zero (vacuum!) yet a falling ring of dust is stretched radially and squeezed sideways — tides. The geodesic deviation equation in the falling frame: ξ̈ʳ = +(2GM/r³) ξʳ    ξ̈ᶿ = −(GM/r³) ξᶿ Trace = 2−1−1 = 0: volume is preserved. Pure shape distortion = pure Weyl. This same trace-free stretch-and-squeeze, propagating, is a gravitational wave.
r (Schwarzschild)
radial tide +2GM/r³
transverse tide −GM/r³
radial stretch factor
transverse squeeze factor
statusfalling…
Every particle in the ring is in perfect free fall on its own geodesic — nobody feels a force. Only their relative motion reveals spacetime curvature. Tides are the only part of gravity you cannot transform away.
A ring of free test particles falling radially toward the horizon (red circle). Exact Schwarzschild radial geodesic + geodesic deviation, integrated in the ring's own frame.
What is the Weyl tensor?

Split the Riemann tensor in two. The Ricci part is pinned down point-by-point by the matter sitting there (that's the Einstein equations). The remainder — the Weyl tensor — is the part of curvature that local matter does not determine. It's curvature with a life of its own: it can exist in pure vacuum and it can travel.

Its signature is trace-free distortion: stretch one way, squeeze the others, volume unchanged. That's exactly what the falling ring shows — radial tide +2GM/r³, transverse −GM/r³, sum zero. Volume preserved (no matter inside the ring to shrink it), shape mangled.

Why is it needed? Action at a distance, solved

Here's a puzzle the Ricci tensor can't answer: spacetime where the Moon orbits is vacuum — Einstein's equations say Ricci = 0 there. So what is the Earth's gravity made of, out where the Moon is? Answer: Weyl curvature. Matter curves spacetime where it sits (Ricci), and that curvature propagates outward through empty space as Weyl. The Weyl tensor is gravity's messenger — it's how mass here is felt there.

Tides are its fingerprint, and they're the one part of gravity the equivalence principle can't hide: a uniform pull vanishes in a falling elevator, but the differences in pull across the elevator do not. A big enough elevator falling toward any mass always detects the stretch-squeeze. Ocean tides are literally the Moon's Weyl tensor acting on the Earth.

From tides to gravitational waves

Shake a mass and its Weyl field can't update everywhere instantly — the change ripples outward at the speed of light as a gravitational wave: the same trace-free stretch-and-squeeze pattern as this ring, oscillating transverse to the direction of travel. When LIGO detected merging black holes in 2015, its laser arms were a ring of test particles doing precisely what this animation shows, with stretch factors of about 10⁻²¹. Pure Weyl, crossing a billion light-years of vacuum — the strongest possible proof that curvature is a thing in itself, not just an account of local matter.