|q⟩ Bad Qubits

advanced · Programming · Advanced VQE & Ansatz Design

Checkpoint: Design a Better Ansatz

This checkpoint pulls the module together. You will design an ansatz that hits a specific chemistry ground state exactly, while respecting the physical symmetry that makes the problem tractable in the first place. The lessons you are combining: expressibility (can the ansatz reach the target?), barren plateaus (is it trainable?), and symmetry preservation (does it stay physical?).

The target

The ground state of a minimal two-electron model — the spin singlet — is

∣ψ⋆⟩=12(∣01⟩−∣10⟩).|\psi^\star\rangle = \frac{1}{\sqrt{2}}\bigl(|01\rangle - |10\rangle\bigr).

Two features define it. First, it is an equal-weight superposition of the two single-excitation states. Second, it carries a relative minus sign, the antisymmetry that marks a singlet rather than a triplet. Both must come out right.

Why a hardware-efficient ansatz is the wrong tool here

A generic two-qubit hardware-efficient ansatz can certainly reach this state — it is highly expressible. But that very freedom is a liability:

The better design

Restrict the search to the one-excitation subspace from the outset with a particle-number- preserving Givens rotation. Starting from the single-excitation reference ∣01⟩|01\rangle, the Givens gate G(θ)G(\theta) rotates within span{∣01⟩,∣10⟩}\mathrm{span}\{|01\rangle, |10\rangle\} and never leaks amplitude into ∣00⟩|00\rangle or ∣11⟩|11\rangle:

G(θ) ∣01⟩=cos⁡θ2 ∣01⟩−sin⁡θ2 ∣10⟩.G(\theta)\,|01\rangle = \cos\tfrac{\theta}{2}\,|01\rangle - \sin\tfrac{\theta}{2}\,|10\rangle.

The minus sign is built in. All that remains is the angle. Equal weight requires cos⁡(θ/2)=sin⁡(θ/2)\cos(\theta/2) = \sin(\theta/2), i.e. θ/2=π/4\theta/2 = \pi/4, so

θ=π2⟹G(π2) ∣01⟩=12(∣01⟩−∣10⟩)=∣ψ⋆⟩.\theta = \frac{\pi}{2} \quad\Longrightarrow\quad G(\tfrac{\pi}{2})\,|01\rangle = \frac{1}{\sqrt{2}}\bigl(|01\rangle - |10\rangle\bigr) = |\psi^\star\rangle.

One parameter, one entangling structure, and the answer is exact — a vivid illustration that a small, symmetry-respecting ansatz can beat a large generic one.

Try it

Build the particle-number-preserving ansatz, choose the correct angle, and prepare the singlet. The grader verifies four things at once: zero amplitude on ∣00⟩|00\rangle and ∣11⟩|11\rangle (particle number conserved), equal probability 1/21/2 on ∣01⟩|01\rangle and ∣10⟩|10\rangle (correct weights), and the +/−+/- sign structure of the amplitudes (correct singlet phase).

Run your code to see the quantum state.

If any check fails, inspect the amplitudes: a nonzero ∣00⟩|00\rangle or ∣11⟩|11\rangle means your circuit broke the symmetry; a wrong sign means you used a state-preparation that does not match the Givens convention.

Sign in on the full site to ask questions and join the discussion.