---
title: "Quantum Circuit Puzzle: Build Entanglement Step by Step"
description: "Put gates on two or three qubits until the output matches the target. These browser puzzles build up superposition, interference, and then entanglement."
url: https://tadams.net/quantum/circuit
---

[Quantum demos](https://tadams.net/quantum)

# Circuit puzzle

Put gates on two or three qubits until what they give matches the target.

New to qubits: start with the short guide, [Quantum basics](https://tadams.net/quantum#q-basics-title).

Puzzle 1 of 11

How to play

- Each line is one qubit, named q0, q1, and so on from the top. Its gates run from left to right.
- Select a gate below, then select a square on a line to place it there. Select the square again to take it off.
- Or drag a gate onto a square, drag a placed gate to move it, or drag it off the circuit to take it off.

You reach the target at a 100% match. The match can start above 0%, because your start and the target can already overlap.

Gate

### What you getOutput state

Your circuit Target

Each row is one result. How to read this table

## How to read the output

Each row is one result you can get when you look at the qubits. Its label lists the qubits from the top of the circuit down, so |01⟩ means q0 reads 0 and q1 reads 1.

The bar is the chance of that result. The number under Amount is that part of the state, called its amplitude. Its size sets the chance: multiply the size by itself, so 0.707 × 0.707 is about 0.5. It can also carry a minus sign or an i, which set its direction on the small dial: a minus sign is a half turn, and an i is a quarter turn. The sign and the i do not change the chance, so −0.707 and 0.707i also give about 0.5. The direction is called the phase.

When you measure, you see only the bars. Two states can have the same bars and different dials. So a gate that turns only the dials looks like it does nothing, until a later gate makes the dials add up or cancel out.

Match to target says how close your output is to the target. It counts the dials as well as the bars, so it can start above 0% before you place a gate, and it reaches 100% only when both match. Turning all the dials by the same amount does not count, because no measurement can see it.

Each row is one computational basis state. The dial draws its amplitude as a vector in the complex plane: the length is the magnitude and the angle is the phase. The bar is the probability, which is the squared magnitude.

A measurement in this basis returns only the probabilities, and a global phase never shows. A relative phase changes nothing in one measurement, but a later H gate converts it into a change in probability. That conversion is interference.

## The gates

H, the Hadamard gate, makes a fair coin from a 0 or a 1, and turns that coin back. X, the bit flip, swaps 0 and 1. Z, the phase flip, and S, the phase gate, turn the dial of the 1 part. CNOT, the controlled NOT, links two qubits: it flips the qubit marked ⊕ only when the qubit marked with a dot is 1. The dot can sit above or below the ⊕. The box, marked f, flips the bottom qubit when its hidden rule gives 1 for the qubits above it.

The Hadamard gate is H = (X + Z) / √2. X and Z are the Pauli X and Z gates, and X is the quantum NOT. Z = diag(1, −1) and S = diag(1, i), so S² = Z. CNOT maps |c, t⟩ to |c, t ⊕ c⟩, with any control and target. Two puzzles allow only a CNOT that targets the qubit just below its control, since their lessons need that limit. H, S, and CNOT generate the Clifford group. Add T, and the set is universal. The box is the oracle Uf|x⟩|y⟩ = |x⟩|y ⊕ f(x)⟩. It permutes the basis states, so it is unitary for any f, and it is its own inverse.

## Other demos

- [Bloch sphere golf](https://tadams.net/quantum/bloch-golf)
- [The bomb tester](https://tadams.net/quantum/bomb-tester)
- [Entanglement games](https://tadams.net/quantum/chsh)
- [Teleportation](https://tadams.net/quantum/teleportation)
- [Eavesdropper](https://tadams.net/quantum/eavesdropper)
- [Keep it alive](https://tadams.net/quantum/error-correction)
- [Intercepts](https://tadams.net/quantum/intercepts)

Explain
