In a flat universe, the comoving distance accumulates the inverse expansion rate along the light path. The Hubble distance instead uses the expansion rate at one redshift. Supernova brightness and the acoustic ruler constrain these distances after calibration. Once the expansion is fixed, the separate perturbation response to gravity does not enter either distance.
Read Can the same expansion come with 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. The physical separation between two points at fixed comoving coordinates 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=a1.
The expansion rate is the fractional growth of the scale factor per unit time, H=a˙/a, with present value H0. Write H0=100hkms−1Mpc−1. The distance light covers in one Hubble time, c/H0, is the natural unit of length: for h=0.68 it is 4408.7Mpc.
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 Ω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
For a fluid with pressure p and mass density ρ, the energy change in an expanding volume is the negative of its pressure times the volume change. Negative pressure reverses the sign of that work. Energy conservation in an expanding universe gives
dlnadlnρ=−3(1+w),w≡ρc2p.
Matter has w=0 and recovers ρ∝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)=w0+wa(1−a). Here w0 is today's value and wa measures how much it differed in the past. DESI DR2 BAO results, 2025
During an interval with w>−1, the density decreases as the universe expands. It is higher at the earlier end of that interval. When w<−1 the density grows as the universe expands, which is called phantom behaviour. The Lab uses exactly this background, with Ωm=0.31 unless you change it.
From the expansion rate to distances
A light ray moving toward us covers the comoving distance cdt/a in a short time dt. Since dz=−da/a2 and da=aHdt, the forward-time distance element is −cdz/H. Redshift falls as we follow the ray toward the observer. Reversing the integration limits gives
DM(z)=H0c∫0zE(z′)dz′.
In a flat universe this is also the transverse comoving distance. An object of comoving size r at redshift z spans the angle r/DM. A second distance measures separations along the line of sight: a small redshift interval Δz corresponds to the comoving length DHΔz, with
DH(z)=H(z)c.
Galaxy surveys measure the baryon acoustic scale rd across the sky and along the line of sight, which yields DM/rd and DH/rd. Supernovae measure the luminosity distance (1+z)DM up to an overall calibration. The dimensionless background enters through E(z). The absolute distances also need H0, and the BAO ratios depend on the ruler length rd.
A check you can do exactly
In a universe of matter only, Ωm=1 and E=(1+z)3/2. The integral has a closed form:
DM(z)=H02c(1−1+z1).
At z=1 this is 0.585786c/H0. 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 Ωm=0.31, h=0.68 and a cosmological constant. At z=0.5 the scale factor is 2/3, and
E2=0.31×1.53+0.69=1.73625,E=1.3177.
Numerical integration of 1/E from zero to one half gives DM=0.4395c/H0≃1938Mpc. The line-of-sight distance is DH=c/(H0E)=3346Mpc. Prescribe an acoustic scale of 147Mpc for the example. It then spans about 147/1938=0.0759 radians, or 4.3 degrees on the sky in the small-angle approximation.
Now let dark energy have w0=−0.9 and wa=0. Its density at z=0.5 is 1.50.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.4326c/H0, 1.6% shorter. The same ruler would look 1.6% larger.
Finally take the crossing model that resembles the DESI preference, w0=−0.752 and wa=−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 μ, does not enter, and neither does the bending of light.
This has a precise consequence. Differentiate the comoving distance: dDM/dz=c/H(z). If two flat models predict the same DM(z) at every redshift, they have the same H(z), and therefore the same DH and the same luminosity distance. This inference assumes an exactly known, continuously sampled comoving distance in the flat model. Real surveys constrain it at finite redshifts and with uncertainties.
A modified theory of gravity also produces some expansion history. If its expansion can be represented by the flat Friedmann equation with the assumed matter density and a positive effective dark-energy density, that density defines an effective w(a). The linear form used in the Lab describes only some such histories. 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
Lab tasks
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.
Choose Same expansion, stronger pull. The growth curves separate, yet the distance ratio stays at one at every redshift. Use the formula for DM to say why.
Drag wa 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
Show from the conservation law that w=−1 gives a constant density, and that w=−1/3 gives a density falling as a−2.
In the matter-only universe, compute DM at z=3 in units of c/H0 and in megaparsecs for h=0.68.
Explain, without integrating, why w0=−0.9 makes the distance to z=0.5 shorter than a cosmological constant does.
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?
AnswersShow the answer
For the first exercise, dlnρ/dlna=−3(1+w) vanishes when w=−1, so ρ is constant. With w=−1/3 the slope is −2, so ρ∝a−2.
For the second, 1/4=1/2, so DM=2(1−1/2)=1 in units of c/H0. That is 4409Mpc 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 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.