Two qubits and the Bell pair
The CNOT gate flips one qubit when another is 1. Use it to build a Bell pair, and learn how Qiskit orders a two-bit string.

A Bell pair is two qubits whose answers are each uncertain and still agree with each other, on every shot of a perfect simulator. The circuit below builds one with a Hadamard and a CNOT, a gate that acts on two qubits at once.
The answer now has two characters, and Qiskit writes them with qubit 0 on the right; the gate row on two-character answers below explains the order.
A gate that acts on two qubits
Every gate so far acted on one qubit. The CNOT acts on two: a control and a target. The CNOT flips the target only if the control is 1; with the control at 0 it does nothing.
On its own the rule is a plain conditional, the kind an ordinary program writes with an if. When the control is in superposition, the CNOT applies its rule to each of the control's two options.
The CNOT gate
cx(control, target). Flips the target if the control is 1, leaves it alone if the control is 0. Applied to a target at 0 while the control is in superposition, it makes the two qubits agree: measure them and, with no noise, you get 00 or 11 and never 01 or 10.
Two-character answers
With two ordinary bits, classical bits in Qiskit's words, every shot reads two characters, one per bit. Qiskit writes bit 0, which here holds qubit 0, on the right: the string 10 means qubit 1 read 1 and qubit 0 read 0. Read the string from the right to read it in qubit order.
The circuit, then the code
The circuit is two gates and two measurements:
qc = QuantumCircuit(2, 2) # two qubits, two ordinary bits
qc.h(0) # qubit 0 into superposition
qc.cx(0, 1) # CNOT: control qubit 0, target qubit 1
qc.measure([0, 1], [0, 1]) # qubit 0 into bit 0, qubit 1 into bit 1
The plumbing is lesson 2's, unchanged. The keys of the counts dict are two characters now, and the bar loop prints one line per string that was read.
# 'backend' already exists when this runs: it is whatever you pick in the Run on Qollab dialog.
from qiskit import QuantumCircuit
from qiskit.providers.jobstatus import JobStatus
import time
shots = 1000
1qc = QuantumCircuit(2, 2)
2qc.h(0)
3qc.cx(0, 1)
4qc.measure([0, 1], [0, 1])
print(qc)
job = backend.run(qc, shots=shots)
while job.status() not in (JobStatus.DONE, JobStatus.ERROR, JobStatus.CANCELLED):
time.sleep(5)
counts = job.result().get_counts()
print(counts)
5for bits, n in sorted(counts.items()):
print(f"{bits}: {n:4d} {100 * n / shots:5.1f}% {'█' * (50 * n // shots)}")
- 1two qubits, two ordinary bits
- 2qubit 0 into superposition, as in lesson 2
- 3the CNOT: flip qubit 1 if qubit 0 is 1, and it acts inside the superposition
- 4read both: qubit 0 into bit 0, qubit 1 into bit 1
- 5each key is now two characters: bit 1 on the left, bit 0 on the right
Run the circuit
Predict the tally first. Four strings are possible, 00, 01, 10 and 11. Which of them will you see, and in what shares? Then open the project, press Run on Qollab, choose IonQ Aria 1, and press Run. Then fork it, the way lesson 1 showed, so the edits below land in your own copy.

Our press on 15 September 2026, on the Aria 1 noise model, came back {'00': 512, '01': 3, '10': 1, '11': 484}: 51.2% 00, 48.4% 11, and four shots in a thousand where the two qubits disagreed.
The few 01 and 10 shots come from the noise model; on a perfect simulator the pair never disagrees.
Why the pair always agrees
After the Hadamard, qubit 0 carries two options, 0 and 1, with no value chosen. The CNOT's rule is: flip qubit 1 wherever qubit 0 is 1.
The CNOT applies that rule to both options at once. Where qubit 0 is 0, qubit 1 stays 0; where qubit 0 is 1, qubit 1 becomes 1.
So the circuit never holds 01 or 10 as an option, and measuring cannot produce them. The circuit holds 00 or 11, weighted half and half, and the measurement returns one of those. Two qubits in that state are called a Bell pair, the smallest case of entanglement.
Assignment: make the CNOT copy a plain 1
- In your fork, replace
qc.h(0)withqc.x(0), so qubit 0 is a definite1when the CNOT sees it. There is no superposition now, so the CNOT has one case to handle. - Apply the gate row's rule, flip the target if the control is
1, and work out what each of the two measurements reads. Write the answer as a string with qubit 0 on the right. - Press Run on Qollab and choose IonQ Aria 1.
- Compare the tally with your answer.
Solution
qc = QuantumCircuit(2, 2)
qc.x(0)
qc.cx(0, 1)
qc.measure([0, 1], [0, 1])
Qubit 0 is 1, so the CNOT flips qubit 1 to 1. Both read 1 and every shot is 11. With a definite control the CNOT is an ordinary conditional; the previous press was the same gate with a control in superposition.
Which character is which qubit
In the Bell pair 00 and 11 read the same in either bit order, so the order never shows. The next circuit produces a string where the order matters; predict the string before you run.
Assignment: find qubit 0 in the string
- Starting from the version with
qc.x(0), change that line toqc.x(1)and leave the CNOT in. - Work out whether the CNOT changes its target, now that its control, qubit 0, is never flipped.
- Work out which character the qubit that reads
1is written in, by the gate row on two-character answers. - Write down
01or10. - Press Run on Qollab and choose IonQ Aria 1.
Solution
Qubit 0 stays 0, so the CNOT does nothing to qubit 1, which keeps the 1 the X gate gave it. Qubit 1 is 1 and qubit 0 is 0, and Qiskit writes qubit 0 on the right: the string is 10.
If you expected 01, you read the string left to right in qubit order. Read the tally from the right, qubit 0 first.
Measuring is per qubit
The pair agrees when both qubits are measured. Measuring only one of them is a valid circuit too, and the tally still shows two characters, because there are still two bits. A bit that no measurement writes to stays at 0.
Assignment: read only one qubit of the pair
- Change
qc.x(1)back toqc.h(0), so the circuit is the Bell pair again:qc.h(0), then the CNOT. - Replace the measurement line with
qc.measure(0, 0), so only qubit 0 is read. - Work out what qubit 0 alone reads over many shots, given it was put into superposition, and what bit 1 holds when nothing ever writes to it.
- Put the two together into two-character strings, qubit 0 on the right.
- Press Run on Qollab and choose IonQ Aria 1.
Solution
qc = QuantumCircuit(2, 2)
qc.h(0)
qc.cx(0, 1)
qc.measure(0, 0)
Qubit 0 reads 0 or 1, half each. Bit 1 stays 0. So the tally is 00 and 01, about half each. Qubit 1 was still in the pair; the circuit did not measure it. Measure both again and the tally goes back to 00 and 11.
Lesson 4's RY gate takes an angle and moves a qubit part of the way from 0 to 1.
Stay in the loop.
Get the latest tutorials, demos, and project showcases straight to your inbox. No noise, just the good stuff.
Enable JavaScript to sign up.
Qollab updates only. Unsubscribe any time. Privacy Policy.
On this page
