Back to Learn

Quantum Computing 101

Entanglement

Entangled qubits share one joint state that cannot be split into a state for each qubit.

In this lesson you will learn to

  • Distinguish product states from entangled states.
  • Build a Bell pair with H and CX and follow its state gate by gate.
  • Predict the correlations in Bell-pair measurements.
  • Read multi-qubit states in Qiskit's qubit order.

Product States and Entangled States

Two qubits have four basis states, |00⟩, |01⟩, |10⟩ and |11⟩, so a two-qubit state has four amplitudes.

Sometimes those four amplitudes come from two separate qubits. The state |+⟩ ⊗ |0⟩ = (|00⟩ + |10⟩)/√2 is a product state: each qubit has its own state, and measuring one tells you nothing about the other.

Other states cannot be split up like this. They are entangled: only the pair as a whole has a state.

Worked example: the Bell state cannot be factored

Try to write (|00⟩ + |11⟩)/√2 as a product of two one-qubit states and watch it fail.

(a∣0⟩+b∣1⟩)⊗(c∣0⟩+d∣1⟩)=ac∣00⟩+ad∣01⟩+bc∣10⟩+bd∣11⟩(a|0\rangle+b|1\rangle)\otimes(c|0\rangle+d|1\rangle)=ac|00\rangle+ad|01\rangle+bc|10\rangle+bd|11\rangle
Match 12(∣00⟩+∣11⟩):ac=bd=12,ad=bc=0\text{Match }\tfrac{1}{\sqrt2}(|00\rangle+|11\rangle):\quad ac=bd=\tfrac{1}{\sqrt2},\qquad ad=bc=0
ad=0⇒a=0 or d=0, but ac≠0 and bd≠0 need a≠0 and d≠0. Contradiction.ad=0\Rightarrow a=0\text{ or }d=0,\ \text{but }ac\neq0\text{ and }bd\neq0\text{ need }a\neq0\text{ and }d\neq0.\ \text{Contradiction.}

Building a Bell Pair

The Bell state |Φ+⟩ = (|00⟩ + |11⟩)/√2 takes just two gates: H on the first qubit, then a CX with the first qubit as the control.

Kub walks the Bell circuit. H on q0 creates a superposition of two branches; CX then flips q1 only in the branch where q0 is 1, so the qubits end up perfectly correlated. Bars show amplitudes with q0 written first (Qiskit prints labels the other way round, as q1 q0).

Worked example: build |Φ+⟩ gate by gate

Follow the state after each of the two gates (qubit 0 written first).

∣00⟩→H on q0∣00⟩+∣10⟩2|00\rangle\xrightarrow{H\text{ on }q_0}\frac{|00\rangle+|10\rangle}{\sqrt{2}}
CX∣00⟩=∣00⟩CX∣10⟩=∣11⟩\begin{aligned}CX|00\rangle&=|00\rangle\\CX|10\rangle&=|11\rangle\end{aligned}
∣Φ+⟩=∣00⟩+∣11⟩2|\Phi^+\rangle=\frac{|00\rangle+|11\rangle}{\sqrt{2}}
from qiskit import QuantumCircuit
from qiskit.quantum_info import Statevector

qc = QuantumCircuit(2)
qc.h(0)
print(Statevector.from_instruction(qc).probabilities_dict(decimals=3))
# {'00': 0.5, '01': 0.5}   <- qubit 0 is the rightmost bit

qc.cx(0, 1)
print(Statevector.from_instruction(qc).probabilities_dict(decimals=3))
# {'00': 0.5, '11': 0.5}

Correlations

Measure one half of a Bell pair and look only at that side: it is a perfect coin flip, 0 or 1 with equal odds.

Compare both sides and a pattern appears: the results always agree. Two separate random bits would disagree half the time; the Bell pair never does.

Kub and Kip each measure one half of a Bell pair (|00⟩ + |11⟩)/√2. On its own, each result is a fair coin flip, yet the two results always match: only 00 and 11 ever appear.

Worked example: compare the possible results

P(00)=12P(01)=0P(10)=0P(11)=12P(00)=\frac{1}{2}\qquad P(01)=0\qquad P(10)=0\qquad P(11)=\frac{1}{2}
P(same)=P(00)+P(11)=1P(q0=0)=P(00)+P(01)=12P(\text{same})=P(00)+P(11)=1\qquad P(q_0=0)=P(00)+P(01)=\frac{1}{2}
›Check yourself: Two qubits are in (|01⟩ + |10⟩)/√2. What do their measurement results have in common?

They always disagree: one reads 0 and the other reads 1. Each side alone is still 50/50. This is another Bell state, |Ψ+⟩.

More Qubits, More Entanglement

The same recipe scales up. Putting one qubit in superposition and chaining CX gates from it creates the GHZ state (|000⟩ + |111⟩)/√2, in which all the qubits always agree.

Not all entanglement looks like GHZ. The W state (|001⟩ + |010⟩ + |100⟩)/√3 shares a single 1 among three qubits, and it stays partly entangled even if one qubit is lost.

Worked example: a three-qubit GHZ state

from qiskit import QuantumCircuit
from qiskit.quantum_info import Statevector

qc = QuantumCircuit(3)
qc.h(0)
qc.cx(0, 1)
qc.cx(1, 2)
print(Statevector.from_instruction(qc).probabilities_dict(decimals=3))
# {'000': 0.5, '111': 0.5}

Key Takeaways

  • A product state gives each qubit its own state; an entangled state cannot be split that way.
  • H then CX turns |00⟩ into the Bell state (|00⟩ + |11⟩)/√2.
  • Each half of a Bell pair looks random alone, yet the two results always agree.
  • Qiskit writes qubit 0 as the rightmost bit of every bitstring.

What To Practice

Practice preparing entangled states and using them as a resource.