Welcome
In any direction you point a microwave receiver in space, you pick up a faint, almost perfectly uniform glow of photons. This is the cosmic microwave background — light released years after the Big Bang, when the universe first became transparent. It is the oldest electromagnetic signal we can detect, and its tiny anisotropies (one part in on the sky) are a high-resolution snapshot of the universe long before stars, galaxies, or any of the structure we see today had formed.
A tutorial about the CMB is really a tutorial about cosmological perturbation theory: how to predict, from a small number of cosmological parameters, the statistical properties of those temperature variations and their polarization counterpart. The aim of this series is to walk through that calculation end-to-end, building a small computational pipeline as we go.
How to use this tutorial.
Open a Jupyter notebook next to this text. Every code block in the chapters can be pasted directly into a cell and run. By the end you will have computed temperature and polarization spectra from scratch, included gravitational lensing, included primordial gravitational waves, and compared the result against CAMB. The prerequisites chapter walks you through the one-time setup.
A brief history
The theoretical prediction came first. In 1948 Ralph Alpher and Robert Herman, students of George Gamow, estimated that the hot early universe should have left behind a relic radiation field at a temperature of a few kelvin. Their paper was largely forgotten. In 1964 Arno Penzias and Robert Wilson were trying to use a horn antenna at Bell Labs to map radio sources in the Milky Way and could not get rid of a persistent isotropic noise at about . They were unaware of the prediction. A team at Princeton — Robert Dicke, Jim Peebles, David Wilkinson, and Peter Roll — was, independently, building a detector to look for it. When the two groups met, the identification was immediate, and Penzias and Wilson received the 1978 Nobel Prize.
The theoretical machinery for predicting the anisotropies followed in parallel. Rainer Sachs and Arthur Wolfe (1967) worked out the gravitational redshift contribution that bears their names. Joseph Silk (1968) computed the diffusion damping that suppresses small-scale structure. Rashid Sunyaev and Yakov Zel'dovich (1970) worked out the acoustic peak pattern that we now use to measure the geometry of the universe, as well as the spectral distortions from hot electrons that bear their names. Wayne Hu and collaborators in the 1990s built much of the modern framework relating the spectra to cosmological parameters. Uros Seljak and Matias Zaldarriaga (1996) wrote down the line-of-sight integration method that made the computation tractable; every modern Boltzmann code, including the one in this tutorial, uses it.
Experimentally, the path went COBE (1992, the first anisotropy detection), BOOMERanG and MAXIMA (1998-2000, the first acoustic peaks), WMAP (2003-2010, precision cosmology), Planck (2009-2018, the current gold standard), and ground-based polarization experiments — ACT, SPT, BICEP/Keck — that are now the most sensitive on small angular scales and on -mode polarization. The next generation, Simons Observatory, CMB-S4, and the LiteBIRD satellite, target the primordial gravitational-wave signature predicted by inflation.
A short history of the universe
Times are measured from the Big Bang, in the standard CDM cosmology with Planck 2018 parameters.
— Inflation. A brief epoch of accelerated, near-de Sitter expansion. Quantum fluctuations of a light scalar field are stretched to super-horizon scales and frozen in as classical curvature perturbations with a nearly scale-invariant spectrum,
Tensor modes (gravitational waves) are produced at the same time, with amplitude .
to — Reheating, baryogenesis, electroweak transition. The inflaton decays into a hot relativistic plasma. The matter-antimatter asymmetry is generated. The Higgs field condenses; particles become massive.
, — Neutrino decoupling. Neutrinos stop interacting with the plasma and free-stream from this point on. Their anisotropic stress is imprinted on the gravitational potentials and observable through a phase shift in the CMB acoustic peaks.
— Big Bang nucleosynthesis. Light element abundances are set by competition between weak rates and the expansion. This fixes the baryon density, independent of the CMB.
, — Matter-radiation equality. Matter density catches up with radiation density. The transition leaves an imprint on the matter power spectrum turnover and on the CMB acoustic peak heights.
, — Recombination. Free electrons and protons combine into neutral hydrogen. Photons last-scatter around this redshift and have travelled freely ever since. This snapshot is the CMB.
to , - — Reionization. The first stars and quasars produce UV radiation that re-ionizes intergalactic hydrogen. CMB photons see a second, lower-amplitude scattering surface.
to — Structure formation and lensing. Matter perturbations grow into halos and the cosmic web. Gradients of the gravitational potential along the line of sight deflect CMB photons by , smoothing the acoustic peaks and converting -mode power into a small -mode signal.
— Dark energy domination. The universe enters a second period of accelerated expansion. Gravitational potentials decay along the line of sight, producing the late-time integrated Sachs-Wolfe effect on the largest scales.
Why we predict spectra, not maps
The universe is one realization of a stochastic process. We have only one sky, and we cannot rerun the Big Bang. What inflation gives us is a probability distribution over initial conditions: the primordial perturbation is, to excellent approximation, a Gaussian random field. Linear physics turns it into another Gaussian random field, the CMB temperature anisotropy . All the information a Gaussian random field carries is in its two-point function.
The temperature field decomposes on the sphere:
The angular power spectrum is the variance of the . It is what theory predicts. The map you draw from is one realization; the spectrum is the statistical envelope, and that is what we compare to.
Reading the TT spectrum
The most familiar CMB spectrum is versus . It is the central object of this tutorial: by the end of the power-spectrum chapter, the code you wrote will produce it. Below is the prediction from Planck-2018 CDM, annotated with the physics behind each feature.
Working through the features:
Sachs-Wolfe plateau (). Photons climbing out of large potential wells at last scattering are gravitationally redshifted; this temperature shift is the original Sachs-Wolfe effect. The plateau scales with the primordial amplitude and the gravitational potential normalization.
Integrated Sachs-Wolfe rise at the very lowest . When a photon transits a time-varying potential along the line of sight it picks up an extra blue/redshift, . The potentials decay at late times under dark energy and slightly during the radiation-to-matter transition. The late-time ISW contribution shifts the lowest few multipoles upward; removing dark energy would remove this rise.
First acoustic peak at . Modes that completed roughly one quarter compression by recombination produce a maximum in the temperature variance. The peak location depends on , the angular size of the sound horizon at last scattering — this fixes the geometry. The peak height depends on (baryons compress harder) and on the redshift of matter-radiation equality.
Even/odd peak ratio. Increasing baryon density enhances compression peaks (odd-numbered: 1, 3, 5) and suppresses rarefaction peaks (even: 2, 4). This is how the baryon density was measured well before BBN became a precision probe.
Peak heights and the matter density . Modes that entered the horizon during radiation domination experienced “radiation driving”: the potentials decayed while they oscillated, boosting their amplitude. The transition between driven and undriven modes lies near and shifts with . The relative heights of the second and third peaks measure .
Silk damping tail (). Photon diffusion smears small-scale perturbations on a characteristic comoving scale . The damping envelope depends on the recombination history and on , , and the expansion rate (hence on , the effective number of relativistic species).
Reionization smoothing. Some of photons rescatter off free electrons at . The TT spectrum is suppressed by at . Combined with the low- EE bump (covered in the power-spectrum chapter), this constrains .
Neutrino effects. Free-streaming neutrinos shift the acoustic peaks slightly and suppress small-scale power. The effective number of relativistic species enters through the radiation density and through the damping scale.
Lensing smoothing. Gravitational lensing by intervening structure smears the peaks at the few-percent level for . The same physics generates the lensing -mode signal. This is the topic of the lensing chapter.
What the rest of this tutorial covers
The chapters mirror how a Boltzmann code is built:
- Prerequisites
Setting up your Jupyter environment, the first cell of imports and parameters, and the unit conventions used throughout.
- 1. Background
The expanding universe. We derive both Newtonian-mechanically (Friedmann from energy conservation) and from the Einstein equations, code it up, and plot it.
- 2. Recombination
What sets the photon last-scattering surface. The Saha equation, the Peebles modification, the visibility function , the Thomson opacity history.
- 3. Perturbations
Linear perturbations of the metric and matter species. The Boltzmann hierarchy for photons, baryons, CDM, and neutrinos.
- 4. Line-of-sight integration
How to avoid evolving the full Boltzmann hierarchy to today: the Seljak-Zaldarriaga trick of factoring the transfer function as source Bessel projection.
- 5. Power spectra
Projecting transfer functions onto . Comparison against CAMB.
- 6. Lensing
The Weyl potential, the lensing-potential power spectrum , and the convolution that turns unlensed spectra into lensed ones.
- 7. Tensors
Gravitational-wave perturbations and the distinctive -mode signature they produce. The tensor Boltzmann hierarchy, spin-2 line-of-sight projections, the limits of numerical accuracy.
Each chapter has the same rhythm: physics in plain English, the key equations with derivations in side-boxes, a code block you paste into your notebook, the plot that comes out, and what to look at. Appendices contain the longer derivations.
Notation conventions. We use natural units with and where convenient. Comoving distances are in Mpc unless stated otherwise. Greek indices () run over spacetime; Latin () over space. Metric signature is . Conformal time is denoted (not optical depth, which we call where ambiguity threatens). is the conformal-time Hubble parameter, the physical one.