---
title: "How distances record the expansion"
description: "Derive the expansion rate for evolving dark energy, compute comoving and Hubble distances by hand, and see why gravity's strength never enters."
canonical_url: "https://sandboxphysics.com/stories/dark-energy-or-modified-gravity/how-distances-record-expansion/"
language: "en"
page_type: "story"
alternate_languages:
  zh-CN: "https://sandboxphysics.com/zh/stories/dark-energy-or-modified-gravity/how-distances-record-expansion/"
last_modified: "2026-11-12"
---

[Dark energy or modified gravity](https://sandboxphysics.com/stories/dark-energy-or-modified-gravity/)

# How distances record the expansion

Sandbox Physics · 2026-11-12

Every cosmological distance is an integral of the inverse expansion rate over redshift. Supernova brightness and the baryon acoustic ruler therefore measure one function, the expansion rate at each redshift, and nothing else. This chapter builds that function for evolving dark energy, turns it into distances and shows why gravity's strength never enters.

Read [Can the same expansion come with different gravity?](https://sandboxphysics.com/stories/dark-energy-or-modified-gravity/same-expansion-different-gravity/) first. You need exponentials, logarithms and the idea of an integral as a sum of small pieces. The aims are to derive the expansion rate of a flat universe with evolving dark energy, compute two kinds of distance by hand and read the distance chart in the Lab.

## Scale factor, redshift and expansion rate

Describe the expansion by a scale factor $a$, equal to one today. Every comoving separation grows in proportion to $a$. Light emitted when the scale factor was $a$ arrives stretched by the factor $1/a$, which defines the redshift:

$$
1+z=\frac{1}{a}.
$$

The expansion rate is the fractional growth of the scale factor per unit time, $H=\dot a/a$, with present value $H_0$. Write $H_0=100\,h\,\mathrm{km\,s^{-1}\,Mpc^{-1}}$. The distance light covers in one Hubble time, $c/H_0$, is the natural unit of length: for $h=0.68$ it is $4408.7\,\mathrm{Mpc}$.

For a spatially flat universe the Friedmann equation ties the expansion rate to the total energy density. Divide every density by today's critical density and write $\Omega_{\mathrm m}$ for the present matter fraction. Matter is diluted by volume, so its density falls as $a^{-3}$. Neglect radiation, which matters only far earlier than the redshifts used here. Then

$$
E^2(a)\equiv\frac{H^2(a)}{H_0^2}=\Omega_{\mathrm m}a^{-3}+(1-\Omega_{\mathrm m})\frac{\rho_{\mathrm{DE}}(a)}{\rho_{\mathrm{DE}}(1)}.
$$

The second term is dark energy. Flatness fixes its present weight to $1-\Omega_{\mathrm m}$. [Weinberg and White, PDG Review of Particle Physics 2025, §28.1](https://pdg.lbl.gov/2025/reviews/rpp2025-rev-dark-energy.pdf)

## How the dark-energy density changes

A fluid with pressure $p$ and density $\rho$ loses energy as it does work on the expanding volume. Energy conservation in an expanding universe gives

$$
\frac{\mathrm d\ln\rho}{\mathrm d\ln a}=-3(1+w),\qquad w\equiv\frac{p}{\rho c^2}.
$$

Matter has $w=0$ and recovers $\rho\propto a^{-3}$. A cosmological constant has $w=-1$, and its density does not change at all. DESI and many other analyses describe evolving dark energy by a straight line in the scale factor, $w(a)=w_0+w_a(1-a)$. Here $w_0$ is today's value and $w_a$ measures how much it differed in the past. [DESI DR2 BAO results, 2025](https://arxiv.org/html/2503.14738v3)

Integrate from today, $a=1$, back to $a$:

$$
\ln\frac{\rho_{\mathrm{DE}}(a)}{\rho_{\mathrm{DE}}(1)}=-3\int_1^a\frac{1+w_0+w_a(1-a')}{a'}\,\mathrm da'=-3(1+w_0+w_a)\ln a-3w_a(1-a).
$$

So the dark-energy term in the expansion rate is

$$
\frac{\rho_{\mathrm{DE}}(a)}{\rho_{\mathrm{DE}}(1)}=a^{-3(1+w_0+w_a)}\,\mathrm e^{-3w_a(1-a)}.
$$

When $w>-1$ in the past the density was larger than today, because going back in time compresses it. When $w<-1$ the density grows as the universe expands, which is called phantom behaviour. The Lab uses exactly this background, with $\Omega_{\mathrm m}=0.31$ unless you change it.

## From the expansion rate to distances

A light ray moving toward us covers the comoving distance $c\,\mathrm dt/a$ in a short time $\mathrm dt$. Since $\mathrm dz=-\mathrm da/a^2$ and $\mathrm da=aH\,\mathrm dt$, that element equals $c\,\mathrm dz/H$. Adding up the elements from the source to us gives the comoving distance

$$
D_{\mathrm M}(z)=\frac{c}{H_0}\int_0^z\frac{\mathrm dz'}{E(z')}.
$$

In a flat universe this is also the transverse comoving distance. An object of comoving size $r$ at redshift $z$ spans the angle $r/D_{\mathrm M}$. A second distance measures separations along the line of sight: a small redshift interval $\Delta z$ corresponds to the comoving length $D_{\mathrm H}\,\Delta z$, with

$$
D_{\mathrm H}(z)=\frac{c}{H(z)}.
$$

Galaxy surveys measure the baryon acoustic scale $r_{\mathrm d}$ across the sky and along the line of sight, which yields $D_{\mathrm M}/r_{\mathrm d}$ and $D_{\mathrm H}/r_{\mathrm d}$. Supernovae measure the luminosity distance $(1+z)D_{\mathrm M}$ up to an overall calibration. Every one of these numbers is built from $E(z)$.

## A check you can do exactly

In a universe of matter only, $\Omega_{\mathrm m}=1$ and $E=(1+z)^{3/2}$. The integral has a closed form:

$$
D_{\mathrm M}(z)=\frac{2c}{H_0}\left(1-\frac{1}{\sqrt{1+z}}\right).
$$

At $z=1$ this is $0.585786\,c/H_0$. The numerical integrator behind the Lab reproduces that value to ten decimal places, which is one of the independent checks recorded with the course data.

## Worked example: the same redshift in three universes

Take $\Omega_{\mathrm m}=0.31$, $h=0.68$ and a cosmological constant. At $z=0.5$ the scale factor is $2/3$, and

$$
E^2=0.31\times1.5^3+0.69=1.73625,\qquad E=1.3177.
$$

Numerical integration of $1/E$ from zero to one half gives $D_{\mathrm M}=0.4395\,c/H_0\simeq1938\,\mathrm{Mpc}$. The line-of-sight distance is $D_{\mathrm H}=c/(H_0E)=3346\,\mathrm{Mpc}$. Prescribe an acoustic scale of $147\,\mathrm{Mpc}$ for the example. It then spans $147/1938=0.0759$ radians, about 4.3 degrees on the sky.

Now let dark energy have $w_0=-0.9$ and $w_a=0$. Its density at $z=0.5$ is $1.5^{0.3}=1.129$ times today's, so $E=1.3511$ is larger and every element of the integral is smaller. The distance falls to $0.4326\,c/H_0$, 1.6% shorter. The same ruler would look 1.6% larger.

Finally take the crossing model that resembles the DESI preference, $w_0=-0.752$ and $w_a=-0.86$. Today $w$ sits above minus one; at $z=0.5$ it is already $-1.039$. The distances are shorter than the cosmological-constant case by 2.3% at $z=0.5$, 1.8% at $z=1$ and 1.0% at $z=2$. Shifts of a few percent spread over a range of redshift are exactly what current surveys can detect.

## Why the strength of gravity never appears

Look again at the two distance formulas. They contain the expansion rate and nothing else. The response of matter to gravity, which later chapters call $\mu$, does not enter, and neither does the bending of light.

This has a precise consequence. Differentiate the comoving distance: $\mathrm dD_{\mathrm M}/\mathrm dz=c/H(z)$. If two flat models predict the same $D_{\mathrm M}(z)$ at every redshift, they have the same $H(z)$, and therefore the same $D_{\mathrm H}$ and the same luminosity distance. Distances fix the expansion history completely, and the expansion history is all they fix.

A modified theory of gravity also produces some expansion history. Whatever it is, it can be written as an effective $w(a)$ in the formula above. Cosmology codes such as hi\_class use that freedom: they let you choose the background and the gravitational response as separate inputs. [Zumalacárregui et al. 2017, hi\_class](https://arxiv.org/abs/1605.06102)

## Lab tasks

1. Choose the preset Changing dark energy, Einstein gravity. Read the distance ratio to the cosmological-constant model at the probe shell, then drag the shell to $z=1$ and $z=2$. The ratio is about 0.984 at $z=0.5$ and stays near 0.980 beyond $z=1$. Explain why it stops changing once dark energy no longer dominates.
2. Choose Same expansion, stronger pull. The growth curves separate, yet the distance ratio stays at one at every redshift. Use the formula for $D_{\mathrm M}$ to say why.
3. Drag $w_a$ while watching the tick marks on the light cone. The ticks of your universe move against the faint cosmological-constant ticks. Find a setting that shortens distances by about 2% at $z=0.5$.

## Exercises

1. Show from the conservation law that $w=-1$ gives a constant density, and that $w=-1/3$ gives a density falling as $a^{-2}$.
2. In the matter-only universe, compute $D_{\mathrm M}$ at $z=3$ in units of $c/H_0$ and in megaparsecs for $h=0.68$.
3. Explain, without integrating, why $w_0=-0.9$ makes the distance to $z=0.5$ shorter than a cosmological constant does.
4. A colleague claims that a supernova sample and a BAO sample that agree on the expansion history together test general relativity. What do they actually test?

Answers

For the first exercise, $\mathrm d\ln\rho/\mathrm d\ln a=-3(1+w)$ vanishes when $w=-1$, so $\rho$ is constant. With $w=-1/3$ the slope is $-2$, so $\rho\propto a^{-2}$.

For the second, $1/\sqrt{4}=1/2$, so $D_{\mathrm M}=2(1-1/2)=1$ in units of $c/H_0$. That is $4409\,\mathrm{Mpc}$ for $h=0.68$.

For the third, $w>-1$ means the dark-energy density was larger in the past, by the factor $(1+z)^{3(1+w)}$ for constant $w$. A larger density means a larger expansion rate at every intermediate redshift, so each element $\mathrm dz/E$ of the distance integral is smaller.

For the fourth, they test whether one expansion history fits both kinds of distance, including the calibration of the ruler and the supernova brightness. They test the background, not the law of gravity. A modified theory with the same expansion history passes both. Testing gravity needs growth or lensing, which the next chapter introduces.

## Sources

1. [Weinberg and White, PDG Review of Particle Physics 2025, §28.1](https://pdg.lbl.gov/2025/reviews/rpp2025-rev-dark-energy.pdf)
2. [DESI DR2 BAO results, 2025](https://arxiv.org/html/2503.14738v3)
3. [Zumalacárregui et al. 2017, hi\_class](https://arxiv.org/abs/1605.06102)

Drag the dark-energy settings and read the distance ratio at the probe shell. [Open the Lab](https://sandboxphysics.com/labs/dark-energy-modified-gravity/)

## Keep reading

Dark energy or modified gravity · Reading path

### Distances, growth, lensing and stability

1. [Article **Can the same expansion come with different gravity?**](https://sandboxphysics.com/stories/dark-energy-or-modified-gravity/same-expansion-different-gravity/)
2. [You are here **How distances record the expansion**](https://sandboxphysics.com/stories/dark-energy-or-modified-gravity/how-distances-record-expansion/)
3. [Article **How growth and lensing feel gravity**](https://sandboxphysics.com/stories/dark-energy-or-modified-gravity/how-growth-and-lensing-feel-gravity/)
4. [Article **Modified gravity in four functions, and when it is stable**](https://sandboxphysics.com/stories/dark-energy-or-modified-gravity/modified-gravity-in-four-functions-and-stability/)
5. [Article **Recompute the expansion and growth grid**](https://sandboxphysics.com/stories/dark-energy-or-modified-gravity/recompute-a-background-growth-grid/)
6. [Article **Reading the DESI 2024 modified-gravity paper**](https://sandboxphysics.com/stories/dark-energy-or-modified-gravity/reading-desi-2024-modified-gravity/)
