• Fundamentals
  • Also: state initialization
  • Also: amplitude encoding

State Preparation

The process of initializing a quantum register into a specific target quantum state, a necessary first step for many quantum algorithms that requires careful circuit design.

State preparation is the process of transforming the default initial state of a quantum register (typically 0n|0\rangle^{\otimes n}) into a specific target state ψtarget|\psi_{\text{target}}\rangle. This is a prerequisite for many quantum algorithms: Grover’s algorithm starts from a uniform superposition, VQE starts from a chemically-motivated ansatz state, and quantum machine learning algorithms often require encoding classical data into quantum amplitudes. The efficiency of state preparation directly impacts the overall feasibility of these algorithms.

General state preparation

An arbitrary nn-qubit state has 2n2^n complex amplitudes (subject to normalization), so preparing a fully general state requires a circuit with O(2n)O(2^n) gates. This exponential cost means that efficient state preparation is possible only for states with special structure.

The standard approach decomposes the target state using a sequence of controlled rotations. For example, to prepare a 2-qubit state ψ=a00+b01+c10+d11|\psi\rangle = a|00\rangle + b|01\rangle + c|10\rangle + d|11\rangle:

  1. Apply Ry(θ1)R_y(\theta_1) to qubit 0 to set the amplitudes of the 0x|0x\rangle and 1x|1x\rangle subspaces
  2. Apply controlled-Ry(θ2)R_y(\theta_2) gates conditioned on qubit 0 to set the amplitudes within each subspace

This recursive “divide and conquer” approach generalizes to nn qubits with O(2n)O(2^n) CNOT gates and O(2n)O(2^n) rotation gates.

Efficient special cases

Several important state classes can be prepared efficiently:

Uniform superposition: +n=12nxx|+\rangle^{\otimes n} = \frac{1}{\sqrt{2^n}}\sum_x |x\rangle requires only nn Hadamard gates (depth 1).

Product states: Any state of the form ψ1ψ2ψn|\psi_1\rangle \otimes |\psi_2\rangle \otimes \cdots \otimes |\psi_n\rangle requires only O(n)O(n) single-qubit gates.

W states: Wn=1n(1000+0100++0001)|W_n\rangle = \frac{1}{\sqrt{n}}(|100\ldots0\rangle + |010\ldots0\rangle + \cdots + |000\ldots1\rangle) can be prepared with O(n)O(n) gates.

GHZ states: 12(0n+1n)\frac{1}{\sqrt{2}}(|0\rangle^{\otimes n} + |1\rangle^{\otimes n}) requires one Hadamard and n1n-1 CNOTs (depth O(n)O(n), or O(logn)O(\log n) with ancillas).

Sparse states: States with only kk nonzero amplitudes can be prepared in O(kn)O(kn) gates.

Matrix product states: States with bounded entanglement (low Schmidt rank across any bipartition) can be prepared in polynomial depth.

Amplitude encoding

A particularly important application of state preparation is amplitude encoding: loading a classical data vector x=(x0,x1,,xN1)\mathbf{x} = (x_0, x_1, \ldots, x_{N-1}) into the amplitudes of a quantum state:

x=1xi=0N1xii|\mathbf{x}\rangle = \frac{1}{\|\mathbf{x}\|}\sum_{i=0}^{N-1} x_i |i\rangle

This encodes N=2nN = 2^n classical values into nn qubits, an exponential compression. However, the preparation circuit requires O(N)O(N) gates, which can negate the quantum speedup of the subsequent algorithm. This “data loading bottleneck” is a major challenge for quantum machine learning.

State preparation on hardware

On real devices, state preparation circuits contribute errors just like any other circuit. For NISQ algorithms, simpler (shallower) state preparation is usually better, even if it produces a less accurate initial state. Variational state preparation, where the initial state is a parameterized circuit optimized during the algorithm, is an alternative that trades preparation accuracy for reduced circuit depth.

Why it matters for learners

State preparation is where many quantum algorithms face their first practical bottleneck. Understanding the costs and tradeoffs of different preparation methods helps you evaluate algorithm claims realistically. A quantum algorithm with an exponential speedup in the “main computation” but an exponential cost in state preparation may offer no end-to-end advantage.

See also