Preparing a thermal quantum state is an algorithmic problem in its own right. The target Gibbs state ρβ=e−βH/Z contains the equilibrium statistics of Hamiltonian H at inverse temperature β, but producing that density operator on a quantum computer can be as difficult as solving the many-body physics that created it.
Guide 48 owns the thermodynamic meaning of Gibbs states, free energy and resource theories. This guide owns the algorithmic construction and sampling problem: how a quantum computer may prepare or approximate thermal states, estimate partition functions, sample energies and evaluate thermal observables.
No single Gibbs-state algorithm is best in every regime. Complexity depends on β, spectral width, Hamiltonian structure, state-preparation access, minimum relevant Gibbs weights, spectral gaps, Markov-chain mixing and the precision target.
Hamiltonian + temperature → choose purification/filter/Markov strategy → prepare approximate Gibbs state → estimate thermal observables or partition-function ratios → validate mixing, bias and truncation.
1. Gibbs state and partition function
For Hamiltonian H with eigenpairs H|E_j⟩=E_j|E_j⟩,
ρ_β=e^{-βH}/Z(β)
with
Z(β)=Tr(e^{-βH})=Σ_j e^{-βE_j}.
In the energy basis, thermal probability is
p_j=e^{-βE_j}/Z.
2. Two-level worked Gibbs state
Take energies E₀=0 and E₁=Δ.
Then
Z=1+e^{-βΔ}
and
ρ_β=diag(1,e^{-βΔ})/(1+e^{-βΔ}).
For βΔ=2,
e^{-2}≈0.135335;Z≈1.135335;p_1≈0.119203;p_0≈0.880797.
3. Why thermal-state preparation is harder than sampling one classical distribution
ρβ may contain quantum coherence in a computational basis even though it is diagonal in the energy basis.
Preparing it can require access to eigenvalue information about H, controlled simulation of e−iHt, block encodings of H, or a Markov process whose fixed point is ρβ.
Low temperature is especially difficult because probability concentrates on a small low-energy subspace.
4. Purification viewpoint
A mixed Gibbs state can be purified using an ancilla register:
|TFD_β⟩=(1/√Z)Σ_j e^{-βE_j/2}|E_j⟩_S|E_j⟩_A.
Tracing out the ancilla gives
Tr_A |TFD_β⟩⟨TFD_β|=ρ_β.
This thermofield-double construction turns mixed-state preparation into pure-state preparation on twice the Hilbert space.
5. Infinite-temperature starting point
At β=0,
ρ_0=I/d.
A purification is the maximally entangled state
|Φ⟩=(1/√d)Σ_j |j⟩|j⟩.
Formally applying e−βH/2 to the system half gives the thermofield state after normalisation.
The algorithmic challenge is that e−βH/2 is nonunitary.
6. Imaginary-time filtering
Real-time evolution uses e−iHt. Thermal filtering uses imaginary time:
e^{-βH/2}.
High-energy amplitudes are suppressed exponentially relative to low-energy amplitudes.
Because the map is not unitary, quantum algorithms implement it probabilistically, variationally, through block encodings/linear combinations, or inside a larger unitary dilation.
7. Phase-estimation thermal filtering
One conceptual algorithm is:
- prepare a broad state with overlap on many eigenstates;
- run quantum phase estimation to write an energy estimate Ej into an ancilla;
- perform an energy-dependent ancilla rotation with amplitude proportional to e−βE_j/2;
- uncompute the energy register;
- postselect or amplitude-amplify a success flag.
Conditioned on success, eigenstate amplitudes receive the desired Boltzmann weighting.
8. Success probability can become small
If the initial purification corresponds to I/d, ideal thermal filtering success probability is proportional to
Z/d
after appropriate energy shifting/scaling.
At low temperature, Z can be dominated by a small number of low-energy states while d is exponentially large.
Amplitude amplification can quadratically improve postselection cost but cannot make exponentially tiny initial overlap disappear for free.
9. Energy shifts are harmless to the normalised Gibbs state
Replace H by H+cI.
Then
e^{-β(H+cI)}=e^{-βc}e^{-βH}.
The scalar e−βc cancels between numerator and partition function.
Therefore the normalised Gibbs state is invariant under an overall energy shift, although algorithmic success amplitudes and numerical scaling may change.
10. Quantum Metropolis idea
Classical Metropolis sampling proposes a move from energy E to E’ and accepts it with probability
min(1,e^{-β(E'−E)}).
Temme and collaborators developed a quantum Metropolis algorithm that uses phase estimation and coherent accept/reject operations while respecting quantum no-cloning constraints. [2]
The desired Gibbs distribution is stationary under a detailed-balance-like quantum walk/Markov construction.
11. Why quantum rejection is delicate
Classically, a rejected proposal restores the old state from memory.
Quantumly, one cannot simply copy an unknown old state before proposing a move.
The quantum Metropolis construction uses coherent projective/phase-estimation steps and carefully designed reversals to return to the previous energy subspace after rejection.
This is one of the algorithmic differences between “quantise the Metropolis rule” and a naive direct translation.
12. Mixing time matters
A Markov procedure is useful only if it approaches its stationary Gibbs state rapidly enough.
If Δ is the spectral gap of an appropriate reversible classical transition matrix, classical mixing time scales inversely with Δ up to logarithmic factors.
Quantum walk versions can sometimes obtain square-root improvements in hitting or mixing-related quantities, but the exact complexity depends on the quantisation and access model.
At low temperature or across phase transitions, thermal mixing can become exponentially slow.
13. Annealing in temperature
Instead of jumping directly from β=0 to large β, use a schedule
0=β_0<β_1<…<β_L=β.
Prepare ρβ₀, then transform successively toward lower temperatures.
Neighbouring Gibbs states can have much larger fidelity/overlap than the β=0 and β target states directly.
This is the thermal analogue of adiabatic/annealing continuation.
14. Partition-function ratios
Absolute Z can be enormous or tiny, but ratios between nearby temperatures are often easier.
Using Gibbs expectation at β,
Z(β+Δβ)/Z(β)=Tr[ρ_β e^{-ΔβH}].
Estimate successive ratios and multiply them:
Z(β_L)=Z(0)∏_{k=0}^{L−1} Z(β_{k+1})/Z(β_k).
Since Z(0)=d, the infinite-temperature normalisation is known.
15. Free energy from Z
The equilibrium Helmholtz free energy is
F=−β^{-1}lnZ
for β>0 with kB=1 units.
Therefore relative error in Z translates into additive error in lnZ/free energy.
Estimating Z accurately can be harder than preparing a state sufficient for a few local observables.
16. Thermal observable estimation
Once ρβ is prepared, an observable O has thermal expectation
⟨O⟩_β=Tr(ρ_β O).
For Pauli-decomposed observables, measure the corresponding terms.
Amplitude estimation from Guide 57 can quadratically improve sampling dependence in ideal coherent-oracle settings, but this may require coherent state preparation/unpreparation of the thermal routine.
17. Energy sampling
If one can prepare ρβ and run phase estimation on H, the measured energy Ej occurs with probability e−βE_j/Z.
Repeated energy measurements therefore sample the thermal energy distribution.
From those samples one can estimate mean energy, heat capacity and other spectral thermodynamic quantities, subject to phase-estimation resolution.
18. Ground-state limit
As β→∞, Gibbs weight concentrates on the ground-state manifold.
If the ground state is unique and separated by gap Δ, excited-state contamination scales roughly with e−βΔ times degeneracy factors.
Therefore Gibbs preparation can act as ground-state preparation at low temperature—but the required β and algorithmic cost may grow severely when Δ is small.
19. Critical slowing down
Near a thermal or quantum critical regime, long correlation lengths and small gaps can make both physical and algorithmic thermalisation slow.
A Markov chain can develop a small spectral gap. Imaginary-time filtering can require larger β or higher polynomial degree. Tensor-network representations can need larger bond dimension.
Thermal algorithms therefore inherit real many-body difficulty; quantum computation does not automatically remove critical complexity.
20. Variational thermal states
Near-term methods may prepare a parameterised purification or mixed state ρ(θ) and minimise a free-energy objective
F_β(ρ)=Tr(Hρ)−β^{-1}S(ρ).
The Gibbs state minimises this objective exactly.
The difficulty is estimating entropy S(ρ) and training a sufficiently expressive ansatz without large bias or barren plateaus.
21. Quantum imaginary-time evolution
Variational quantum imaginary-time methods replace the nonunitary equation
d|ψ⟩/dτ=−(H−⟨H⟩)|ψ⟩
with motion inside a parameterised unitary manifold chosen by a variational principle.
Purified thermal-state algorithms can extend this idea to finite temperature.
Convergence is ansatz dependent and does not inherit the exact guarantees of an ideal full imaginary-time operator automatically.
22. Classical shadows for thermal observables
If many observables must be estimated from repeated copies of a prepared Gibbs state, classical shadows from Guide 23 may reduce total measurement cost compared with measuring each observable independently.
The benefit depends on observable shadow norms and measurement ensemble.
This separates two costs:
- cost to prepare each Gibbs-state copy;
- cost to extract all desired thermal observables from those copies.
23. Complexity assumptions must be stated
Quantum Gibbs algorithms may assume:
- sparse Hamiltonian oracle access;
- efficient Hamiltonian simulation or block encoding;
- known energy bounds;
- rapidly mixing Markov chains;
- efficient preparation of warm-start states;
- polynomially bounded inverse success probability.
Removing one assumption can change the complexity class of the whole pipeline.
24. Quantum advantage is regime specific
Classical Gibbs sampling is extremely strong for many systems: Monte Carlo, cluster algorithms, tensor networks and classical molecular dynamics each dominate important regimes.
Quantum advantage is most plausible for systems with severe sign problems, real-time/thermal combinations, quantum state inputs or observables naturally available on a quantum simulator.
A quantum Gibbs algorithm should be compared with the strongest method for the physical model, not with naive exhaustive diagonalisation.
25. Common misconception: Gibbs preparation is just cooling the qubits
Algorithmic Gibbs preparation targets the Gibbs state of a chosen Hamiltonian H. The physical refrigerator cools the hardware’s device Hamiltonian and environment, which is not generally the same problem Hamiltonian.
26. Common misconception: knowing the partition function gives the state
Z is one scalar normalisation. Preparing ρβ requires the full operator e−βH/Z, which contains eigenvectors and all Boltzmann weights.
27. Common misconception: low temperature always makes preparation easier because only the ground state matters
Low temperature can make success overlap and mixing worse, especially with small gaps or many metastable low-energy sectors.
28. Worked synthesis problem
A two-level system has energies 0 and Δ with βΔ=2.
Step 1: Partition function. Z=1+e^{-2}=1.135335…
Step 2: Probabilities. p_0=1/Z≈0.880797, p_1=e^{-2}/Z≈0.119203.
Step 3: Thermofield purification. |TFD⟩≈√0.880797|00⟩+√0.119203|11⟩.
Step 4: Mean energy. ⟨H⟩=0.119203Δ.
Step 5: Algorithmic interpretation. A thermal-state algorithm must reproduce these weights without first diagonalising H classically; its cost is judged by Hamiltonian access, β, precision, mixing/success probability and the desired observable.
29. Practice set
- Define ρβ and Z.
- What is a thermofield-double purification?
- Why is e−βH/2 algorithmically difficult?
- How can phase estimation help thermal filtering?
- Why can low-temperature postselection probability be small?
- What does quantum Metropolis try to reproduce?
- Why is rejection harder quantumly than classically?
- Why does mixing time matter?
- How can partition-function ratios be chained across β?
- What observable is obtained by phase-estimating a prepared Gibbs state?
- Why does the ground-state limit become hard near a small spectral gap?
- Name three assumptions that should accompany a Gibbs-preparation complexity claim.
Answers
ρ_β=e^{-βH}/Z,Z=Tr(e^{-βH}).(1/√Z)Σ_j e^{-βE_j/2}|E_j⟩|E_j⟩, whose ancilla trace gives ρβ.- It is nonunitary and suppresses amplitudes by energy-dependent real factors.
- It writes approximate energies into a register so controlled rotations can apply Boltzmann-dependent amplitudes.
- The desired low-energy sector may have exponentially small weight in an easy broad starting state.
- A Markov process with the Gibbs state as stationary distribution/state under a quantum detailed-balance construction.
- No-cloning prevents simply storing an unknown state copy before attempting a move.
- A stationary distribution is useful only if the chain approaches it within feasible time.
- Estimate
Z(β_{k+1})/Z(β_k)at neighbouring temperatures and multiply from known Z(0)=d. - A thermal sample of the energy spectrum.
- Excited-state suppression requires βΔ≫1 while algorithmic mixing/overlap often deteriorates as Δ becomes small.
- Examples: Hamiltonian oracle/block-encoding model, β, precision, spectral width/gaps, warm-start overlap, Markov mixing and state-preparation cost.
Sources and further study
[1] David Poulin and Pawel Wocjan, Sampling from the thermal quantum Gibbs state and evaluating partition functions with a quantum computer, Physical Review Letters 103, 220502 (2009).
[2] Kristan Temme and colleagues, Quantum Metropolis Sampling, Nature 471, 87–90 (2011). A quantum accept/reject thermalisation framework.
[3] Anirban Narayan Chowdhury and Rolando D. Somma, Quantum algorithms for Gibbs sampling and hitting-time estimation, Quantum Information & Computation 17, 41–64 (2017).
[4] Mario Motta and colleagues, Determining eigenstates and thermal states on a quantum computer using quantum imaginary time evolution, Nature Physics 16, 205–210 (2020).
Continue through Quantum Mathematics
Guide 65: Shor’s Algorithm, Order Finding, Period Finding, Modular Exponentiation and Integer Factoring covers arithmetic period finding. Guide 66: Hidden Subgroup Problems, Simon’s Algorithm, Fourier Sampling and Abelian Quantum Algorithms generalises symmetry finding. Guide 68: Quantum Semidefinite Programming, Matrix Multiplicative Weights, Convex Optimisation and Quantum SDP Solvers uses Gibbs-sampling ideas inside convex optimisation algorithms.
