Entanglement and Measurement¶
This guide covers multi-qubit systems, tensor products, quantum entanglement, the No-Cloning theorem, quantum teleportation, and tensor network scaling.
Tutorial Signposts: - Bell States & EPR Pairs: Tutorial 2: Bell States (GitHub) - Quantum Teleportation: Tutorial 5: Teleportation (GitHub) - Entanglement Swapping: Tutorial 12: Entanglement Swapping (GitHub) - Shot Sampling: Tutorial 13: Measurements and Shot Noise (GitHub) - Large Circuits: Tutorial 14: Large Circuits and Tensor Networks (GitHub)
1. Multi-Qubit Systems and Tensor Products¶
The state space of an \(N\)-qubit system is the tensor product of the individual 2-dimensional single-qubit Hilbert spaces:
The dimension of this space is \(2^N\). For a 2-qubit system, the four standard basis states are:
A general 2-qubit pure state is written:
with normalization \(\sum_{ij} |c_{ij}|^2 = 1\).
2. Product States vs Entangled States¶
A multi-qubit state is a product state (separable) if it can be written as a tensor product of single-qubit states:
If a state cannot be factored this way, the qubits are entangled. When two qubits are entangled, the individual subsystems do not possess well-defined states independent of the whole system.
The Four Bell States¶
The maximally entangled two-qubit states form the Bell basis:
The Bell basis is orthonormal: \(\langle\Phi^i|\Phi^j\rangle = \delta_{ij}\).
3. Preparing Bell States¶
Bell states are generated using a Hadamard gate followed by a Controlled-NOT (CNOT) gate:

1. Start in \(|00\rangle\):
2. Apply Hadamard on qubit 0:
3. Apply CNOT with qubit 0 controlling qubit 1:
Measuring either qubit yields \(0\) with probability \(1/2\) or \(1\) with probability \(1/2\). Once the first qubit is measured, the second qubit is guaranteed to match it.
4. The No-Cloning Theorem¶
A central theorem in quantum mechanics states that an unknown quantum state cannot be copied.
Mathematical Proof¶
Suppose a unitary operator \(U\) could clone any state \(|\psi\rangle\):
Now consider two distinct states \(|\psi\rangle\) and \(|\phi\rangle\):
Taking the inner product of both equations:
Because \(U\) is unitary (\(U^\dagger U = I\)):
This equation has only two solutions:
Therefore, a unitary cloner can only copy states that are identical or orthogonal. An arbitrary unknown state cannot be cloned.
5. Quantum Teleportation¶
Because cloning is impossible, transmitting quantum information requires moving the quantum state itself. The quantum teleportation protocol transfers an arbitrary state \(|\psi\rangle = \alpha |0\rangle + \beta |1\rangle\) from Alice to Bob using: 1. One shared Bell pair (\(|\Phi^+\rangle\)). 2. Two classical bits sent through a classical channel.
Circuit Overview¶

- Bell Measurement: Alice performs a CNOT between \(|\psi\rangle\) (wire 0) and her half of the Bell pair (wire 1), followed by a Hadamard on wire 0.
- Measurement: Alice measures wires 0 and 1, obtaining two classical bits \(m_0, m_1 \in \{0, 1\}\).
- Feedforward Correction: Bob applies \(X^{m_1}\) then \(Z^{m_0}\) to his qubit (wire 2). Bob's state becomes \(|\psi\rangle\).
Notice that the original state at qubit 0 is destroyed by measurement, fully respecting the No-Cloning theorem.
6. Implementation in quantum-emotion¶
from quantum_emotion import KetState, Hadamard, CNOT, Measure, PauliX, PauliZ
# Prepare 3-qubit register: wire 0 is target state, wires (1, 2) form Bell pair
psi0 = KetState(N=3)
# Entangle wires 1 and 2
bell = CNOT(wires=(1, 2)) @ Hadamard(wires=1) @ psi0
# Teleportation with mid-circuit measurement and classical feedforward
circuit = (
PauliZ(wires=2).c_if(0)
@ PauliX(wires=2).c_if(1)
@ Measure(wires=(0, 1))
@ Hadamard(wires=0)
@ CNOT(wires=(0, 1))
@ bell
)
# Evaluate Bob's density matrix on wire 2
rho_bob = circuit.eval_density_matrix(wires=2)
print("Bob reduced density matrix:\n", rho_bob)
7. Laboratory Measurement and Finite-Shot Noise¶
In idealized quantum circuit simulators, state vectors yield exact Born rule probabilities \(p_x = |\langle x|\psi\rangle|^2\). However, real quantum hardware cannot directly observe probability amplitudes. Physical quantum processors execute repeated experimental runs ("shots"), returning a discrete bitstring \(x \in \{0, 1\}^N\) on each shot.
Multinomial Sampling and Standard Error¶
When measuring \(N_{\text{shots}}\) independent copies of state \(|\psi\rangle\), the observed counts \(n_x\) follow a multinomial distribution:
The empirical probability \(\hat{p}_x = n_x / N_{\text{shots}}\) is an unbiased estimator of \(p_x\), with standard error:
To reconstruct expectation values \(\langle O \rangle = \sum_x \lambda_x p_x\) to within a target precision \(\epsilon\), the required number of shots scales as:
In quantum-emotion, finite-shot experiments are simulated using Measure(wires=...) followed by .sample(shots=...):
import numpy as np
from quantum_emotion import KetState, Hadamard, Measure
# Prepare |+> and measure
state = Measure(wires=0) @ Hadamard(wires=0) @ KetState(N=1)
samples = state.sample(shots=1000)
print("Counts:", {val: int(cnt) for val, cnt in zip(*np.unique(samples, return_counts=True))})
8. Scaling to Many Qubits¶
An \(N\)-qubit state vector has \(2^N\) amplitudes, so calling .eval() becomes infeasible past ~25–30 qubits. quantum-emotion avoids materializing that vector when you compute expectation values (\(\langle \psi | O | \psi \rangle\)) or small reduced density matrices (\(\rho_A = \text{Tr}_B(|\psi\rangle\langle\psi|)\)) by contracting the circuit as a tensor network via cotengra.
For the memory scaling breakdown, area-law vs volume-law entanglement, and practical limits on classical simulation, see Simulation Boundaries.