In short
This is the multi-qubit practice chapter. You have met the CNOT, the Toffoli, Bell states, GHZ states, SWAP, controlled-Z, and the basic circuit identities. Below are eight worked problems that compose those pieces into short, recognisable circuits — build every Bell state from |00\rangle, build GHZ from |000\rangle, construct SWAP from three CNOTs, build controlled-Z from a CNOT sandwiched between two Hadamards, trace a mystery circuit step by step, and preview an oracle-based algorithm. Each problem comes with the input state, a hint, a step-by-step solution, a labelled circuit SVG, and a one-line Qiskit snippet for verification. Five self-test problems at the end let you check your fluency. The chapter is the multi-qubit counterpart to the Single-Qubit Practice article — same rhythm, same expectations, more qubits.
Note: Interactive version coming soon
An interactive drag-a-gate, multi-qubit circuit-builder widget — where you place gates on wires, hit "run," and see the state-vector update in real time — is planned for a future version of padho-wiki. Until it ships, this article is the pen-and-paper (or Qiskit) equivalent: every problem solved with matrix algebra, every circuit drawn as a labelled SVG, every answer verifiable with a two-line Qiskit script.
You have spent several chapters building the multi-qubit toolkit. CNOT entangles two qubits. Toffoli adds a third control for reversible AND. Bell states are the four maximally entangled two-qubit states. GHZ and W states are three-qubit entangled states of two very different kinds. SWAP exchanges qubits; controlled-Z phases the |11\rangle component; circuit identities tell you which gate sequences are equivalent.
Now you put them together. The problems below are canonical constructions — the kind of thing you need to write down in forty seconds on a whiteboard without looking anything up. Each one has a cleanly stated input, a cleanly stated output, and a short solution. Some can be solved with one gate; some need three; two require the full grammar of multi-qubit circuits.
A reminder on conventions before you start. Circuits are drawn left to right in time — the leftmost gate is applied first. The matrix product runs right to left — the leftmost matrix is applied last. Qubit ordering in kets like |q_1 q_0\rangle: the rightmost bit is qubit 0 (Qiskit convention). This wiki follows the Nielsen & Chuang convention where top wire in a circuit is qubit 0 and appears leftmost in the ket — |q_0 q_1\rangle. When you work a problem in Qiskit, double-check which convention the example uses.
The eight problems
The problems are arranged in increasing composition depth — Problem 1 uses two gates; Problem 8 introduces an oracle and previews what a quantum algorithm looks like.
Problem 1: Build $|\Phi^+\rangle$ from $|00\rangle$
Given: |00\rangle = |0\rangle \otimes |0\rangle, the trivial two-qubit state.
Target: the Bell state |\Phi^+\rangle = \tfrac{1}{\sqrt 2}(|00\rangle + |11\rangle) — the prototype entangled state of two qubits.
Hint: first put qubit 0 into an equal superposition; then entangle the two qubits with a CNOT.
Step 1. Apply H to qubit 0. Under H, |0\rangle \mapsto \tfrac{1}{\sqrt 2}(|0\rangle + |1\rangle). Qubit 1 stays in |0\rangle. The joint state becomes
Why H on qubit 0: the target has nonzero amplitude on both |00\rangle and |11\rangle, so some amplitude must flow from |0\rangle to |1\rangle on the control qubit. H is the minimum-depth gate that produces an equal-amplitude |0\rangle + |1\rangle superposition, which is exactly what you need.
Step 2. Apply CNOT with qubit 0 as control and qubit 1 as target. CNOT flips qubit 1 iff qubit 0 is |1\rangle, so
Why CNOT: it is the minimum entangling operation. Without a two-qubit gate, you can only ever build product states — |\psi_0\rangle \otimes |\psi_1\rangle — and the Bell states are not product states. The CNOT takes the |10\rangle branch of the superposition (control = 1) and flips the target, producing |11\rangle; it leaves the |00\rangle branch alone. The two branches of amplitude 1/\sqrt 2 are now correlated — measurement of one determines the other, which is the essence of entanglement.
Result. Two gates: H on qubit 0, then CNOT with qubit 0 controlling qubit 1.
Qiskit one-liner: qc = QuantumCircuit(2); qc.h(0); qc.cx(0, 1).
Problem 2: Build $|\Phi^-\rangle$ from $|00\rangle$
Given: |00\rangle.
Target: |\Phi^-\rangle = \tfrac{1}{\sqrt 2}(|00\rangle - |11\rangle) — the Bell state with a minus sign.
Hint: the minus sign is a relative phase between |00\rangle and |11\rangle. Either prepare the control with a |0\rangle - |1\rangle superposition instead of |0\rangle + |1\rangle, or take Problem 1's output and add a Z.
Step 1. Apply X then H to qubit 0. X|0\rangle = |1\rangle; H|1\rangle = |-\rangle = \tfrac{1}{\sqrt 2}(|0\rangle - |1\rangle). The joint state becomes
Why X first and not just H: applying H directly to |0\rangle gives |+\rangle = \tfrac{1}{\sqrt 2}(|0\rangle + |1\rangle), which produces |\Phi^+\rangle after CNOT. To get |\Phi^-\rangle you need the minus sign, and starting from |1\rangle (after an X) gives |-\rangle after H, which threads the minus sign through the CNOT onto the |11\rangle branch.
Step 2. Apply CNOT with qubit 0 as control. The CNOT flips qubit 1 whenever qubit 0 is |1\rangle, but it does not touch the amplitudes — so the minus sign on |10\rangle survives onto |11\rangle:
Result. Three gates: X, then H, then CNOT — all on the obvious wires.
Qiskit one-liner: qc = QuantumCircuit(2); qc.x(0); qc.h(0); qc.cx(0, 1).
Problem 3: Build $|\Psi^+\rangle$ and $|\Psi^-\rangle$
Given: |00\rangle.
Targets: |\Psi^+\rangle = \tfrac{1}{\sqrt 2}(|01\rangle + |10\rangle) and |\Psi^-\rangle = \tfrac{1}{\sqrt 2}(|01\rangle - |10\rangle).
Hint: |\Psi^\pm\rangle have support on |01\rangle and |10\rangle — opposite bit-strings, not equal ones. Flip qubit 1 at the end.
Step 1. For |\Psi^+\rangle: build |\Phi^+\rangle first (H then CNOT, as in Problem 1), then apply X to qubit 1:
Step 2. For |\Psi^-\rangle: build |\Phi^-\rangle first (Problem 2), then apply X to qubit 1:
Why an X on qubit 1 converts |\Phi\rangle to |\Psi\rangle: the difference between |\Phi\rangle and |\Psi\rangle states is whether the two bit-values are correlated (both same) or anti-correlated (opposite). Flipping just qubit 1 changes "both 0 or both 1" into "0 and 1 or 1 and 0." The sign stays where it was because X acts linearly and does not touch amplitudes.
Result. To build |\Psi^+\rangle: H on qubit 0, CNOT with qubit 0 controlling qubit 1, X on qubit 1. To build |\Psi^-\rangle: the same plus an X on qubit 0 at the very start (to thread the minus sign in, exactly as in Problem 2).
Qiskit one-liner (for |\Psi^+\rangle): qc.h(0); qc.cx(0, 1); qc.x(1).
Problem 4: Build $|\text{GHZ}\rangle$ from $|000\rangle$
Given: |000\rangle, a three-qubit state.
Target: the GHZ state |\text{GHZ}\rangle = \tfrac{1}{\sqrt 2}(|000\rangle + |111\rangle).
Hint: same structure as the Bell state, but with one extra CNOT cascading the control.
Step 1. Apply H to qubit 0. The state becomes \tfrac{1}{\sqrt 2}(|000\rangle + |100\rangle).
Step 2. Apply CNOT with qubit 0 as control and qubit 1 as target. The state becomes \tfrac{1}{\sqrt 2}(|000\rangle + |110\rangle).
Step 3. Apply CNOT with qubit 0 as control and qubit 2 as target. (Alternatively, qubit 1 could control qubit 2; either works because once qubits 0 and 1 are correlated, controlling from either one produces the same three-way correlation.) The state becomes
Why cascade CNOTs: the GHZ state has three qubits perfectly correlated — measuring any one determines the other two. Each CNOT threads the control's bit-value into one more target qubit, extending the correlation by one qubit per CNOT. For n-qubit GHZ, you need n-1 CNOTs (or a shallower \log n-depth tree — see the Going Deeper section of GHZ and W states).
Result. Three gates: H on qubit 0, CNOT(0 \to 1), CNOT(0 \to 2).
Qiskit one-liner: qc = QuantumCircuit(3); qc.h(0); qc.cx(0, 1); qc.cx(0, 2).
Problem 5: Trace a mystery circuit
Given: the two-qubit circuit shown below: starting from |00\rangle, apply H to qubit 0, then apply H to qubit 1, then apply CNOT with qubit 0 controlling qubit 1.
Target: work out the final state.
Hint: first apply the two Hadamards in parallel to get a uniform four-way superposition; then apply CNOT.
Step 1. H \otimes H on |00\rangle.
Step 2. Apply CNOT. Recall CNOT flips qubit 1 iff qubit 0 is |1\rangle. So:
- |00\rangle \mapsto |00\rangle
- |01\rangle \mapsto |01\rangle
- |10\rangle \mapsto |11\rangle
- |11\rangle \mapsto |10\rangle
Applying CNOT to the full superposition:
Why the final state is the same as the intermediate one: CNOT permuted the four basis states, taking |10\rangle \leftrightarrow |11\rangle. But the coefficients on |10\rangle and |11\rangle were both 1/2 before the CNOT, so the permutation left the sum unchanged.
Step 3. The final state is the uniform superposition over all four basis states:
In other words, applying H to each qubit, then CNOT, gives the same state as just applying H to each qubit — the CNOT was redundant for this particular input. This is a famous circuit identity: \text{CNOT}\,(H \otimes H)|00\rangle = (H \otimes H)|00\rangle.
Result. Final state: \tfrac{1}{2}(|00\rangle + |01\rangle + |10\rangle + |11\rangle), i.e., |+\rangle \otimes |+\rangle — an unentangled product state.
Qiskit one-liner: qc.h(0); qc.h(1); qc.cx(0, 1); print(Statevector(qc)).
Problem 6: Build SWAP from 3 CNOTs
Given: two qubits in arbitrary states |a\rangle and |b\rangle (with a, b \in \{0, 1\} for the computational-basis check).
Target: a circuit that swaps the qubits — output state is |b\rangle \otimes |a\rangle.
Hint: three CNOTs with alternating control-target directions do the job.
Step 1. Apply CNOT with qubit 0 as control and qubit 1 as target. State |a\rangle|b\rangle \mapsto |a\rangle|a \oplus b\rangle, where \oplus is XOR.
Step 2. Apply CNOT with qubit 1 as control and qubit 0 as target. State |a\rangle|a\oplus b\rangle \mapsto |a \oplus (a \oplus b)\rangle |a \oplus b\rangle = |b\rangle |a \oplus b\rangle.
Why a \oplus (a \oplus b) = b: XOR is associative and a \oplus a = 0, so a \oplus a \oplus b = 0 \oplus b = b. The XOR trick for swapping bits without a temporary variable is a classical programming chestnut; CNOT implements it quantumly, linearly, on the whole computational-basis superposition.
Step 3. Apply CNOT with qubit 0 as control and qubit 1 as target. State |b\rangle|a \oplus b\rangle \mapsto |b\rangle |b \oplus (a \oplus b)\rangle = |b\rangle|a\rangle.
Result. Three CNOTs — alternating 0→1, 1→0, 0→1 — implement SWAP. Verify by computational-basis enumeration:
- |00\rangle \mapsto |00\rangle (unchanged)
- |01\rangle \mapsto |10\rangle (swapped)
- |10\rangle \mapsto |01\rangle (swapped)
- |11\rangle \mapsto |11\rangle (unchanged)
All four basis states map to the swapped version. By linearity, the same holds for every superposition input.
Qiskit one-liner: qc.cx(0, 1); qc.cx(1, 0); qc.cx(0, 1) — three CNOTs. Qiskit also has a native qc.swap(0, 1) that compiles to the same three CNOTs on hardware that only supports CNOTs.
Problem 7: Build controlled-$Z$ from CNOT and two Hadamards
Given: access to CNOT and single-qubit Hadamards.
Target: a controlled-Z gate, which applies a Z to qubit 1 iff qubit 0 is |1\rangle. On basis states:
- |00\rangle \mapsto |00\rangle
- |01\rangle \mapsto |01\rangle
- |10\rangle \mapsto |10\rangle
- |11\rangle \mapsto -|11\rangle
Hint: use the single-qubit identity HXH = Z (proved in Single-Qubit Practice, Problem 7). Sandwich the CNOT's target between two Hs.
Step 1. The identity HXH = Z says: conjugating X by H produces Z. If you replace the target's X (inside a CNOT) with HZH, the whole controlled-X becomes a controlled-Z.
Step 2. The construction:
Verify on |11\rangle:
- (I \otimes H)|11\rangle = |1\rangle \otimes H|1\rangle = |1\rangle \otimes \tfrac{1}{\sqrt 2}(|0\rangle - |1\rangle) = \tfrac{1}{\sqrt 2}(|10\rangle - |11\rangle).
- CNOT flips qubit 1 iff qubit 0 = 1: \tfrac{1}{\sqrt 2}(|10\rangle - |11\rangle) \mapsto \tfrac{1}{\sqrt 2}(|11\rangle - |10\rangle).
- (I \otimes H) on the result: H|1\rangle = \tfrac{1}{\sqrt 2}(|0\rangle - |1\rangle), H|0\rangle = \tfrac{1}{\sqrt 2}(|0\rangle + |1\rangle). So \tfrac{1}{\sqrt 2}(|1\rangle \otimes H|1\rangle - |1\rangle \otimes H|0\rangle) = \tfrac{1}{2}|1\rangle \otimes [(|0\rangle - |1\rangle) - (|0\rangle + |1\rangle)] = \tfrac{1}{2}|1\rangle \otimes (-2|1\rangle) = -|11\rangle. \checkmark
Why HZH = X and not the other way round: both directions work — HXH = Z and HZH = X, since H is self-inverse (H^2 = I). The version you use depends on what you already have. You have CNOT (which is controlled-X); sandwiching the target's X with Hs converts the X into Z, giving CZ.
Step 3. Sanity-check the remaining basis states:
- |00\rangle: qubit 1 is already |0\rangle, the two Hs and the CNOT leave the state unchanged.
- |01\rangle: after first H, state becomes \tfrac{1}{\sqrt 2}|0\rangle(|0\rangle - |1\rangle); CNOT (control=|0\rangle) does nothing; second H undoes the first. Net: |01\rangle.
- |10\rangle: after first H, \tfrac{1}{\sqrt 2}|1\rangle(|0\rangle + |1\rangle); CNOT flips target based on control: \tfrac{1}{\sqrt 2}|1\rangle(|1\rangle + |0\rangle) — same thing, order of basis vectors only. Second H: |10\rangle back. Net: |10\rangle.
- |11\rangle \mapsto -|11\rangle as computed above.
All four match the CZ truth table. The construction works.
Result. \text{CZ} = (I \otimes H) \cdot \text{CNOT} \cdot (I \otimes H) — a CNOT sandwiched between two Hadamards on the target wire.
Qiskit one-liner: qc.h(1); qc.cx(0, 1); qc.h(1) — three lines that implement qc.cz(0, 1).
Problem 8: Design a circuit around an oracle (Deutsch preview)
Given: an oracle U_f — a black-box two-qubit gate that implements a one-bit Boolean function f : \{0, 1\} \to \{0, 1\} as U_f |x\rangle|y\rangle = |x\rangle|y \oplus f(x)\rangle. You do not know what f is, but you have access to one use of U_f. You are told f is either constant (both f(0) and f(1) give the same bit) or balanced (they give different bits).
Target: decide, in a single use of the oracle, whether f is constant or balanced. (This is the simplest instance of Deutsch's algorithm.)
Hint: classically, you would need two queries — evaluate f(0) and f(1) separately. A quantum circuit can do it in one query, by exploiting superposition on the input register and phase kickback from the ancilla.
Step 1. Prepare two qubits. Qubit 0 (the input to f): |0\rangle. Qubit 1 (an ancilla): |1\rangle.
Step 2. Apply H to qubit 0 and H to qubit 1. The state becomes
Step 3. Apply the oracle U_f. Compute term by term:
- U_f|00\rangle = |0\rangle|0 \oplus f(0)\rangle = |0\rangle|f(0)\rangle.
- U_f|01\rangle = |0\rangle|1 \oplus f(0)\rangle = |0\rangle|\overline{f(0)}\rangle.
So U_f (|00\rangle - |01\rangle) = |0\rangle(|f(0)\rangle - |\overline{f(0)}\rangle) = (-1)^{f(0)}|0\rangle(|0\rangle - |1\rangle).
Why the (-1)^{f(0)} factor: if f(0) = 0, |f(0)\rangle - |\overline{f(0)}\rangle = |0\rangle - |1\rangle. If f(0) = 1, it equals |1\rangle - |0\rangle = -(|0\rangle - |1\rangle). Either way, the result is (-1)^{f(0)}(|0\rangle - |1\rangle). The oracle's effect on the input qubit is multiplication by a phase — this is called phase kickback.
Similarly, U_f(|10\rangle - |11\rangle) = (-1)^{f(1)}|1\rangle(|0\rangle - |1\rangle).
The full state after U_f is \tfrac{1}{2}[(-1)^{f(0)}|0\rangle + (-1)^{f(1)}|1\rangle] \otimes (|0\rangle - |1\rangle).
Step 4. The ancilla has factored out and is now in state \tfrac{1}{\sqrt 2}(|0\rangle - |1\rangle) = H|1\rangle — the same as its initial value. Apply H to qubit 0 and measure it:
- If f is constant, (-1)^{f(0)} = (-1)^{f(1)}, so the factor [(-1)^{f(0)}|0\rangle + (-1)^{f(1)}|1\rangle] is \pm (|0\rangle + |1\rangle), which Hadamards to \pm|0\rangle. Measurement gives 0.
- If f is balanced, (-1)^{f(0)} = -(-1)^{f(1)}, so the factor is \pm(|0\rangle - |1\rangle), which Hadamards to \pm|1\rangle. Measurement gives 1.
Step 5. Read the measurement outcome. 0 \Rightarrow constant; 1 \Rightarrow balanced. One oracle call, one measurement, one deterministic answer.
Result. Deutsch's algorithm uses phase kickback to convert the classical property of f (constant vs balanced) into a quantum amplitude pattern on qubit 0, readable with a single measurement. This is the prototype of every quantum algorithm that achieves a provable speedup over classical — the speedup comes from interference between oracle branches, not from any mythical parallelism.
Qiskit one-liner: qc.x(1); qc.h(0); qc.h(1); qc.append(Uf, [0, 1]); qc.h(0); qc.measure(0, 0).
Self-test: five problems
Now work these without looking at the solutions above. Each is solvable with the tools covered so far. Verify with Qiskit if you want (pip install qiskit and a Statevector print call is enough).
- Build the Bell state |\Psi^-\rangle from |00\rangle using the fewest possible gates. (Hint: combine tricks from Problems 2 and 3.)
- Build a three-qubit W state |W\rangle = \tfrac{1}{\sqrt 3}(|100\rangle + |010\rangle + |001\rangle) from |000\rangle. (This is genuinely harder than GHZ — you will need controlled rotations with non-right-angle parameters, or a clever reshape from a two-qubit state.)
- Given a three-qubit state |\psi\rangle, build a circuit that swaps qubits 0 and 2 (leaving qubit 1 alone). Use only CNOTs. (Hint: can you use two pairwise SWAPs?)
- Design a two-qubit circuit that, starting from |00\rangle, outputs |0\rangle on qubit 0 and \tfrac{1}{\sqrt 2}(|0\rangle + |1\rangle) on qubit 1. (Two different solutions exist — one with only Hadamards, and one with CNOT + H.)
- Trace through: starting from |+\rangle|+\rangle, apply CZ, then H to qubit 0, and finally measure qubit 0. What is the probability of measuring 0? What is the post-measurement state of qubit 1?
Summary — the multi-qubit gate reference
Common confusions
-
"Gate order in a diagram is the same as gate order in the matrix product." No — the leftmost gate in a circuit is applied first, but in the matrix product U_k \cdots U_2 U_1|\psi\rangle the leftmost matrix is applied last. The circuit is read left-to-right in time; the algebra reads right-to-left. Always translate carefully.
-
"CNOT and CZ are different gates that do different things." They are different gates, but they are related by Hadamards on the target wire (Problem 7). Hardware that exposes only one of the two can always build the other with two extra Hs. On many native-gate sets, CNOT and CZ cost the same two-qubit-gate depth, so the choice is a compiler decision, not a correctness one.
-
"A CNOT commutes with a single-qubit gate on the other wire." Sometimes — depends on which gate. CNOT with control q_0, target q_1 commutes with any single-qubit gate on q_0 that is diagonal in the computational basis (Z, S, T) because those gates do not affect the control-eigenvalue. It does not commute with X or H on q_0, because those change which computational-basis state qubit 0 is in.
-
"Two CNOTs on the same wires cancel." Yes, \text{CNOT}^2 = I. The CNOT is self-inverse. But two CNOTs on different wire orderings (one with q_0 \to q_1, one with q_1 \to q_0) do not cancel — they form a different gate (two-thirds of a SWAP, see Problem 6).
-
"Bell states all look the same." They look similar, but the sign pattern matters. |\Phi^+\rangle and |\Phi^-\rangle produce identical measurement statistics in the computational basis (both give 00 half the time and 11 half the time) — but measured in the X-basis or after a half-CNOT operation, they behave differently. The relative phase is observable; do not confuse it with a global phase (which is unobservable).
-
"GHZ and W states are basically the same three-qubit entangled state." They are genuinely different — GHZ is fully correlated (measuring any one qubit determines the others); W is "one excitation distributed over three qubits" (measuring any one and finding 1 tells you the other two are 0, but finding 0 leaves the remaining two in a still-entangled state). Their entanglement structures differ: GHZ is destroyed if you trace out any one qubit; W retains bipartite entanglement between the remaining two.
-
"The oracle in Deutsch's algorithm is just a CNOT." For some f, yes — the identity f(x) = x makes U_f a CNOT. For f(x) = 1-x, U_f is CNOT plus an X on the target. For constant functions, U_f is I or a single X on the target. The algorithm (Deutsch) treats U_f as a black box regardless of its internal structure; the interference pattern at the end distinguishes constant from balanced without ever opening the box.
Going deeper
If you can solve the eight worked problems and take an honest shot at the five self-tests, you have the multi-qubit toolkit in your hands. The sections below extend into Qiskit-based verification, multi-qubit state visualisation, and previews of the full quantum algorithms built from these building blocks.
Verifying problems in Qiskit
Qiskit is IBM's open-source quantum computing SDK, installable in one line (pip install qiskit qiskit-aer). Every problem in this article has a Qiskit verification of at most four lines:
from qiskit import QuantumCircuit
from qiskit.quantum_info import Statevector
qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)
print(Statevector(qc)) # Expect: [1/√2, 0, 0, 1/√2] for |Phi+⟩
Swap in whichever circuit you want to verify. The Statevector class returns the full quantum state without collapsing it — a simulator luxury that real hardware cannot provide (real qubits give you measurement outcomes only).
For Indian students, IBM Quantum Platform (at quantum.ibm.com) offers free access to real superconducting quantum hardware. Account creation is free; the monthly allocation includes enough compute time to run every circuit in this article on a real chip in Yorktown Heights or Ehningen. Running a Bell-state preparation on real hardware and comparing the measurement statistics (which will be slightly off from 50/50 due to noise) to your simulator result is one of the most instructive single hours you can spend in quantum computing.
Multi-qubit state-vector visualisation with qsphere
The Bloch sphere does not extend to two or more qubits (four complex amplitudes do not fit on a 3D ball). Qiskit's qsphere visualisation plots each basis state as a point on a sphere, with the radial distance encoding the amplitude magnitude and the point's colour encoding the phase:
from qiskit.visualization import plot_state_qsphere
plot_state_qsphere(Statevector(qc))
For GHZ state: you see two bright dots at |000\rangle (north pole) and |111\rangle (south pole) — the two amplitudes that are nonzero — and six dim dots for the six basis states with amplitude zero. For W state: three dots at equal latitude on the "one-excitation" ring — the three basis states |100\rangle, |010\rangle, |001\rangle — each with amplitude 1/\sqrt 3. The structural difference between GHZ and W is visible in a single qsphere plot, which is exactly what a good visualisation should do.
Previews — teleportation and superdense coding
Both of these protocols are two-qubit algorithms built from the patterns above.
Quantum teleportation uses a Bell pair and a Bell measurement. Alice has unknown |\psi\rangle on qubit 0; Alice and Bob share |\Phi^+\rangle on qubits 1 and 2 (Alice holds qubit 1; Bob holds qubit 2). Alice applies CNOT(q_0 \to q_1), then H on q_0, then measures q_0 and q_1. The two classical bits tell Bob which of four Pauli corrections (I, X, Z, XZ) to apply to qubit 2; the result is that qubit 2 ends up in state |\psi\rangle. See classical-control for the full diagram.
Superdense coding runs teleportation in reverse — Alice and Bob share a Bell pair, and Alice encodes 2 classical bits into Alice's half by applying one of I, X, Z, XZ, then sends her qubit to Bob who does a Bell measurement to recover the 2 bits. It shows that 1 qubit can communicate 2 classical bits, given shared entanglement.
Both protocols use every single gate and state in Problems 1 through 7 above. Once you are fluent with the problems in this article, the protocols take about one page of working each.
Compiling to hardware-native gates
Real quantum chips do not run CNOTs directly — they run native gates specific to the hardware. Superconducting chips typically expose R_z, \sqrt{X}, and a two-qubit entangling gate like \text{ECR} or \text{CZ}. Qiskit's compiler (the transpile function) takes your circuit at the logical gate level (CNOTs, Hadamards) and rewrites it at the hardware gate level — which can dramatically change gate counts and depths.
A CNOT on an IBM Heron chip typically compiles to one ECR gate plus a handful of single-qubit rotations — a total of maybe 6 operations. A SWAP, being 3 CNOTs, compiles to around 18 operations. Every CNOT you can eliminate (by clever circuit design) saves real coherence. This is why circuit-identity tricks like Problem 7 matter: the (I \otimes H)\text{CNOT}(I \otimes H) = \text{CZ} identity saves gates when the native gate set contains CZ and not CNOT.
Extending to arbitrary oracle-based algorithms
Deutsch's algorithm (Problem 8) uses phase kickback from a 1-bit oracle. Real algorithms use oracles over many qubits — Deutsch-Jozsa works with n-bit oracles; Simon's algorithm extracts hidden structure from a more general black box; Grover's algorithm builds a diffusion operator around the oracle; Shor's algorithm embeds modular arithmetic into a quantum Fourier transform that feeds on the oracle's output. In every case, the three-move pattern is the same: put the input register into a uniform superposition with Hadamards, query the oracle once, apply interference-inducing gates, measure. The problems in this article are the opening moves of every one of these algorithms.
Where this leads next
- Single-qubit practice — the one-qubit practice chapter. Same rhythm, simpler problems.
- Quantum teleportation — the full protocol, built from the pieces in Problems 1 and 7.
- Superdense coding — two classical bits into one qubit, using a shared Bell pair.
- Deutsch's algorithm — the Problem 8 preview, worked in complete detail with the interference pattern.
References
- Qiskit Textbook, Multi-qubit gates and entanglement — interactive walk-throughs of Bell states, CNOT, Toffoli, and the identities used here.
- John Preskill, Lecture Notes on Quantum Computation, Chapters 4–5 — theory.caltech.edu/~preskill/ph229.
- Nielsen and Chuang, Quantum Computation and Quantum Information — §4.2–4.3 on multi-qubit gates and circuit identities — Cambridge University Press.
- Wikipedia, Quantum circuit — standard diagram conventions.
- IBM Quantum Learning, Introduction to Quantum Computing — free self-paced course covering the same circuits with hands-on Qiskit notebooks.
- Barenco et al., Elementary gates for quantum computation (1995) — arXiv:quant-ph/9503016 — the foundational decomposition paper showing every multi-qubit gate is built from single-qubit rotations and CNOTs.