Skip to content
Tech Interview Prep
Technical interview guide

Entanglement & Measurement

How entangled qubits produce correlations with no classical analog, why measurement is irreversible, and the no-cloning theorem's practical implications.

Minutes to read
4
Practice MCQs
25
Interview Q&A
25
Edition
v3
Editorial status
Reviewed

Scope: IBM Quantum learning and Qiskit current documentation; Bell and CHSH primary literature reviewed 2026-09-04.

Interview Q&A

Treat each question like a live interview question: answer out loud first (structure, assumptions, tradeoffs), then open the model answer to spot gaps and rehearse a tighter follow-up.

Curated: · Written: · Reviewed:

25 questions

Q&A-6

How does the Born rule predict measurement outcome probabilities for mixed states using density matrices, and how does this generalize projective measurements?

Answer

Core answer. Outcome probabilities are linear in the density matrix: $p(m) = \operatorname{Tr}(E_m \rho)$, where the $E_m$ are positive semidefinite and $\sum_m E_m = I$. For a projective measurement $E_m = \Pi_m$ with $\Pi_m^2 = \Pi_m = \Pi_m^\dagger$, and for a pure state $\rho = |\psi\rangle\langle\psi|$ this reduces to the textbook $|\langle m|\psi\rangle|^2$. The trace form is what makes the rule work for mixed states; the POVM form is what makes it work for non-projective apparatuses.

Why the trace. Write the preparation as an ensemble $\rho = \sum_i p_i |\psi_i\rangle\langle\psi_i|$. Outcome $m$ is obtained on branch $i$ with probability $\langle\psi_i|\Pi_m|\psi_i\rangle$, so

$$p(m) = \sum_i p_i \langle\psi_i|\Pi_m|\psi_i\rangle = \sum_i p_i \operatorname{Tr}(\Pi_m |\psi_i\rangle\langle\psi_i|) = \operatorname{Tr}!\Big(\Pi_m \sum_i p_i |\psi_i\rangle\langle\psi_i|\Big) = \operatorname{Tr}(\Pi_m \rho).$$

The operational content is that the ensemble decomposition of $\rho$ is not unique, yet $\operatorname{Tr}(E_m \rho)$ depends only on $\rho$: two preparations with the same density matrix are indistinguishable by any measurement. That is the statement the trace rule encodes.

Generalizing to POVMs. Neumark's dilation theorem says any POVM on $\mathcal{H}$ is a projective measurement on $\mathcal{H} \otimes \mathcal{H}_{\text{anc}}$, with $E_m = M_m^\dagger M_m$ obtained by tracing out the ancilla. Idempotence and orthogonality are lost; positivity and completeness survive. Because the $E_m$ need not be orthogonal, the number of outcomes can exceed $\dim \mathcal{H}$.

Worked trace: same populations, different statistics. Take $\rho = \tfrac{3}{4}|0\rangle\langle 0| + \tfrac{1}{4}|1\rangle\langle 1|$ (fully dephased) and measure in the Hadamard basis, $\Pi_+ = \tfrac{1}{2}\begin{pmatrix}1&1\1&1\end{pmatrix}$:

$$\rho,\Pi_+ = \begin{pmatrix}3/4&0\0&1/4\end{pmatrix}\begin{pmatrix}1/2&1/2\1/2&1/2\end{pmatrix} = \begin{pmatrix}3/8&3/8\1/8&1/8\end{pmatrix}, \qquad p(+) = \operatorname{Tr}(\rho,\Pi_+) = \tfrac{3}{8}+\tfrac{1}{8} = \tfrac{1}{2}.$$

Now the coherent state with the same diagonal, $|\psi\rangle = \tfrac{\sqrt{3}}{2}|0\rangle + \tfrac{1}{2}|1\rangle$: $p(+) = |\langle +|\psi\rangle|^2 = \tfrac{1}{2}\big(\tfrac{\sqrt{3}+1}{2}\big)^2 = \tfrac{2+\sqrt{3}}{4} \approx 0.933$, and $p(-) = \tfrac{2-\sqrt{3}}{4} \approx 0.067$. Identical populations, $0.5$ versus $0.933$: the off-diagonal coherences are the whole difference, and only the trace formula sees them.

A POVM with more outcomes than dimensions. On a qubit take $E_m = \tfrac{2}{3}|\psi_m\rangle\langle\psi_m|$ for $|\psi_m\rangle$ at angles $\theta_m = 0, 2\pi/3, 4\pi/3$. Since $\sum_m |\psi_m\rangle\langle\psi_m| = \tfrac{3}{2}I$, completeness holds. For $\rho = |0\rangle\langle 0|$, $p_m = \tfrac{2}{3}\cos^2\theta_m = \tfrac{2}{3}, \tfrac{1}{6}, \tfrac{1}{6}$, summing to 1 with three outcomes on a two-dimensional space. Note $E_m^2 = \tfrac{4}{9}|\psi_m\rangle\langle\psi_m| \neq E_m$: these are not projectors.

ProjectivePOVM
Operators$\Pi_m^2 = \Pi_m = \Pi_m^\dagger$$E_m \ge 0$, generally $E_m^2 \neq E_m$
Completeness$\sum_m \Pi_m = I$$\sum_m E_m = I$
Outcomes$\le \dim\mathcal{H}$can exceed $\dim\mathcal{H}$
Post-measurement state$\Pi_m \rho \Pi_m / \operatorname{Tr}(\Pi_m\rho)$$M_m \rho M_m^\dagger / \operatorname{Tr}(E_m\rho)$, needs the Kraus operators

Failure modes.

  • Reading the update off $E_m$. $E_m$ fixes probabilities only. With $E_1 = E_2 = I/2$, both $M_1 = M_2 = I/\sqrt{2}$ and $M_1 = X/\sqrt{2},, M_2 = I/\sqrt{2}$ give the same POVM, but the first leaves $\rho$ intact after outcome 1 and the second applies $X\rho X$. Same statistics, different state.
  • Forcing projectors onto a POVM task. Unambiguous discrimination of two non-orthogonal states needs three outcomes; with two orthogonal projectors the inconclusive branch is forced to guess, and the error rate is nonzero where the POVM achieves zero.
  • Trace drift. Truncating a channel or dropping a Kraus operator leaves $\operatorname{Tr}(\rho) \neq 1$, and $\sum_m p(m) \neq 1$ follows. Check the trace after every non-unitary step.
  • Bloch-vector sanity check. With $\rho = (I + \mathbf{r}\cdot\boldsymbol{\sigma})/2$, $p(m) = \tfrac{1}{2}\operatorname{Tr}(E_m) + \tfrac{1}{2}\mathbf{r}\cdot\operatorname{Tr}(\boldsymbol{\sigma} E_m)$ is affine in $\mathbf{r}$. If a simulator returns probabilities nonlinear in the Bloch vector, the measurement operators are wrong.

Curated: · Written: · Reviewed:

Difficulty: Medium
Q&A-7

How do you calculate the post-measurement collapsed state of a subsystem after performing a partial measurement on an entangled bipartite system?

Answer

To determine the post-measurement state of subsystem $B$ when subsystem $A$ is measured on an entangled bipartite state $\rho_{AB}$, apply the projection or measurement operator acting locally on system $A$, take the partial trace over $A$, and normalize by the outcome probability.

1. Mathematical Formulation

For a general measurement on subsystem $A$ described by measurement operators ${M_m}$ satisfying $\sum_m M_m^\dagger M_m = I_A$:

  1. Outcome Probability: By the Born rule, the probability of obtaining outcome $m$ is: $$p(m) = \text{Tr}\left((M_m^\dagger M_m \otimes I_B) \rho_{AB}\right) = \text{Tr}\left(M_m^\dagger M_m \rho_A\right)$$ where $\rho_A = \text{Tr}B(\rho{AB})$.

  2. Joint Collapsed State: If outcome $m$ is registered, the joint post-measurement state is: $$\rho_{AB|m} = \frac{(M_m \otimes I_B) \rho_{AB} (M_m^\dagger \otimes I_B)}{p(m)}$$

  3. Subsystem $B$'s State: The conditional state of subsystem $B$ is the partial trace over system $A$: $$\rho_{B|m} = \text{Tr}A(\rho{AB|m}) = \frac{\text{Tr}A\left((M_m \otimes I_B) \rho{AB} (M_m^\dagger \otimes I_B)\right)}{p(m)}$$

For an initial pure state $|\psi_{AB}\rangle = \sum_i c_i |a_i\rangle_A |b_i\rangle_B$ and an orthogonal projective measurement onto $|\phi\rangle_A$ (where $\Pi = |\phi\rangle\langle\phi| \otimes I_B$): $$|\psi_{B|\phi}\rangle = \frac{\langle \phi |A \psi{AB}\rangle}{\sqrt{p(\phi)}}, \quad p(\phi) = | \langle \phi |A \psi{AB}\rangle |^2$$

2. Concrete Trace: Bell State Partial Measurement

Consider the singlet state $|\Psi^-\rangle = \frac{1}{\sqrt{2}}(|01\rangle - |10\rangle)$. Subsystem $A$ is measured in the Hadamard basis ${|+\rangle, |-\rangle}$.

Express $|\Psi^-\rangle$ in the basis of subsystem $A$:

  • $|0\rangle = \frac{1}{\sqrt{2}}(|+\rangle + |-\rangle)$
  • $|1\rangle = \frac{1}{\sqrt{2}}(|+\rangle - |-\rangle)$

Substituting into $|\Psi^-\rangle$: $$|\Psi^-\rangle = \frac{1}{\sqrt{2}}\left(\frac{|+\rangle + |-\rangle}{\sqrt{2}} \otimes |1\rangle - \frac{|+\rangle - |-\rangle}{\sqrt{2}} \otimes |0\rangle\right) = \frac{1}{2}|+\rangle(|1\rangle - |0\rangle) + \frac{1}{2}|-\rangle(|1\rangle + |0\rangle)$$ $$= -\frac{1}{\sqrt{2}} |+\rangle |-\rangle + \frac{1}{\sqrt{2}} |-\rangle |+\rangle$$

  • Outcome $|+\rangle_A$: $p(+) = |-\frac{1}{\sqrt{2}}|^2 = \frac{1}{2}$. Collapsed state of $B$: $|\psi_{B|+}\rangle = -|-\rangle$ (density matrix $|-\rangle\langle-|$).
  • Outcome $|-\rangle_A$: $p(-) = |\frac{1}{\sqrt{2}}|^2 = \frac{1}{2}$. Collapsed state of $B$: $|\psi_{B|-}\rangle = |+\rangle$ (density matrix $|+\rangle\langle+|$).

Notice that if the measurement outcome on $A$ is discarded (unselective measurement), the state of $B$ is the classical mixture: $$\rho_B = p(+) |-\rangle\langle-| + p(-) |+\rangle\langle+| = \frac{1}{2}|-\rangle\langle-| + \frac{1}{2}|+\rangle\langle+| = \frac{1}{2} I_2$$ This matches $\text{Tr}_A(|\Psi^-\rangle\langle\Psi^-|)$, verifying no-signaling.

3. Verification with Qiskit

Python
import numpy as np
from qiskit.quantum_info import Statevector, DensityMatrix, partial_trace

# Bell singlet state: (|01> - |10>) / sqrt(2)
# Note: Qiskit tensor convention is q1 (B) ⊗ q0 (A)
psi = Statevector([0, 1 / np.sqrt(2), -1 / np.sqrt(2), 0])

# Projector on qubit 0 (A) onto |+>
plus = np.array([1, 1]) / np.sqrt(2)
Pi_A = np.outer(plus, plus.conj())
I_B = np.eye(2)
# Joint operator: I_B ⊗ Pi_A
M_plus = np.kron(I_B, Pi_A)

# Conditional unnormalized state
rho_joint = DensityMatrix(psi)
rho_post = DensityMatrix(M_plus @ rho_joint.data @ M_plus.T.conj())
p_plus = np.trace(rho_post.data).real
rho_post_normalized = rho_post / p_plus

# Trace out qubit 0 (system A) to obtain subsystem B (qubit 1)
rho_B_cond = partial_trace(rho_post_normalized, [0])
print("Outcome prob:", p_plus)          # 0.5
print("rho_B:", np.round(rho_B_cond.data, 4))
# [[0.5, -0.5], [-0.5, 0.5]] -> |-><-|

4. Implementation Pitfalls

Failure ModeMechanismOperational Detection
Forgetting Born normalizationDividing by 1 instead of $p(m)$ leaves $\text{Tr}(\rho_{Bm}) \neq 1$.
Tensor ordering transpositionReversing endianness (Qiskit $q_1 \otimes q_0$ vs math $A \otimes B$) applies $M_m$ to $B$ instead of $A$.Off-diagonal coherences inverted or wrong target entropy.
Discarding outcomes vs post-selectionTreating $\text{Tr}A(\rho{AB})$ as conditional collapse, ignoring measurement record $m$.$\rho_B$ is maximally mixed rather than pure.

Curated: · Written: · Reviewed:

Difficulty: Medium
Q&A-4

Design and validate an entanglement or measurement workflow for reduced states.

Answer

What I'd say first

Assume the input is a pure 2-qubit statevector and the question is which qubit I keep. For the Bell state |Φ+> = (|00>+|11>)/√2, the reduced state of qubit A is I/2: maximally mixed, purity Tr(ρ_A²) = 1/2, entanglement entropy 1 bit, while the global state is pure, purity 1. That gap is the point. Local mixedness here is not noise; it is the entanglement I traced away.

Mechanism

The partial trace is ρ_A[i,k] = Σ_j ρ[(i,j),(k,j)]. It is the unique operator reproducing every local measurement statistic, Tr(ρ_A M_A) = Tr(ρ (M_A ⊗ I_B)), which is why it is the reduced state and not a heuristic. NumPy 1.26:

Python
import numpy as np
psi = np.array([1,0,0,1])/np.sqrt(2)
rho = np.outer(psi, psi.conj())                          # 4x4
rho_A = np.trace(rho.reshape(2,2,2,2), axis1=1, axis2=3) # trace out B
np.round(rho_A, 3)          # [[0.5, 0. ], [0. , 0.5]]
np.trace(rho_A)             # 1.0
np.trace(rho_A @ rho_A)     # 0.5

The reshape(2,2,2,2) is where the subsystem dimensions live: axes (i,j,k,l) map to row 2i+j, column 2k+l, and tracing axis1=1 against axis2=3 sums j=l. Qiskit 1.x gives the same: partial_trace(Statevector([1,0,0,1]/np.sqrt(2)), qargs=[1]).purity() → 0.5.

Alternatives and when to use them

  • Full partial trace: exact, but needs the whole 4^n density matrix. At n=20 that is 2^40 entries: infeasible. Use it for small n or simulation.
  • Tomography / sampling: measure A in three bases and estimate ρ_A from shots. Cost is N shots with statistical error ~1/√N, so 10^4 shots gives roughly 1% per element. Use it on hardware where you never hold the global state.
  • Slicing rho[0::2, 0::2]: correct only when B sits in |0> or the state is a product. For |Ψ+> = (|01>+|10>)/√2 it returns the zero matrix, not I/2.

Failure modes and detection

  • Slicing instead of trace: assert np.trace(rho_A) == 1 catches the zero matrix immediately.
  • Subsystem index inversion: partial_trace(sv, qargs=[0]) versus [1]. Symmetric Bell states hide it because both reductions are I/2. Test with an asymmetric state, (|00>+|01>)/√2, where ρ_A = |0><0| and ρ_B = I/2: the two must differ.
  • Calling a mixed reduced state "noise": purity 0.5 with a pure global state is entanglement, not decoherence. Check global purity first.
  • Copying global purity locally: assert purity(ρ_A) ≤ 1, and equals 1 only for product states.

Validate with three checks: trace = 1, 0 ≤ purity ≤ 1, and a product-state control whose purity must be exactly 1.

Curated: · Written: · Reviewed:

Difficulty: Medium
Q&A-5

Design and validate an entanglement or measurement workflow for Schmidt decomposition.

Answer

Assume a pure bipartite state |ψ⟩ in H_A ⊗ H_B, with dims d_A, d_B and a fixed bipartition. The workflow is: build the state vector in a fixed basis order (A slow, B fast), reshape to a d_A × d_B matrix M, compute the SVD M = U Σ V†, read Schmidt coefficients λ_i = Σ_ii, then validate normalization, rank, entropy, and the reduced state. For a measurement workflow, apply U† and V† to rotate into the Schmidt basis before measuring.

Python
import numpy as np
# |ψ⟩ = (|00⟩ + |01⟩ + |11⟩)/√3
psi = np.array([1, 1, 0, 1], dtype=complex) / np.sqrt(3)
M = psi.reshape(2, 2)  # A slow, B fast
U, s, Vh = np.linalg.svd(M, full_matrices=False)
print(np.round(s, 6))              # [0.934172 0.356822]
print(np.round(np.sum(s**2), 6))   # 1.0
p = s**2
S = -np.sum(p * np.log2(p))
print(np.round(S, 3))              # 0.55

Checked against Python 3.12, NumPy 2.0. The trace: M = [[1,1],[0,1]]/√3. M†M = [[1,1],[1,2]]/3, eigenvalues (3 ± √5)/6 = 0.872678, 0.127322. Singular values are their square roots: 0.934172, 0.356822. Sum of squares is 1.0. Entropy is 0.550 bits. The reduced state ρ_A = M M† has the same eigenvalues, so the check is exact.

Validation checks and failure modes:

failuresymptomdetection
wrong reshapesingular values change when dims are swappedassert M.shape == (d_A, d_B); check sum(s**2) == 1
near-zero singular valuesrank too high, entropy noisytol = s[0] * max(M.shape) * np.finfo(float).eps; drop s_i < tol
mixed-state misuseSVD of ρ gives wrong entanglementcheck ρ² ≠ ρ; use eigenvalues of ρ_A instead
degeneracySchmidt bases non-uniquegaps in s below tol; fix a deterministic tie-break
partition ambiguitywrong bipartitionstate d_A, d_B explicitly; error if mismatch

Why these fail: a wrong reshape is a basis-order error. If d_A ≠ d_B, reshaping to (d_B, d_A) is not a transpose and changes the singular values. Near-zero singular values are numerical noise from LAPACK; without a tolerance, rank and entropy jump. Schmidt decomposition is only for pure states. For a mixed state ρ, the SVD of ρ is not the Schmidt decomposition; you must use the eigenvalues of ρ_A = Tr_B ρ. Degeneracy means repeated λ_i; SVD may return any orthonormal basis inside that subspace, so a measurement outcome can depend on the library's arbitrary choice. Partition ambiguity means the same state vector has different Schmidt coefficients under a different A/B split.

Alternatives and trade-offs. SVD on M costs O(d_A d_B min(d_A, d_B)) and is backward stable; it gives both Schmidt bases directly. Eigendecomposition of ρ_A = M M† costs O(d_A³) and is cheaper when d_A ≪ d_B, but it squares the condition number and loses V. Recover V from M† U / s only when s_i > tol. For a 2 × 1000 system, eigh on the 2 × 2 ρ_A is trivial; for a 1000 × 1000 system, SVD is the right default. If you only need entanglement entropy, compute it from s and skip the bases.

For a measurement workflow, after SVD, apply U† to A and V† to B. Then a computational-basis measurement on both sides samples the Schmidt coefficients. Validate by repeating the rotation and checking that the off-diagonal terms of the rotated state are below tol. If the state is mixed, purify first or measure ρ_A directly; do not feed ρ into SVD and call the singular values Schmidt coefficients.

Curated: · Written: · Reviewed:

Difficulty: Medium
Q&A-2

Design and validate an entanglement or measurement workflow for Bell states.

Answer

Bell-state validation is a three-basis correlation test, not a single fidelity number. Prepare the state, measure ZZ, XX and YY, and check the three expectation values against a sign table. The signs identify which of the four Bell states you built; the magnitudes tell you how much noise you have. I'll assume a two-qubit device, Qiskit 1.x, and that the goal is to distinguish all four Bell states, not merely to detect entanglement.

Workflow

  1. Prepare. H on q0, then CX(0,1) gives |Φ+> = (|00>+|11>)/√2. Apply X on q0 for |Ψ+>, Z on q0 for |Φ−>, X then Z for |Ψ−>.
  2. Measure in three bases. Z: measure directly. X: H on both qubits before measuring. Y: S† then H on both. H S† maps Y eigenstates onto Z eigenstates.
  3. Reduce each basis to one number: E = P(00) + P(11) − P(01) − P(10).
  4. Compare to the table.
state⟨ZZ⟩⟨XX⟩⟨YY⟩
|Φ+⟩+1+1−1
|Φ−⟩+1−1+1
|Ψ+⟩−1+1+1
|Ψ−⟩−1−1−1

The three signs are a unique fingerprint: no two rows agree, so three correlators name the state. The same numbers give fidelity to a target: F(|Φ+>) = (1 + ⟨ZZ⟩ + ⟨XX⟩ − ⟨YY⟩)/4.

Code (Qiskit 1.x, exact statevector):

Python
from qiskit import QuantumCircuit
from qiskit.quantum_info import Statevector, SparsePauliOp

def bell(kind):
    qc = QuantumCircuit(2)
    qc.h(0); qc.cx(0, 1)
    if kind == "phi_minus": qc.z(0)
    elif kind == "psi_plus": qc.x(0)
    elif kind == "psi_minus": qc.x(0); qc.z(0)
    return qc

for kind in ["phi_plus", "phi_minus", "psi_plus", "psi_minus"]:
    sv = Statevector(bell(kind))
    print(kind, [round(sv.expectation_value(SparsePauliOp(p)).real, 6)
                 for p in ["ZZ", "XX", "YY"]])

Output:

phi_plus  [1.0, 1.0, -1.0]
phi_minus [1.0, -1.0, 1.0]
psi_plus  [-1.0, 1.0, 1.0]
psi_minus [-1.0, -1.0, -1.0]

Gates. With N shots per basis the correlator's 1σ statistical error is 1/√N: 0.0156 at N = 4096. Require each |E| ≥ 0.9 (≈6σ below 1.0) and the sign pattern to match exactly one row. Then run CHSH: with A0 = Z, A1 = X, B0 = (Z+X)/√2, B1 = (Z−X)/√2, S = E(A0B0) + E(A0B1) + E(A1B0) − E(A1B1). For any Bell state |S| = 2√2 ≈ 2.828 against a classical bound of 2; gate at |S| ≥ 2.5.

Failure modes and detection

  • Bit order. Qiskit is little-endian: qubit 0 is the rightmost character of the bitstring. Detect by applying X to qubit 0 and checking the bitstring is "01", not "10".
  • Sign lost. Z-basis alone gives 50/50 |00>/|11> for both |Φ+> and |Φ−>. Detect with XX: +1 vs −1.
  • Control/target reversal. H on q0 then CX(1,0) leaves |+0>, a product state, so ⟨XX⟩ = 0 instead of +1. Detect with the XX correlator.
  • Single-basis validation. ⟨ZZ⟩ = +1 also holds for a classical 50/50 mixture of |00> and |11>, which has ⟨XX⟩ = ⟨YY⟩ = 0. Detect by requiring all three.
  • Basis-rotation error. Forgetting S† before H turns the Y measurement into an X measurement, so ⟨YY⟩ = ⟨XX⟩. Detect by comparing the two.
  • Global vs relative phase. A global phase is unobservable; a relative phase between |00> and |11> is physical and moves the XX/YY signs. The sign table catches it.

Trade-off. Full two-qubit state tomography uses 9 measurement settings and reconstructs ρ, so it also exposes coherent errors the three correlators average away: at roughly 3× the shots plus a reconstruction step. Three-basis correlators plus CHSH are 3 settings, need no reconstruction, and are enough to name the state and bound its fidelity. Reach for tomography when you need the error channel, not when you need to know which Bell state you have.

Curated: · Written: · Reviewed:

Difficulty: Medium
Q&A-12

Design and validate an entanglement or measurement workflow for joint versus marginal.

Answer

Core answer (first 90 seconds)

"Joint versus marginal" is a question about which statistics you are allowed to use. The marginals are the single-party outcome distributions P(a|x) and P(b|y). The joint statistics are the coincidence distributions P(a,b|x,y) across both parties for each pair of settings. If the question is whether a state is entangled, marginals are provably useless: for any state ρ_AB, the product state ρ_A ⊗ ρ_B has exactly the same marginals and is separable. So a workflow that only measures marginals can never certify entanglement, and any claim built on marginals alone is a false positive waiting to happen.

The workflow I would design: measure joint correlators, compare against a separable bound, and use the marginals as a negative control.

Assumptions: two qubits; each party chooses between two ±1-valued observables (A1, A2 on Alice; B1, B2 on Bob); we can collect coincidence counts.

Mechanism

CHSH: S = E(A1B1) + E(A1B2) + E(A2B1) − E(A2B2), with E(A_iB_j) = P(a=b) − P(a≠b) from coincidence counts. For any separable state S ≤ 2. For |Φ+⟩ with optimal settings S = 2√2 ≈ 2.828. The gap of 0.828 is the entire signal.

Estimator: E = (N_same − N_diff)/N. For binomial counts, σ_E ≈ sqrt((1 − E²)/N); σ_S = sqrt(Σ σ_E²) when the four settings are independent runs.

Artefacts

steppassfail
joint vs marginalJoint correlators measured; marginals reported as controlOnly marginals measured
settingsAll four (A1B1, A1B2, A2B1, A2B2) presentOne basis only
boundSeparable bound 2 applied2√2 used as the separable bound
uncertaintyS − 2 > 5σPoint estimate only

Arithmetic: with N = 10,000 coincidences per setting on |Φ+⟩, each E ≈ 0.707, so σ_E ≈ sqrt((1 − 0.5)/10000) ≈ 0.0071 and σ_S ≈ 0.014. S = 2.828 ± 0.014, i.e. S − 2 ≈ 59σ. On the separable state |00⟩ with the same settings, S ≈ 2 ± 0.014: consistent with the bound. The marginals from the same data are I/2 on both qubits for |Φ+⟩ and for the maximally mixed state, so they cannot separate the two: that is the negative control.

Python
import numpy as np

def correlator(same, diff):
    n = same + diff
    E = (same - diff) / n
    return E, np.sqrt((1 - E**2) / n)   # binomial sigma

E, s = correlator(8535, 1465)           # |Phi+>, optimal angles
print(E, s)                             # 0.707 0.0071

Alternatives and when not to use

  • Full tomography: 3^n − 1 = 15 Pauli settings for two qubits, gives concurrence or negativity, but scales as 3^n. Use when you need the state, not a yes/no.
  • Witness: W = ½I − |Φ+⟩⟨Φ+|; Tr(Wρ) < 0 certifies entanglement, and only Bell-basis populations are needed. Cheaper, but state-specific: a witness tuned to |Φ+⟩ will not fire on |Ψ−⟩.
  • Bell test: device-independent, but needs loophole-free conditions; CHSH requires detection efficiency above 2√2 − 2 ≈ 82.8%. Use only when you distrust the devices.

Do not use CHSH for multipartite states (use Mermin or Svetlichny), or when you only need fidelity to a known target: a few Pauli expectations suffice.

Failure modes and how to detect them

  • One-basis claim: only ZZ measured. Detect by checking all four correlator terms are present; a single basis leaves S undefined. Cost: false negative.
  • Post-selection: discarding runs where a detector did not fire. Detect by recomputing S over all runs; if S drops below 2, the claim was post-selection. This is the detection loophole.
  • Estimator sign: E(A2B2) enters with a minus sign. Detect by recomputing from the CHSH definition; a sign flip moves S by 2E ≈ 1.4.
  • Bound mismatch: using 2√2 as the separable bound. Detect by verifying the bound matches the state class: 2 for separable, 2√2 is the quantum maximum.
  • Uncertainty omitted: reporting S = 2.1 with no error bar. Detect by requiring S − 2 > 5σ; at N = 10,000 that means σ_S < 0.166.

Curated: · Written: · Reviewed:

Difficulty: Medium
Q&A-1

Design and validate an entanglement or measurement workflow for separability.

Answer

Clarify and answer first. I'd fix the setting before touching math: a bipartite state ρ on C^dA ⊗ C^dB, handed over as a (dA·dB)×(dA·dB) matrix from state tomography or a simulator, with the cut named, which factor is A, which is B, and the index convention (row-major, A slowest). Separability means ρ = Σ pᵢ ρᵢ^A ⊗ ρᵢ^B, a convex mixture of product states. Exact separability is NP-hard for mixed states (Gurvits, 2003), so the workflow is a hierarchy: exact for pure states, PPT plus witnesses for mixed, each with a stated tolerance.

The workflow.

  1. Validate the input. Assert Hermitian (‖ρ − ρ†‖ < 1e-10), trace 1, and PSD: min eigenvalue ≥ −ε_psd. Set ε_psd from the reconstruction: for tomography with statistical error σ, ε_psd ≈ 5σ; for a simulator, 1e-10.
  2. Pure branch. If rank(ρ) = 1, take the eigenvector, reshape its coefficients to a dA×dB matrix C, and SVD it. Schmidt rank = #{σᵢ > ε}; separable iff rank 1. This is exact, no tolerance judgement beyond ε.
  3. Mixed branch. Partial-transpose over B and check min eigenvalue ≥ −ε. PPT is necessary for separability and sufficient for 2⊗2 and 2⊗3 (Peres–Horodecki). Above that, PPT-entangled (bound-entangled) states exist, so a PPT result is inconclusive and you escalate to an entanglement witness or the symmetric-extension SDP.
Python
import numpy as np

def partial_transpose_b(rho, dA, dB):
    r = rho.reshape(dA, dB, dA, dB)
    return r.transpose(0, 3, 2, 1).reshape(dA*dB, dA*dB)

def ppt_min_eig(rho, dA, dB):
    return np.linalg.eigvalsh(partial_transpose_b(rho, dA, dB)).min()

Trace on the Bell state |Φ⁺⟩ = (|00⟩+|11⟩)/√2, ρ = 0.5·[[1,0,0,1],[0,0,0,0],[0,0,0,0],[1,0,0,1]]. reshape gives r[0,0,0,0] = r[0,0,1,1] = r[1,1,0,0] = r[1,1,1,1] = 0.5. transpose(0,3,2,1) moves r[0,0,1,1] to [0,1,1,0] and r[1,1,0,0] to [1,0,0,1]; reshape puts those at M[1,2] and M[2,1]. eigvalsh returns [−0.5, 0.5, 0.5, 0.5], min = −0.5 < 0 → entangled. Negativity = (‖ρ^{T_B}‖₁ − 1)/2 = 0.5.

Validating the workflow itself. Run it on a family with a known answer: the Werner state ρ_W = p|Φ⁺⟩⟨Φ⁺| + (1−p)I/4. Its partial transpose has eigenvalues (1+p)/4 three times and (1−3p)/4 once, so the PPT threshold is p = 1/3, and for 2⊗2 that is the exact separability threshold. Sweep p in 0.01 steps and confirm the sign flip lands at 0.33 ± 0.01. Then feed it diag(1/2,0,0,1/2): perfectly correlated outcomes in the computational basis, yet separable, and it passes with min eig = 0.

Trade-offs.

testcostwhat it decides
PPTone eigendecomposition, O(d³)necessary always; exact for 2⊗2, 2⊗3
witnessO(1) measurement settingscertifies entanglement if Tr(Wρ) < 0; a positive value is inconclusive
tomography + SDP~d⁴ measurements, SDPexact in the limit, expensive

Failure modes and how each is caught.

  • Wrong cut. The same ρ can be separable across AB|C and entangled across A|BC: e.g. |Φ⁺⟩_AB ⊗ |0⟩_C. Detect: assert dA·dB == rho.shape[0] and log the cut with the result.
  • Tensor order wrong. Partial-transposing the wrong factor gives the wrong spectrum. Detect: the Bell-state unit test must return −0.5; anything else means the reshape/transpose convention is off.
  • Rank threshold. ε too large declares separable states entangled. Detect: set ε = max(1e-10, 5σ) from the PSD floor and tomography error, and report the margin |min eig|/ε.
  • Correlation substituted for factorization. Classical correlation is not entanglement; the diagonal state above is the regression test.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-15

Design and validate an entanglement or measurement workflow for CHSH bound.

Answer

Core answer (first 90 seconds). A CHSH workflow has four moving parts: prepare an entangled pair, choose two measurement bases per side, collect coincidence counts for all four setting pairs, and turn those counts into S with an error bar. What you validate is that |S| clears the classical bound 2 by enough standard deviations that no local-hidden-variable model fits the data. Concretely: prepare |Φ+⟩ = (|00⟩ + |11⟩)/√2, put Alice's bases at 0° and 90° and Bob's at 45° and −45° in the same equatorial plane, randomize the setting per shot, and accumulate counts. Then S = E(A0B0) + E(A0B1) + E(A1B0) − E(A1B1), where each E is (agree − disagree)/(agree + disagree) with outcomes encoded ±1.

Why 2 and why 2√2. In a local hidden-variable model each outcome is a function of the setting and a shared λ, so S = ⟨A0(B0+B1) + A1(B0−B1)⟩. Since B0, B1 ∈ {±1}, one of (B0+B1), (B0−B1) is 0 and the other is ±2, giving |S| ≤ 2. Quantum mechanically the operators commute within a party but not across parties, and the maximum over all states and measurements is 2√2 (Tsirelson), reached by |Φ+⟩ at the angles above: E(A0B0)=cos(0°−45°)=0.707, E(A0B1)=cos(0°−(−45°))=0.707, E(A1B0)=cos(90°−45°)=0.707, E(A1B1)=cos(90°−(−45°))=cos 135°=−0.707, so S=2√2. So 2√2 is a supremum, not a guaranteed value: a real run lands below it, and reporting it as the expected result is a bug.

The workflow, as code.

Python
import numpy as np

# counts[(a_setting, b_setting)] = (n_agree, n_disagree)
counts = {
    (0, 0): (853, 147),
    (0, 1): (853, 147),
    (1, 0): (853, 147),
    (1, 1): (147, 853),
}

def correlator(agree, disagree):
    n = agree + disagree
    return (agree - disagree) / n

E = {k: correlator(*v) for k, v in counts.items()}
S = E[(0,0)] + E[(0,1)] + E[(1,0)] - E[(1,1)]

N = 1000  # shots per setting pair
sigma_S = 2 / np.sqrt(N)  # conservative: worst-case per-correlator std 1/sqrt(N)
print(f"S = {S:.3f} +/- {sigma_S:.3f}")
print(f"margin over classical bound 2: {(S - 2)/sigma_S:.1f} sigma")

Worked trace. The four correlators evaluate to E(A0B0)=0.706, E(A0B1)=0.706, E(A1B0)=0.706, E(A1B1)=−0.706. Then S = 0.706 + 0.706 + 0.706 − (−0.706) = 2.824. With N=1000 per pair the conservative σ_S = 2/√1000 = 0.063, so the margin over 2 is 0.824/0.063 = 13.0σ. Output: S = 2.824 +/- 0.063, margin over classical bound 2: 13.0 sigma. To reach 5σ you need N ≥ (2·5/0.828)² ≈ 146 shots per setting pair, since the gap to close is 2√2 − 2 = 0.828.

Validation beyond the error bar. Two loopholes decide whether the violation is real. Detection: with efficiency η the bound degrades, and CHSH needs η > 2(√2 − 1) ≈ 0.828 to close the detection loophole. Measure η and report it. Locality: settings must be chosen without any signal reaching the other party, so timestamp the random setting generation against the coincidence window. Interleave a calibration run to catch basis drift, and unit-test the correlator on a perfect-correlation dataset (all agree → E = 1) to catch sign and encoding errors before they reach S.

Trade-offs. Optimal angles give the full 2√2 but are sensitive to misalignment; a few degrees off costs margin you may not have at low N. More shots tighten σ_S as 1/√N but lengthen the run and expose you to drift: the deciding criterion is the target significance, not the shot count. And compare |S| to 2, not S: a sign flip in one correlator turns a violation into a null result.

Failure modes and how you catch them. Mixing formula variants (e.g. a plus where the minus belongs): caught by the perfect-correlation unit test. Encoding outcomes as 0/1 instead of ±1: caught by asserting E ∈ [−1, 1] and that a fully anti-correlated pair gives E = −1. Omitting the absolute value: caught by asserting the comparison uses |S|. Calling 2√2 guaranteed: caught by requiring every reported S to carry an error bar and be compared to 2.

Curated: · Written: · Reviewed:

Difficulty: Medium
Q&A-14

Design and validate an entanglement or measurement workflow for Bell theorem.

Answer

A Bell test is a pre-registered experiment, not an analysis you run after the fact. Fix the inequality, the settings, the event selection and the statistical test before you take data, then report the violation with a p-value and an explicit list of which loopholes you closed.

Use CHSH. Two stations, Alice and Bob, each with two settings (a, a') and (b, b'). Each trial yields a ±1 outcome at each station. Define the correlation E(x,y) = (N_same − N_diff)/N for setting pair (x,y), and

S = E(a,b) − E(a,b') + E(a',b) + E(a',b').

Any local hidden-variable model satisfying the test's assumptions gives |S| ≤ 2. Quantum mechanics allows up to 2√2 ≈ 2.828 (Tsirelson bound). The test is: measure S, reject the local model at a pre-declared significance level.

Assumptions you must state

  • Locality: no influence propagates faster than light between the measurement events.
  • Measurement independence (freedom of choice): the settings are uncorrelated with any hidden variables.
  • Fair sampling: the detected pairs are representative of all emitted pairs.
  • No-signaling: the marginal statistics at one station do not depend on the other's setting.

Each maps to a loophole. Locality → locality loophole. Measurement independence → freedom-of-choice and memory loopholes. Fair sampling → detection loophole.

Settings and event selection

Close the locality loophole by making the setting choice spacelike separated from the other station's measurement. At 1.3 km separation, light takes 1.3e3 / 3e8 ≈ 4.3 µs, so the RNG must commit to each setting and the measurement must complete inside that window. The 2015 Delft experiment (Hensen et al., Nature 526, 682) used 1.3 km separation and fast RNGs for exactly this reason.

Event selection: define a coincidence window (a few ns, matched to detector jitter) and subtract accidentals estimated from out-of-window coincidences. Report raw and accidental-subtracted counts.

Confidence procedure

Pre-register the number of trials N and the test. Estimate S from the counts, propagate the per-pair variance Var(E) = (1 − E²)/N, and test S > 2 with a one-sided normal-approximation p-value. At small N the normal approximation is unreliable: use an exact or Hoeffding bound instead.

Worked example (hypothetical counts, N = 10,000 per setting pair):

pairN_sameE
(a,b)7600+0.52
(a,b')2400−0.52
(a',b)7600+0.52
(a',b')7600+0.52

S = 0.52 + 0.52 + 0.52 + 0.52 = 2.08.

Python
import math

counts = {('a','b'):(7600,10000), ('a',"b'"):(2400,10000),
          ("a'",'b'):(7600,10000), ("a'","b'"):(7600,10000)}

E = {k: 2*n_same/n_total - 1 for k,(n_same,n_total) in counts.items()}
S = E[('a','b')] - E[('a',"b'")] + E[("a'",'b')] + E[("a'","b'")]

var = sum((1 - e*e)/counts[k][1] for k,e in E.items())
z = (S - 2.0)/math.sqrt(var)
p = 0.5*math.erfc(z/math.sqrt(2.0))
print(S, z, p)

Trace: each E is 2·7600/10000 − 1 = 0.52, except the second pair, which is −0.52. S = 0.52 − (−0.52) + 0.52 + 0.52 = 2.08. Var(E) = (1 − 0.52²)/10000 = 7.296e-5; Var(S) = 4 × 7.296e-5 = 2.9184e-4; √Var(S) = 0.01708. z = 0.08/0.01708 = 4.68. p = 0.5·erfc(4.68/√2) ≈ 1.4e-6.

So S = 2.08 with 10,000 trials per pair rejects the local model at p ≈ 1.4e-6. The same S with only 1,000 trials per pair gives z ≈ 1.48, p ≈ 0.07, not significant. The violation is a joint statement about S and N.

Trade-offs

Closing the detection loophole needs high efficiency: for CHSH with a maximally entangled state the fair-sampling threshold is η > 2√2 − 2 ≈ 0.828. Photonic tests close the locality loophole easily but historically ran at η ≈ 0.1, so they assumed fair sampling. Superconducting and trapped-ion tests reach η > 0.9 but sit metres apart, so they close detection but not locality. Eberhard's inequality lowers the efficiency threshold at the cost of a smaller S, so it needs more trials for the same p-value. You cannot optimise all three at once; state which loophole you close and which you assume away.

Failure modes

  • Detection loophole: fair sampling violated. Detect by measuring η per station and comparing to the threshold.
  • Locality loophole: settings not spacelike separated. Detect by logging RNG commit time and measurement time at both stations and checking the margin against c.
  • Freedom-of-choice / memory loophole: settings correlated with hidden variables, or RNG state carries memory across trials. Detect by auditing the RNG and testing for serial correlation in settings.
  • Adaptive analysis: choosing the inequality, window or test after seeing data. Detect by pre-registration and a timestamped analysis script.
  • Finite-sample p-value misuse: normal approximation at small N, or reporting the best of several windows. Detect by using exact bounds and reporting all pre-registered analyses.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-13

Design and validate an entanglement or measurement workflow for no signalling.

Answer

Core answer (first 90 seconds). No-signalling is a statement about marginals, not about correlations: Alice's outcome distribution P(a|A) must be identical for every one of Bob's settings B. Quantum mechanics delivers this for free. For a joint state ρ_AB, P(a|A,B) = Tr[(M_a^A ⊗ I) ρ_AB] = Tr[M_a^A ρ_A], where ρ_A = Tr_B ρ_AB is the partial trace: Bob's setting is traced out before it can appear. So the experiment cannot prove no-signalling; it can only bound any apparatus-induced violation. I'd design a workflow that randomises settings independently, keeps every trial, computes marginals per setting pair, and tests them against a null of equality, while separately confirming entanglement with a Bell statistic, so a null result isn't just a dead source.

Design. Settings come from a hardware RNG, committed before the state is prepared, so A and B are independent of each other and of the source. Every trial is logged with timestamp, both settings, both outcomes; nothing is discarded. For each Alice setting a, I compute the marginal over Bob's outcomes for each Bob setting b:

Python
import numpy as np
# A, B: settings (0/1); O: Alice outcome (0/1); N trials
se = lambda p, n: np.sqrt(p*(1-p)/n)
for a in (0, 1):
    p = {}
    for b in (0, 1):
        m = (A == a) & (B == b)
        p[b] = O[m].mean()
    drift = abs(p[0] - p[1])
    print(a, p[0], p[1], drift)

Validate. The null is P(a|A,B=0) = P(a|A,B=1). With N = 10^6 trials per setting pair, the standard error of a marginal near p = 0.5 is √(0.25/10^6) ≈ 5×10⁻⁴, so the difference of two marginals has SE ≈ 7×10⁻⁴. I set the pass threshold at 3σ ≈ 2.1×10⁻³ drift; anything larger is investigated, not published. In the same run I compute CHSH S = E(a,b) − E(a,b′) + E(a′,b) + E(a′,b′); a worked example gives S = 2.70 ± 0.03, which is 23σ above the local bound of 2, confirming the source is genuinely entangled. No-signalling with S ≈ 0 would be vacuous.

Trade-offs. Testing all trials versus coincidence-conditioned data is the central choice. Post-selecting on coincidences raises the correlation visibility but couples the sample to detection efficiency; if efficiency differs by setting, the conditioned marginal appears to signal. So I test marginals on all trials as the primary result, and report the conditioned marginals alongside as a diagnostic: a gap between them is the signature of a detection loophole, not of signalling. The alternative, assuming no-signalling and using it to bound eavesdropping in a device-independent protocol, is a different job: there the assumption is a premise, not a target.

Failure modes. Setting-dependent detection efficiency shifts the marginal and mimics signalling: detected by the all-trials vs conditioned gap above. Clock leakage: if Bob's setting correlates with Alice's timebase, the marginal drifts with wall-clock; detected by binning drift over time. Dropped events correlated with setting bias the marginal; detected by comparing logged trial counts per setting pair against the committed schedule. A classical side channel (shared trigger, crosstalk) shows as a marginal that moves when only Bob's setting changes: exactly the quantity the statistic measures.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-8

What constitutes a Positive Operator-Valued Measure (POVM), how does the completeness relation ensure conservation of probability, and when are POVMs preferred over von Neumann measurements?

Answer

The 90-second answer. A POVM is the most general description of a quantum measurement's statistics: a set of operators ${E_m}$ on $\mathcal{H}$ with $E_m \succeq 0$ and $\sum_m E_m = I$. Positivity makes $p(m) = \operatorname{Tr}(E_m \rho)$ a real non-negative number for every state; completeness makes those numbers sum to 1. That is the entire content: no orthogonality, no idempotency, no cap of $d$ outcomes. You reach for a POVM when the question is not "which orthogonal basis is the state in" but "which of these non-orthogonal states is it, and can I be told when I don't know."

Why completeness is exactly probability conservation. The trace is linear, so $$\sum_m p(m) = \sum_m \operatorname{Tr}(E_m \rho) = \operatorname{Tr}!\Big(\big(\sum_m E_m\big)\rho\Big) = \operatorname{Tr}(I\rho) = \operatorname{Tr}(\rho) = 1.$$ Positivity is what makes each term a probability rather than just a number; completeness is what makes them a distribution. Drop either and you get nonsense: a single operator $E = 2I$ is positive but sums to $2I$, giving $p = 2$.

Why POVMs are more general, and what they don't tell you. Neumark's dilation: any POVM on $\mathcal{H}$ is a projective measurement on $\mathcal{H} \otimes \mathcal{H}_A$ followed by tracing out the ancilla. So POVMs do not extend quantum mechanics; they are what projective measurements look like when you only see part of the system. The catch: a POVM specifies outcome statistics only. It says nothing about the post-measurement state, so you cannot chain measurements from a POVM alone: you need the instrument, a set of Kraus operators $M_m$ with $E_m = M_m^\dagger M_m$. Interviewers probe this.

Worked example: unambiguous discrimination of two qubit states. Take $$|\psi_0\rangle = \cos\theta|0\rangle + \sin\theta|1\rangle, \qquad |\psi_1\rangle = \cos\theta|0\rangle - \sin\theta|1\rangle, \qquad \langle\psi_0|\psi_1\rangle = \cos 2\theta.$$ With $|\psi_1^\perp\rangle = \sin\theta|0\rangle + \cos\theta|1\rangle$ and $|\psi_0^\perp\rangle = -\sin\theta|0\rangle + \cos\theta|1\rangle$, define $$E_0 = \frac{|\psi_1^\perp\rangle\langle\psi_1^\perp|}{1+\cos 2\theta}, \qquad E_1 = \frac{|\psi_0^\perp\rangle\langle\psi_0^\perp|}{1+\cos 2\theta}, \qquad E_? = I - E_0 - E_1.$$ Check $E_? \succeq 0$: in the ${|0\rangle,|1\rangle}$ basis, $E_0 + E_1 = \operatorname{diag}(\tan^2\theta,, 1)$, so $E_? = \operatorname{diag}(1-\tan^2\theta,, 0) \succeq 0$ for $\theta \le 45^\circ$.

Numbers at $\theta = 22.5^\circ$, where $\cos 2\theta = \cos 45^\circ = 0.7071$:

  • $E_0 + E_1 = \operatorname{diag}(0.1716,, 1)$, so $E_? = \operatorname{diag}(0.8284,, 0)$.
  • Input $|\psi_0\rangle = 0.9239|0\rangle + 0.3827|1\rangle$: $p(0) = 0.5/1.7071 = 0.293$, $p(1) = 0$, $p(?) = 0.707$.
  • Input $|\psi_1\rangle$: mirror image. $p(1) = 0.293$, $p(0) = 0$, $p(?) = 0.707$.

So 29.3% of runs identify the state with zero error and 70.7% return "don't know". That 29.3% is exactly $1 - |\langle\psi_0|\psi_1\rangle|$, the Ivanovic–Dieks–Peres bound. No projective measurement can do this: its outcomes are orthogonal, so any outcome consistent with $|\psi_0\rangle$ has nonzero overlap with $|\psi_1\rangle$.

PropertyProjective (von Neumann)POVM
Elements$P_m = P_m^\dagger$, $P_m P_n = \delta_{mn}P_m$$E_m = E_m^\dagger$, $E_m \succeq 0$
Outcomes$\le d$any $M$, finite or countably infinite
Repeatabilitysame outcome repeatsgenerally not
Post-measurement state$P_m$ fixes itnot determined by the POVM
Realizationdirectprojective on $\mathcal{H}\otimes\mathcal{H}_A$ (Neumark)
Non-orthogonal stateserror unavoidablezero error, with an inconclusive outcome

Failure modes and when not to use one.

  • If you need the post-measurement state, a POVM is the wrong object: use the instrument.
  • For minimum-error discrimination of two states with equal priors, the optimal measurement is projective (Helstrom). POVMs only beat it for three or more states, or under a different criterion. "POVMs are always better" is wrong.
  • "Zero error" is ideal. Real photon detectors have dark counts, so the inconclusive port fires spuriously and the error rate is set by detector noise, not by the POVM.
  • Implementing a POVM costs an ancilla plus a joint projective measurement, or classical randomization over projective measurements; both add hardware error that a single-basis readout does not have.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-10

Design and validate an entanglement or measurement workflow for POVM completeness.

Answer

Core answer. A POVM is a set of effects ${E_i}$ on a $d$-dimensional Hilbert space with $E_i \succeq 0$ and $\sum_i E_i = I$. Validating completeness means checking both conditions numerically, in this order: ingest the effects, verify each is Hermitian, eigendecompose each to get its smallest eigenvalue, sum them, and compare the sum to the identity. Only after that do you attach outcome labels and post-states. Entanglement does not change the completeness condition: if the POVM acts on one qubit of a Bell pair, the effects still sum to $I$ on that qubit's $2\times2$ space. What entanglement changes is the post-state, which requires an instrument, not just effects.

Mechanism. Positivity is checked by eigendecomposition, not by inspecting entries: a Hermitian matrix is PSD iff its minimum eigenvalue is $\ge 0$. Completeness is a matrix-norm check on the sum, because $\sum_i E_i = I$ is exactly the statement that the measurement channel is trace-preserving: outcome probabilities sum to 1 for every state. Tolerances are scale-aware: for float64, round-off is $\sim 2.2\times10^{-16}$ per operation, so tol = 1e-9 is safe for exact constructions. For a POVM reconstructed from tomography with an error floor of $1\times10^{-4}$, use tol = 1e-3; a tighter tolerance produces false failures, a looser one accepts nonphysical effects.

Worked check (Python 3.11, NumPy 1.26). The qubit trine: $E_i = \tfrac{2}{3}|\psi_i\rangle\langle\psi_i|$ with $|\psi_i\rangle$ at $0^\circ, 120^\circ, 240^\circ$.

Python
import numpy as np

def validate_povm(effects, tol=1e-9):
    d = effects[0].shape[0]
    for i, E in enumerate(effects):
        H = (E + E.conj().T) / 2          # symmetrize: eigvalsh reads one triangle
        herm = np.linalg.norm(E - E.conj().T)
        min_eig = np.linalg.eigvalsh(H).min()
        assert herm < tol, f"E{i} not Hermitian: {herm}"
        assert min_eig > -tol, f"E{i} not PSD: {min_eig}"
    residual = np.linalg.norm(sum(effects) - np.eye(d))
    assert residual < tol, f"incomplete: {residual}"
    return residual

Trace: each $E_i$ has eigenvalues $2/3$ and $0$, so min_eig = 0.0 and the PSD check passes at the boundary. The sum is $\tfrac{2}{3}\cdot\tfrac{3}{2}I = I$, so residual lands near $1\times10^{-16}$. Drop one effect and the sum becomes $\tfrac{2}{3}I$, giving residual = |1 - 2/3| * sqrt(2) ≈ 0.47: a loud failure.

Trade-offs. Eigendecomposition costs $O(d^3)$ per effect and certifies positivity exactly. The cheaper alternative is sampling: draw random states $|\phi\rangle$, check $\sum_i \langle\phi|E_i|\phi\rangle = 1$ and each term $\ge 0$. That is $O(d^2)$ per sample but probabilistic: it misses a negative eigenvalue of magnitude $\epsilon$ unless you sample near its eigenvector. Use sampling for a fast smoke test at $d > 100$; eigendecompose to certify. If a reconstructed POVM fails, the alternative to rejecting it is projecting onto the POVM set with an SDP (cvxpy), which returns the nearest physical POVM and its distance.

Failure modes. (1) Kraus operators passed as effects: $K_i$ are generally non-Hermitian, so the Hermiticity check fires with a large norm; note $\sum K_i^\dagger K_i = I$ but $\sum K_i \ne I$. (2) Missing outcome: $\sum E_i = cI$ with $c < 1$; detected by the residual norm, which scales as $|1-c|\sqrt{d}$. (3) Negative eigenvalue: min_eig < -tol; a POVM with $\min\lambda = -10^{-3}$ yields negative probabilities of that magnitude for states near the eigenvector. (4) Post-state inferred without an instrument: $E_i$ alone cannot give a post-state. You can always form $K_i = \sqrt{E_i}$, which is a valid Kraus set, but it is not the device's actual one: detect the mismatch by comparing predicted post-states against tomography of the real device.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-11

Design and validate an entanglement or measurement workflow for instrument semantics.

Answer

What a strong candidate says first

An instrument is a set of Kraus operators {M_i} with Σ_i M_i†M_i = I. Outcome i fires with probability p_i = Tr(M_i†M_i ρ) and leaves ρ_i = M_i ρ M_i† / p_i. The POVM {E_i = M_i†M_i} fixes the outcome statistics; the M_i fix the conditional state. Two instruments can share a POVM and differ in the M_i, so a workflow that only checks the first histogram validates the wrong thing.

Design in three stages, each validated: declare the instrument as Kraus operators, implement it in the simulator, then run a reuse test that measures the conditional channel. Assume Qiskit 1.x with qiskit-aer; Cirq's cirq.kraus has the same shape.

Worked example

Qubit in |+> = (|0>+|1>)/√2. Two instruments share the POVM {E_0 = |0><0|, E_1 = |1><1|}:

InstrumentM_0M_1Σ M_i†M_i
A (projective Z)|0><0||1><1|I
B (Z then X)|1><0||0><1|I

Both trace-preserving. First outcome: p(0) = p(1) = 1/2 for both. Conditional state after outcome 0: A leaves |0>, B leaves |1>.

Code

Python
import numpy as np
from qiskit.quantum_info import Kraus, DensityMatrix, Statevector

rho = DensityMatrix(Statevector([1/np.sqrt(2), 1/np.sqrt(2)]))
A = Kraus([[[1,0],[0,0]], [[0,0],[0,1]]])   # projective Z
B = Kraus([[[0,0],[1,0]], [[0,1],[0,0]]])   # Z then X

for name, inst in [("A", A), ("B", B)]:
    for i, M in enumerate(inst.data):
        K = M @ rho.data @ M.conj().T
        p = np.trace(K).real
        print(f"{name} outcome {i}: p={p:.3f} cond={np.round(K/p,3).tolist()}")

Output:

A outcome 0: p=0.500 cond=[[1.0, 0.0], [0.0, 0.0]]
A outcome 1: p=0.500 cond=[[0.0, 0.0], [0.0, 1.0]]
B outcome 0: p=0.500 cond=[[0.0, 0.0], [0.0, 1.0]]
B outcome 1: p=0.500 cond=[[1.0, 0.0], [0.0, 0.0]]

The reuse test: measure Z, then measure Z again on the same qubit:

Python
from qiskit import QuantumCircuit
from qiskit_aer import AerSimulator

def joint(instrument):
    qc = QuantumCircuit(1, 2)
    qc.h(0)
    qc.measure(0, 0)          # first outcome
    if instrument == "B":
        qc.x(0)               # B is Z then X
    qc.measure(0, 1)          # reuse: second Z
    return AerSimulator().run(qc, shots=10000).result().get_counts()

print("A:", joint("A"))
print("B:", joint("B"))

Counts keys are "c1c0". A gives {"00": ~5000, "11": ~5000}; B gives {"10": ~5000, "01": ~5000}. The first marginal is 50/50 in both; the joint is not. That is the check that separates them.

Validation

  • Born rule: compare shot frequencies to Tr(E_i ρ). At N = 10,000 the standard error on a 1/2 outcome is √(0.25/10000) = 0.005, so a 3σ band is ±0.015.
  • Conditional state: save the post-measurement density matrix for the outcome-0 branch (Aer's save_density_matrix, or post-select shots) and compare to Kraus(M_0).transform(ρ); an exact simulator should agree to trace distance < 1e-9.
  • Reuse: the joint distribution above, checked against the predicted conditional channel.

Trade-offs

  • Kraus channel vs. mid-circuit measurement plus classical feedback: the channel is exact and noise-free; the measurement-plus-feedback path is what hardware does but drags in readout and reset error.
  • Backend: statevector is 2^n amplitudes and exact for pure states; density matrix is 4^n and needed once the instrument creates mixtures. At n = 20 that is 16 MB vs ~16 TB, so density matrix caps near n ≈ 12 on a laptop. Stabilizer is fast but Clifford-only, so it cannot represent a general Kraus set.

Failure modes and detection

  • State update invented: saved conditional state ≠ M_i ρ M_i†/p_i. Detect by trace distance against quantum_info.Kraus.
  • Destructive measurement reused: qubit reused without the collapse. Detect with the reuse test: a 50/50 second outcome where the instrument predicts deterministic means the collapse was dropped.
  • Normalization bug: Σ M_i†M_i ≠ I, so probabilities do not sum to 1. Assert the sum to 1e-9 and check shot counts sum to N.
  • Hidden backaction: extra dephasing or leakage absent from the model. Compare off-diagonal decay in the saved density matrix to the Kraus prediction, or run process tomography.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-22

Design and validate an entanglement or measurement workflow for measurement ordering.

Answer

Read the task as: you have a circuit that measures a qubit mid-circuit and feeds the outcome forward, and you need to decide whether that measurement can be moved to the end (deferred measurement), then prove the two circuits agree. State the assumption up front: computational-basis measurement, the outcome used only to control later gates, and the measured qubit not reused. Under those three conditions the two circuits are the same quantum instrument. Drop any one and they are not.

Why deferral works. A mid-circuit measurement is a channel: it writes a classical bit and collapses the qubit. If the only consumer of that bit is a later gate, you can instead entangle a fresh ancilla with the qubit, a CNOT for a Z-basis measurement controlling an X, use the ancilla as the control, and measure it at the end. The ancilla carries exactly the correlation the classical bit carried, so the joint distribution over outcomes and the final state are identical. That is the deferred-measurement principle.

Side conditions, i.e. where it breaks.

  • Reset or reuse. reset is non-unitary: it discards the state and any entanglement. No controlled unitary reproduces it, so measure → reset → reuse cannot be deferred.
  • Basis. The CNOT replacement is for Z-basis measurement. For another basis, insert the basis-change unitary before the controlled operation.
  • Classical post-processing. Fine: it is a function of the bits, and both circuits emit the same bits.
  • Real-time hardware conditional. Deferral removes the conditional, which changes latency, not the math.

Worked trace. q0 = |+>, q1 = |0>. Dynamic: measure q0 → c0; if c0 = 1, X on q1; measure q1 → c1.

  • c0 = 0 (prob 1/2): q1 stays |0>, c1 = 0.
  • c0 = 1 (prob 1/2): q1 → |1>, c1 = 1. Joint (c0, c1) = (0,0) or (1,1), each 1/2. Deferred: CNOT(q0, q1) → (|00> + |11>)/√2; measure both → (0,0) or (1,1), each 1/2. Same.

Code (Qiskit 1.x).

Python
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister

qr, cr = QuantumRegister(2, "q"), ClassicalRegister(2, "c")

dyn = QuantumCircuit(qr, cr)
dyn.h(0)
dyn.measure(0, 0)
with dyn.if_test((cr[0], 1)):   # feed-forward
    dyn.x(1)
dyn.measure(1, 1)

dfr = QuantumCircuit(qr, cr)
dfr.h(0)
dfr.cx(0, 1)                    # ancilla carries the correlation
dfr.measure(0, 0)
dfr.measure(1, 1)

Validation, in three passes.

  1. Structural. The deferred circuit must have no measure or reset before the final layer, and each classical bit written only by a final measurement. A reset or a second measurement on the same qubit means deferral is illegal: stop there.
  2. Distribution. Run both on AerSimulator with the same seed and shots; compare joint counts over the register. Catches basis and ordering mistakes, but it is statistical.
  3. Exact. Strip the final measurements from the deferred circuit and take Operator: it must be unitary. Simulate the dynamic circuit with save_density_matrix and the deferred one with save_statevector, then compare the reduced density matrix on the data qubits conditioned on each outcome. They must match to simulator precision.

Failure modes and how they show up. Collapse ignored (mid-circuit measurement treated as unitary) fails pass 2. Outcome dependency dropped (conditional applied unconditionally) turns the joint distribution into four equally likely pairs instead of two. Basis mismatch (X-basis measurement replaced by a CNOT) fails pass 3 while passing pass 2. Reuse after destructive readout fails pass 1. Latency semantics changed: the deferred circuit drops a readout (~1 µs on superconducting hardware) and the conditional path, so it is faster and statevector-simulable, but if the workflow needs a real-time conditional or a repeat-until-success loop, deferral is not available and you keep the dynamic form.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-3

How do randomized measurement protocols estimate bipartite entanglement measures and purity in hardware, and what are their scaling limits?

Answer

Randomized measurement protocols estimate purity $\operatorname{Tr}(\rho_A^2)$ and the second Rényi entropy $S_2(\rho_A) = -\log_2 \operatorname{Tr}(\rho_A^2)$ of a subsystem $A$ without full state tomography. Instead of reconstructing $\rho_A$, the protocol applies random local single-qubit unitaries drawn from a unitary 2-design (the single-qubit Clifford group, or Haar measure) before computational-basis projective measurements.

Core Mechanism

For an $N_A$-qubit subsystem $A$, apply a tensor product of independent random single-qubit unitaries $u_A = \bigotimes_{i \in A} u_i$. Measure $A$ in the computational basis to observe bitstring $s_A \in {0,1}^{N_A}$. Repeat across $N_U$ random unitary settings, taking $N_M$ projective shots per setting.

Purity is extracted from cross-correlations of outcomes across independent shots taken under the same unitary setting. For two shots $s_A, s'A$ sampled under identical $u_A$, the unbiased estimator is $$\operatorname{Tr}(\rho_A^2) = 2^{N_A} \mathbb{E}{u_A} \sum_{s_A, s'_A} (-2)^{-D(s_A, s'_A)} P(s_A|u_A) P(s'_A|u_A)$$ where $D(s_A, s'_A)$ is the Hamming distance between the bitstrings. In practice the expectation over $u_A$ is replaced by the sample mean over the $N_U$ settings, and the two-shot average by the $\binom{N_M}{2}$ distinct shot pairs per setting (no self-pairs).

For a bipartite partition $A|B$, applying $u_A \otimes u_B$ simultaneously yields estimators for $\operatorname{Tr}(\rho_A^2)$, $\operatorname{Tr}(\rho_B^2)$, and the global purity $\operatorname{Tr}(\rho_{AB}^2)$. When $\rho_{AB}$ is pure (checked via $\operatorname{Tr}(\rho_{AB}^2) \approx 1$), $S_2(\rho_A) = -\log_2 \operatorname{Tr}(\rho_A^2)$ directly quantifies bipartite entanglement entropy.

Worked Trace: Bell State, Single-Qubit Subsystem

Take $|\Phi^+\rangle = (|00\rangle + |11\rangle)/\sqrt{2}$ and $A = {$qubit 0$}$. The reduced state is $\rho_A = I/2$, so $\operatorname{Tr}(\rho_A^2) = 1/2$ and $S_2(\rho_A) = 1$ bit.

For a single qubit, the collision probability, the chance two shots under the same random unitary agree, is $p_{\text{coll}} = \mathbb{E}u \sum_s P(s|u)^2$. Under Haar-random $u$, $p{\text{coll}} = (1 + \operatorname{Tr}(\rho_A^2))/3$. For $\rho_A = I/2$ this is $(1 + 1/2)/3 = 1/2$: the maximally mixed qubit gives a uniform 50/50 outcome for every unitary, so two shots agree half the time. The estimator inverts this relation, $\operatorname{Tr}(\rho_A^2) = 3,p_{\text{coll}} - 1$, recovering $3 \cdot (1/2) - 1 = 1/2$.

Python
import numpy as np
from qiskit.quantum_info import partial_trace, Statevector

# Bell state |Phi+> = (|00> + |11>) / sqrt(2)
psi = Statevector([1/np.sqrt(2), 0, 0, 1/np.sqrt(2)])
rho_AB = psi.to_operator()

# Reduce to qubit 0 (A); qubit 1 is traced out
rho_A = partial_trace(rho_AB, [1])
purity_A = np.real(np.trace(rho_A.data @ rho_A.data))  # Tr(rho_A^2) = 0.5
s2_entropy = -np.log2(purity_A)                         # S_2(rho_A) = 1.0 bit

# Randomized-measurement route to the same number:
#   draw N_U single-qubit Cliffords u on qubit 0,
#   take N_M Z-basis shots per setting,
#   p_coll_hat = mean over settings of (fraction of agreeing shot pairs),
#   purity_hat = 3 * p_coll_hat - 1   ->  ~0.5 for this state

Scaling Limits and Trade-Offs

DimensionFull State TomographyRandomized MeasurementsSWAP Test (Two Copies)
Quantum Resources1 copy, arbitrary bases1 copy, local $1q$ unitaries2 coherent identical copies, joint Fredkin gates
Measurement Settings$3^{N_A}$ Pauli bases$N_U \sim \mathcal{O}(2^{N_A})$ random configs$1$ fixed joint circuit setting
Sample Complexity$\mathcal{O}(4^{N_A}/\epsilon^2)$$\mathcal{O}(2^{N_A}/\epsilon^2)$ total shots$\mathcal{O}(1/\epsilon^2)$ independent of $N_A$
Hardware OverheadRequires $N_A$-qubit tomographyZero inter-qubit entangling gates for readoutHigh: requires coherent inter-register 2-qubit couplers

Production Failure Modes

  1. Mixed-State Confounder: A non-zero $S_2(\rho_A)$ does not prove bipartite entanglement if the global state is impure. If thermal or dephasing noise drives $\operatorname{Tr}(\rho_{AB}^2) < 1$, local classical entropy contaminates $S_2(\rho_A)$. Mitigation: measure global purity $\operatorname{Tr}(\rho_{AB}^2)$ concurrently; entanglement is only witnessed when $S_2(\rho_A) > S_2(\rho_{AB})$.
  2. Readout Error Inversion: Uncorrected bit-flip noise at readout shifts observed Hamming distances $D(s_A, s'_A)$, biasing the estimated purity. Production systems invert the readout assignment matrix $M^{-1}$ on the marginal probabilities before computing the collision kernel.
  3. Exponential Shot Scaling: The variance of the purity estimator grows with subsystem size, so the shot budget to reach fixed additive error $\epsilon$ grows exponentially in $N_A$. Beyond roughly $N_A \approx 10\text{--}12$ qubits the estimator variance dominates and unphysical (negative) purity estimates appear unless the protocol is paired with a variance-reduction scheme.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-9

How does measuring in mutually unbiased bases enable quantum state tomography, and what are the trade-offs in measurement overhead?

Answer

Mutually unbiased bases (MUBs) minimize redundant information across projective measurements. Two orthonormal bases ${|u_i\rangle}$ and ${|v_j\rangle}$ in a $d$-dimensional Hilbert space are mutually unbiased if for all $i, j \in {0, \dots, d-1}$:

$$|\langle u_i | v_j \rangle|^2 = \frac{1}{d}$$

When a quantum system is prepared in an eigenstate of one basis, measuring it in any mutually unbiased basis yields a completely uniform probability distribution ($1/d$). This geometric property guarantees that knowing the outcome probabilities in one basis provides zero information about outcomes in the other, making each basis measurement statistically orthogonal and maximally informative for density matrix reconstruction.

1. Tomographic Reconstruction via Single-Qubit MUBs

For $d=2$ (a single qubit), there exist $d + 1 = 3$ MUBs, corresponding exactly to the eigenstates of the Pauli operators $X$, $Y$, and $Z$:

  1. $Z$-basis: ${|0\rangle, |1\rangle}$
  2. $X$-basis: ${|+\rangle, |-\rangle}$, where $|\pm\rangle = \frac{1}{\sqrt{2}}(|0\rangle \pm |1\rangle)$
  3. $Y$-basis: ${|+i\rangle, |-i\rangle}$, where $|\pm i\rangle = \frac{1}{\sqrt{2}}(|0\rangle \pm i|1\rangle)$

Any single-qubit density matrix $\rho$ decomposes into Pauli expectation values:

$$\rho = \frac{1}{2}\left(I + \langle X \rangle X + \langle Y \rangle Y + \langle Z \rangle Z\right)$$

Measuring in the $Z$-basis directly yields $\langle Z \rangle = P(0) - P(1)$. Measuring in the $X$- and $Y$-bases (via pre-measurement rotations $H$ and $S^\dagger H$ before computational basis readout) yields $\langle X \rangle$ and $\langle Y \rangle$. Because the bases are mutually unbiased, the three measurement settings resolve the 3 real degrees of freedom with uniform statistical sensitivity and no directional bias.

2. Multi-Qubit Scaling and Overhead Trade-offs

For an $n$-qubit system ($d = 2^n$), the density matrix has $d^2 - 1 = 4^n - 1$ real parameters. There are two primary paradigms for constructing tomographic bases:

Tomography StrategyBasis ConfigurationsPre-Readout Circuit DepthPost-Processing ComplexityShot Allocation Sensitivity
Local Pauli (Tensor MUBs)$3^n$ local settings$O(1)$ single-qubit gates ($H, S^\dagger$)Low: linear inversion or direct sample averagingRedundant covariance across commuting Paulis
Global MUBs$d + 1 = 2^n + 1$ global bases$O(n^2 / \log n)$ entangling gates (Clifford)High: full state reconstruction from global projectorsUniform variance across all $d^2 - 1$ operators
  1. Shot Overhead vs. Circuit Complexity: Local Pauli measurements require $3^n$ distinct circuit settings. For $n=5$, that requires $3^5 = 243$ settings. Conversely, global MUBs require only $2^5 + 1 = 33$ settings. However, measuring in an arbitrary global MUB requires entangling circuits (Clifford unitaries) prior to readout, introducing two-qubit gate errors ($CX$ fidelity $\sim 99%$) that systematically corrupt tomographic fidelity far more than local rotation errors.
  2. Statistical Variance and Finite-Shot Noise: To estimate each expectation value to within precision $\epsilon$ with failure probability $\delta$, each setting requires $N_{\text{shots}} = O(\epsilon^{-2} \log(1/\delta))$. Global MUBs yield minimal variance per parameter under white noise because each measurement samples an observable orthogonal to all prior observables. Local MUB tensor products over-sample lower-weight operators (e.g., identity components) relative to high-weight correlators.
Python
# Qiskit basis rotation circuits for single-qubit MUB tomography
from qiskit import QuantumCircuit

def get_mub_circuits(base_circuit: QuantumCircuit) -> dict[str, QuantumCircuit]:
    circuits = {}
    # Z-basis: standard computational readout
    circ_z = base_circuit.copy()
    circ_z.measure_all()
    circuits['Z'] = circ_z

    # X-basis: H before measurement
    circ_x = base_circuit.copy()
    circ_x.h(0)
    circ_x.measure_all()
    circuits['X'] = circ_x

    # Y-basis: S-dagger then H before measurement
    circ_y = base_circuit.copy()
    circ_y.sdg(0)
    circ_y.h(0)
    circ_y.measure_all()
    circuits['Y'] = circ_y

    return circuits

3. Operational Failure Modes

  • Unphysical Density Matrices (Linear Inversion): Estimating expectation values via finite shots $\hat{\rho} = \frac{1}{d}(I + \sum_k \hat{r}_k O_k)$ frequently produces eigenvalues $\lambda_i < 0$ due to Poisson shot noise. Production pipelines must replace raw linear inversion with Maximum Likelihood Estimation (MLE) or constrained semidefinite programming (SDP) to enforce $\rho \succeq 0$ and $\mathrm{Tr}(\rho) = 1$.
  • SPAM Contamination: Basis rotation angle over-rotation (e.g., $H$ gate over-rotation by $\theta = 0.02\text{ rad}$) and asymmetric readout error ($P(0|1) \ne P(1|0)$) skew the reconstructed Pauli coordinates, masquerading as mixedness or unwanted entanglement.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-21

Design and validate an entanglement or measurement workflow for concurrence.

Answer

Scope first. Concurrence is defined for a two-qubit state, so I'd fix three things before touching data: the system is two qubits (a 4×4 density matrix), the basis order is |00⟩,|01⟩,|10⟩,|11⟩, and the spin-flip uses σy. If the state is mixed or higher-dimensional, concurrence is the wrong tool: use negativity or an entanglement witness instead. That scope statement is the first thing an interviewer wants to hear, because most production bugs here are scope bugs.

The quantity. For ρ, define the spin-flip ρ̃ = (σy⊗σy) ρ* (σy⊗σy), then R = ρ ρ̃. Its eigenvalues λ1≥λ2≥λ3≥λ4 are real and non-negative, and

C(ρ) = max(0, √λ1 − √λ2 − √λ3 − √λ4).

For a pure state a|00⟩+b|01⟩+c|10⟩+d|11⟩ this collapses to C = 2|ad − bc|. Entanglement of formation follows as E_F = h((1+√(1−C²))/2) with h the binary entropy, so C is the primitive and everything else is a monotone of it.

Workflow. (1) Unit-test the convention: Bell state must give 1, |01⟩ must give 0. (2) Estimate ρ. Full two-qubit tomography needs 9 measurement settings (3 bases per qubit); linear inversion is fast but unphysical at low counts, so follow with maximum-likelihood. If the state is known pure, skip tomography: C² = 2(1 − Tr ρ_A²), and Tr ρ_A² is measurable with a two-copy swap test, which is cheaper and avoids reconstruction bias. (3) Attach uncertainty by Monte Carlo: resample the multinomial shot counts, recompute C, take percentiles. C is nonlinear in the counts, so linear error propagation understates the tails. (4) Validate against states with closed-form concurrence.

Python
import numpy as np  # numpy 1.26, Python 3.11
sy = np.array([[0, -1j], [1j, 0]])
Y = np.kron(sy, sy)

def concurrence(rho):
    rho = np.asarray(rho, dtype=complex)
    R = rho @ (Y @ rho.conj() @ Y)
    lam = np.sort(np.linalg.eigvals(R).real)[::-1]
    return max(0.0, np.sqrt(lam[0]) - np.sqrt(lam[1])
                     - np.sqrt(lam[2]) - np.sqrt(lam[3]))

Trace it on the Bell state |Φ+⟩ = (|00⟩+|11⟩)/√2. σy⊗σy sends |00⟩→−|11⟩ and |11⟩→−|00⟩, so Y|Φ+⟩ = −|Φ+⟩ and Y ρ Y = ρ. Then R = ρ² = ρ, whose eigenvalues are (1,0,0,0), giving C = 1. On the Werner state ρ = p|Φ+⟩⟨Φ+| + (1−p)I/4, ρ is spin-flip invariant, so R = ρ² with eigenvalues ((1+3p)/4)² and three copies of ((1−p)/4)². Then C = (1+3p)/4 − 3(1−p)/4 = (3p−1)/2, which crosses zero at p = 1/3: the known separability threshold, and the boundary case I'd put in the test suite.

validation stateexpected Cwhat it catches
Bell1convention, basis order
|01⟩0false positives
Werner p=1/30threshold handling
Werner p=0.90.85estimator bias

Failure modes and how I'd detect them. Wrong dimension or qubit labelling shows up as a reconstructed ρ that isn't 4×4 or whose marginals disagree with the measured single-qubit spectra: assert shape, Tr ρ = 1, Hermiticity and positive semidefiniteness on every reconstruction. Tomography bias: linear inversion returns negative eigenvalues at low counts, while MLE shrinks toward I/4 and biases C low; detect by running both estimators and plotting C against shot count until they converge. Convention mismatch (σy versus σy*, or a reordered basis) is caught only by the unit tests above. Finally, a positive concurrence estimate is not a witness: with error bars straddling zero it proves nothing, so I'd report C with its confidence interval and only claim entanglement when the lower bound clears zero. For the Werner family that means resolving p above 1/3, which sets the shot budget.

Trade-off. Tomography gives the full state and any other measure for free but costs 9 settings and reconstruction bias; the two-copy swap test is cheaper and unbiased for purity but only yields C² and needs two coherent copies. Pick tomography when you need the state, the swap test when you only need entanglement and can prepare copies.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-20

Design and validate an entanglement or measurement workflow for entanglement entropy.

Answer

Core answer, first 90 seconds. Entanglement entropy is defined for a pure global state and a chosen bipartition. Four steps: (1) fix the partition A|B and the log base; (2) build ρ_A = Tr_B ρ; (3) diagonalize ρ_A and compute S = −Σ λ_i log λ_i; (4) validate before reporting. If the global state is mixed, S(ρ_A) is not entanglement entropy: it is the entropy of a subsystem, and it is nonzero for fully separable states. Check purity first, then everything else.

Mechanism. The partial trace sums over B's basis: ρ_A[a,a′] = Σ_b ⟨a,b|ρ|a′,b⟩. For a statevector, reshape to a d_A × d_B matrix and SVD it: the singular values are the Schmidt coefficients and p_i = s_i² are exactly the eigenvalues of ρ_A. That is why the spectrum alone fixes S: von Neumann entropy is invariant under the unitary that diagonalizes ρ_A, so only eigenvalues matter. Log base is a unit choice: base 2 gives bits (ebits), base e gives nats, a factor of ln 2 = 0.693 apart. Library defaults bite here: QuTiP's entropy_vn defaults to base e, not 2.

Artefact: code and trace.

Python
import numpy as np

def entropy_from_statevector(psi, dimA, dimB, base=2):
    M = psi.reshape(dimA, dimB)          # index = a*dimB + b
    s = np.linalg.svd(M, compute_uv=False)
    p = s**2
    p = p[p > 1e-15]                     # p log p -> 0
    p = p / p.sum()
    return float(-np.sum(p * np.log(p)) / np.log(base)), p

psi = np.array([1, 0, 0, 1]) / np.sqrt(2)   # Bell pair, A = qubit 0
S, p = entropy_from_statevector(psi, 2, 2)
print(round(S, 6), np.round(p, 6))

Trace: psi is [0.707107, 0, 0, 0.707107]; reshape(2,2) gives [[0.707107, 0], [0, 0.707107]]; SVD returns singular values [0.707107, 0.707107]; p = [0.5, 0.5]; both survive the filter and sum to 1; S = −(0.5·log2 0.5 + 0.5·log2 0.5) = 1.0. Output: 1.0 [0.5 0.5].

Validation table.

checkcatchesconcrete value
purity Tr ρ²mixed global stateBell: 1.0 → proceed; 0.5|00⟩⟨00|+0.5|11⟩⟨11|: 0.5 → stop
Σλ = 1, λ ≥ 0bad partial trace, wrong index orderraw λ_min = −3e−16 → clip; −1e−3 → bug
S(A) = S(B)wrong subsystem, pure states onlyBell: 1.0 = 1.0
S ≤ log2 d_Aentropy called qubit countBell: 1 ≤ 1; GHZ on 3 qubits, trace 2: 1 ≤ 1
analytic anchoreverything aboveBell = 1 bit, product = 0, GHZ(1|2) = 1 bit

Failure modes and detection.

  • Mixed global state reported as entanglement. Detect with Tr ρ² < 1 − 1e−9. ρ = 0.5|00⟩⟨00| + 0.5|11⟩⟨11| is separable, yet ρ_A = I/2 and S = 1 bit. Purity is 0.5, so the workflow stops before reporting.
  • Silent eigenvalue clipping. Clipping negatives and renormalizing without logging lets a wrong index order or a non-positive state pass. Log λ_min raw; clip only |λ| < 1e−12 and fail if λ_min < −1e−10.
  • log-zero. p log p → 0 as p → 0. Drop p < 1e−15; that costs at most d_A · 5e−14 bits. Do not add ε to every eigenvalue: it biases S upward.
  • Wrong subsystem. For pure states S(A) = S(B) is a free check. For mixed states they differ: with ρ = 0.5|00⟩⟨00| + 0.5|1+⟩⟨1+|, S(A) = 1.000 bits but S(B) = 0.601 bits. Record which side you traced out.
  • Entropy called qubit count. S ≤ log2 d_A always. A Bell pair is 1 bit, not 2.

Trade-offs. Statevector SVD costs O(d_A² d_B) and reaches roughly 30 qubits; a full density matrix is 4^n entries and caps near 10–12 qubits. Beyond that, estimate Rényi-2 entropy from randomized measurements (classical shadows, swap trick): measurable from shots, and S₂ ≤ S₁, so it lower-bounds von Neumann but is a different number. Use the SVD path when you hold the state; use shadows when you only hold measurements.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-23

Design and validate an entanglement or measurement workflow for tomographic entanglement.

Answer

Clarify first. I'll assume a two-qubit state ρ on a superconducting or photonic platform where I can do projective measurements in X, Y, Z on each qubit, and that the goal is both to certify entanglement and to quantify it with an honest error bar. If the question is only "is it entangled?", a witness is cheaper and I'd stop there; tomography is for when I need the value of a measure.

The workflow, five steps.

  1. Choose settings and shots. Two-qubit linear tomography needs 9 settings (X/Y/Z ⊗ X/Y/Z). Budget 10,000 shots each → 90,000 events. That's the number that sets the error bar, so pick it from the target precision, not by habit.
  2. Reconstruct with a physical estimator. Linear inversion gives ρ̂ = Σ cᵢ σᵢ with negative eigenvalues at finite N. Use maximum-likelihood with a Cholesky parametrization ρ = T†T/tr(T†T), which is positive by construction. Report the method and the parametrization: a reviewer cannot reproduce a number without them.
  3. Compute the measure. For two qubits, concurrence via Wootters:
Python
import numpy as np
sy = np.array([[0,-1j],[1j,0]])
Y = np.kron(sy, sy)

def concurrence(rho):
    R = rho @ Y @ rho.conj() @ Y
    lam = np.sqrt(np.clip(np.linalg.eigvalsh(R), 0, None))
    lam = np.sort(lam)[::-1]
    return max(0.0, lam[0]-lam[1]-lam[2]-lam[3])

Trace on |Φ⁺⟩ = (|00⟩+|11⟩)/√2: R has eigenvalues 1,0,0,0, so C = 1. Correct. 4. Validate with a witness on the same data. From the same counts compute CHSH S = E(a,b) − E(a,b′) + E(a′,b) + E(a′,b′). |S| > 2 certifies entanglement model-independently: no reconstruction, no measure assumptions. This is the cross-check that catches a broken estimator. 5. Uncertainty by bootstrap. Resample each setting's counts from a multinomial with the observed probabilities, re-run MLE, recompute C, 1,000 times; report the 2.5/97.5 percentiles.

Worked numbers (hypothetical, labelled). A near-Bell state gives S = 2.61 ± 0.08, i.e. 7.6σ above the classical bound 2 and below Tsirelson's 2√2 ≈ 2.828. Tomography on the same counts gives C = 0.94 with 95% CI [0.89, 0.97]. The witness and the measure agree, so I trust both.

Failure modes and how I detect them.

  • Nonphysical ρ̂. Check eigenvalues of the linear-inversion estimate; any negative one means you skipped step 2. Cost: a concurrence computed from a nonphysical matrix is meaningless.
  • Positivity-projection bias. MLE pushes weakly entangled states toward C > 0 because C is nonnegative by definition. Detect it by Monte Carlo: push known separable and near-separable states through the identical pipeline and report the bias. If the true C = 0.02 and the pipeline returns 0.10, the CI must be read against that floor, not against zero.
  • Missing error bars. A point estimate of 0.94 with no CI cannot distinguish a Bell state from a partially decohered one.
  • Analysis-choice p-hacking. Fix the estimator, the measure and the CI method before looking at the data; report every setting used.

Trade-off. Tomography gives a number and a full state but costs 9 settings and inherits reconstruction bias. A witness costs one or two settings, is assumption-light, and answers only yes/no. Use the witness to certify, tomography to quantify, and always report both when the claim is "this state is entangled with concurrence X."

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-16

Design and validate an entanglement or measurement workflow for CHSH estimators.

Answer

CHSH asks whether correlations between two separated parties exceed the classical bound |S| ≤ 2. The estimator is a fixed linear combination of four correlators:

S_hat = E00 + E01 + E10 − E11, where E_ab = (1/N_ab) Σ_{i: settings (a,b)} A_i B_i, with A_i, B_i ∈ {+1, −1}.

Design. Draw Alice's and Bob's settings independently per trial, uniformly over {0,1}×{0,1}, from a trusted RNG, and record (a_i, b_i, A_i, B_i) for every trial. Validate by computing S_hat with its uncertainty, testing S_hat − 2 against that uncertainty, and running the loophole checks below. Assumptions that matter: trials i.i.d.; settings independent of the state (freedom of choice); outcomes ±1 with no post-selection.

Why per-trial randomization. Each trial lands in exactly one of the four setting pairs, so the four correlators are computed on disjoint trial subsets. Under i.i.d. trials they are independent and

Var(S_hat) = Σ_ab Var(E_ab) = Σ_ab (1 − E_ab²)/N_ab.

The (1 − E_ab²) is just Var(A_i B_i), since (A_i B_i)² = 1. The covariance term is zero by design: that is the point of per-trial randomization. Use a fixed or block schedule instead and drift correlates the correlators, so you must estimate the full 4×4 covariance matrix by binning trials in time.

Worked numbers. N = 10⁶ trials split evenly, N_ab = 250,000. The standard optimal singlet angles (Alice 0° and 90°, Bob 45° and 135°) give |E_ab| = 1/√2 ≈ 0.7071 for all four pairs, with signs arranged so S = 2√2. Take E00 = E01 = E10 = 0.7071, E11 = −0.7071. Then S_hat = 2.828 and Var = 4 × (1 − 0.5)/250,000 = 8×10⁻⁶, so σ_S = 0.0028. S_hat = 2.828 ± 0.003, which is (2.828 − 2)/0.0028 ≈ 290σ above the classical bound. The statistical margin is enormous; the real risk is systematic.

Trade-off. Per-trial randomization kills the covariance term but needs a fast trusted RNG and per-trial setting switching. Block randomization (say 1000 trials per setting block) is easier on the hardware but reintroduces covariance under drift. Deciding criterion: if the source drifts by more than σ_S over a block, use per-trial; otherwise block randomization with time-bin covariance estimation is acceptable.

Failure modes and detection.

  • Setting mix-up: recorded setting ≠ applied setting, biasing E_ab toward the true setting's correlator. Detect with the no-signaling check: P(A=+1 | a, b0) must equal P(A=+1 | a, b1) within uncertainty; a mismatch means labels are contaminated. Cross-check the RNG log against the applied settings.
  • Broken independence: a shared systematic (detector drift) makes the four correlators covary. Bin in time, compute the empirical 4×4 covariance, and compare σ_S to the naive sum; a >20% gap means the naive error bar is wrong.
  • Drift: fit S per time bin; a slope comparable to σ_S per bin is significant. Interleaving settings makes drift common-mode and cancels in S.
  • Unequal sampling: variance is dominated by the smallest N_ab. Monitor the max/min ratio; keep it under 1.05. Verify the setting sequence with a randomness test (NIST SP 800-22).
  • Mitigation bias: readout-error inversion can over-correct and push S above the Tsirelson bound 2√2 ≈ 2.828. Detect by checking S ≤ 2√2 + 3σ_S; if it exceeds, the mitigation is biased.

Fix the estimator, binning and significance threshold before looking at data.

Python
import numpy as np

def chsh(a_out, b_out, a_set, b_set):
    # a_out, b_out: +1/-1 arrays; a_set, b_set: 0/1 arrays
    E, var = {}, 0.0
    for sa in (0, 1):
        for sb in (0, 1):
            m = (a_set == sa) & (b_set == sb)
            e = np.mean(a_out[m] * b_out[m])
            E[(sa, sb)] = e
            var += (1 - e**2) / m.sum()
    S = E[(0,0)] + E[(0,1)] + E[(1,0)] - E[(1,1)]
    return S, np.sqrt(var)

Checked against Python 3.11 / NumPy 1.26.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-17

Design and validate an entanglement or measurement workflow for finite shots.

Answer

Assumptions first. I'll take the concrete case: a CHSH Bell test on a two-qubit device where the claim is "S > 2", plus a binomial fidelity claim "F ≥ 0.99". Shots are the scarce resource, the decision is a threshold, and the analysis is pre-registered before data. If your claim differs, the same five steps apply.

The workflow. (1) Fix the decision rule before any shots: threshold θ, confidence 1−α, interval method, stopping rule. (2) Size N from the interval width you need, not from a round number. (3) Record raw counts per measurement setting: never just the point estimate. (4) Analyze with a named interval, correct for multiplicity, and compare the interval to θ, not the point estimate. (5) Validate with a control: a separable state must not violate, and a held-out run must reproduce.

Sizing. For CHSH with ±1 outcomes, at the ideal point each correlator is ±1/√2, so Var(S) = (4 − ΣE²)/N = 2/N and σ_S = √(2/N). To claim S > 2 at 5σ you need N ≥ 2/((2.828 − 2)/5)² ≈ 73 shots. That is a normal-approximation heuristic; the rigorous Hoeffding bound for CHSH, N ≥ (8/ε²)ln(1/δ), gives ≈160 shots at δ = 10⁻⁶: roughly double. Size with the rigorous one when the claim is adversarial.

Interval choice. The Wald interval is the trap: at 100/100 it has zero width. Wilson and Clopper-Pearson both give [0.963, 1.0] at 100/100 (95%). Clopper-Pearson guarantees coverage ≥ 1−α but is conservative; Wilson is tighter and behaves better near 0 and 1, though its coverage can dip slightly below nominal for some n. Pick Clopper-Pearson when coverage must be guaranteed (security, regulatory); Wilson when you need the tightest defensible interval.

Python
from scipy.stats import binomtest   # scipy 1.11, Python 3.11
n, k = 100, 100
print(binomtest(k, n).proportion_ci(0.95, method='exact'))   # 0.9638 .. 1.0
print(binomtest(k, n).proportion_ci(0.95, method='wilson'))  # 0.9630 .. 1.0

Failure modes and detection.

  • Too few shots: the interval straddles θ. Detect by comparing endpoints to θ; a point estimate above θ with an interval spanning it is inconclusive, not a pass.
  • Gaussian approximation at the boundary: Wald width → 0 as p̂ → 1. Detect by checking whether the interval has zero width or contains 0/1; switch to Wilson or Clopper-Pearson.
  • Hidden retries: re-running until the interval clears θ inflates type I error. Detect by logging every run and counting attempts; if you must stop early, use an alpha-spending rule or an always-valid confidence sequence.
  • Multiplicity: testing 50 qubit pairs, ~2.5 cross at α = 0.05 by chance. Detect by comparing crossings to the null expectation; correct with Bonferroni (conservative) or Benjamini-Hochberg (more power, controls FDR).
  • Rounded threshold crossing: reporting 0.99 when the interval is [0.985, 0.995] and θ = 0.99. Detect by comparing endpoints, never the rounded point.

Trade-offs. Fixed-N is simple and pre-registerable; sequential saves shots but needs a different interval. Analytic intervals are fast and reproducible; bootstrap handles non-binomial statistics like S but needs its own budget and can misbehave at small N. Choose by whether shots are expensive (rare entangled pairs → sequential) or cheap (→ fixed-N).

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-18

Design and validate an entanglement or measurement workflow for readout error.

Answer

Assumptions first. Superconducting transmon device, 2–3 qubits, measurement in the computational basis, readout error dominated by assignment error: a qubit prepared in |0⟩ reads 1 or vice versa, from T1 decay during the readout window and from crosstalk with neighbouring qubits. On current hardware that is order 1–3% per qubit. If the circuit is 200 gates deep, gate error dominates and this workflow is the wrong tool.

The design, in five steps. (1) Calibrate: prepare each of the 2^n computational basis states, measure with 8192 shots, and build the assignment matrix A where A[i][j] = P(measure i | prepare j). (2) Validate A before trusting it: columns sum to 1, the diagonal is 1 − readout error, and the off-diagonal structure matches the crosstalk you expect. (3) Run the entanglement circuit (a Bell state, or a GHZ if you have three qubits) and record raw counts. (4) Mitigate by solving A p = p_raw under the constraint p ≥ 0, not by naive inversion. (5) Report raw and mitigated side by side, each with a bootstrap uncertainty.

Why it works, and why it matters for entanglement. Readout error is a classical stochastic map applied after the quantum circuit, so it multiplies the measured distribution by A. It cannot create entanglement, but it suppresses the correlations you are trying to witness. For |Φ+⟩ with independent per-qubit error e, every two-qubit correlator is scaled by (1−2e)². The CHSH value S = 2√2 ≈ 2.828 becomes 2.828·(1−2e)². At e = 2% that is 2.61: still a violation. At e = 10% it is 1.81, below the classical bound of 2. Readout error alone can make an entangled state look separable.

Worked trace. Two qubits, e = 2%, ideal Bell state. A = A₁⊗A₁ with A₁ = [[0.98, 0.02], [0.02, 0.98]]:

A = [[0.9604, 0.0196, 0.0196, 0.0004],
     [0.0196, 0.9604, 0.0004, 0.0196],
     [0.0196, 0.0004, 0.9604, 0.0196],
     [0.0004, 0.0196, 0.0196, 0.9604]]

Ideal p = [0.5, 0, 0, 0.5]. Raw, after 8192 shots with a 3σ downward fluctuation on the 01 bin: p_raw ≈ [0.4827, 0.0150, 0.0196, 0.4827]. Solving A p = p_raw gives p_mit ≈ [0.5025, −0.0049, −0.0001, 0.5025]. Two entries are negative: unphysical. Constrained least squares (scipy.optimize.nnls, or CVXPY with p ≥ 0, Σp = 1) returns ≈ [0.500, 0, 0, 0.500]. That constraint step is not optional; it is the difference between a mitigation you can publish and one you cannot.

Code. mthree is the maintained path; qiskit-ignis's CompleteMeasFitter is archived.

Python
import mthree
mit = mthree.M3Mitigation(backend)
mit.cals_from_system([0, 1])          # runs the 2^n calibration circuits
counts = backend.run(bell, shots=8192).result().get_counts()
quasi = mit.apply_correction(counts, [0, 1])
p_mit = quasi.nearest_probability_distribution()   # enforces p >= 0, sum = 1

Trade-offs. A full 2^n assignment matrix is exact but costs 2^n calibration circuits and 4^n memory; at n = 10 that is 1024 circuits and a 10⁶-entry matrix. The tensored model (per-qubit A₁, then A₁⁻¹⊗…⊗A₁⁻¹) is cheap and correct only when readout errors are independent: crosstalk between neighbouring qubits breaks that, and the tensored correction then leaves a residual bias. mthree builds a per-qubit model and applies it iteratively, which is cheaper than the full matrix and more robust than a single tensored inversion. Do not mitigate when readout error is below ~0.5% and shot noise dominates, or when the circuit is deep enough that gate error swamps readout: you add variance without removing bias.

Validation and failure modes. Re-run calibration immediately before the experiment; a calibration from yesterday is stale on a device whose error rates drift on the hour. Check that mitigated probabilities are non-negative and sum to 1. Report uncertainty: a mitigated point estimate with no error bar hides the variance amplification that inversion causes. And never report only the corrected result: the raw counts are the evidence, the mitigated counts are the inference.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-19

Design and validate an entanglement or measurement workflow for post-selection.

Answer

Core answer. The deciding question is what claim the post-selected data has to defend. A device-independent claim (a Bell violation, a randomness certificate) is only valid above the detection-efficiency threshold, so the workflow's first job is to measure that efficiency independently and refuse to report if it is too low. An engineering claim (state fidelity, link budget) tolerates post-selection, but the inclusion rule must be pre-registered and the rejected trials counted. Assume a heralded entangled-pair source, a CHSH measurement over four setting pairs, and a raw per-cycle log that records every clock tick whether or not anything fired.

The threshold is per arm, not per coincidence. Garg–Mermin: with per-arm efficiency η, any local-hidden-variable model obeys S ≤ 4/η − 2. Setting that equal to the quantum maximum 2√2 gives η > 2(√2 − 1) ≈ 0.8284. The coincidence-to-herald ratio is η_A·η_B for a symmetric source, so it is a cross-check, not the threshold quantity: at η = 0.90 it is 0.81, and comparing 0.81 against 0.8284 would wrongly reject a valid run.

Workflow, four stages.

  1. Pre-register. Fix the estimator, the inclusion predicate, the analysis window and the stopping rule before data taking; publish a hash of the analysis script so the predicate cannot move afterwards.
  2. Acquire with full logging. One record per clock cycle: timestamp, setting pair, which detectors fired, herald flag, and a reason code if the cycle is rejected. Rejected cycles are data, not noise.
  3. Post-select and audit. Apply the predicate, then run the assertions below before computing anything.
  4. Report. Publish totals and the reason-code histogram by setting and outcome, alongside the estimator and the independently measured η.
Python
# Python 3.12
import math

ETA_MIN = 2 * (math.sqrt(2) - 1)   # 0.8284: CHSH detection-loophole threshold, per arm
REASONS = {"no_herald", "no_click_a", "no_click_b", "double_click", "timeout"}

def analyse(cycles, eta_arm, expected_ticks):
    # eta_arm is calibrated independently (singles rate / known flux), never
    # from the coincidence count it is used to validate.
    used     = [c for c in cycles if c["reason"] is None]
    rejected = [c for c in cycles if c["reason"] is not None]

    assert len(cycles) == expected_ticks                 # no tick dropped or silently retried
    assert {c["reason"] for c in rejected} <= REASONS    # rejection codes are exhaustive

    if eta_arm < ETA_MIN:
        raise ValueError(f"eta_arm={eta_arm:.4f} < {ETA_MIN:.4f}: fair-sampling loophole open")

    E = {}
    for a in (0, 1):
        for b in (0, 1):
            sub  = [c for c in used if c["settings"] == (a, b)]
            assert sub, f"no used cycles for settings {(a, b)}"
            same = sum(1 for c in sub if c["outcome"][0] == c["outcome"][1])
            E[a, b] = (2 * same - len(sub)) / len(sub)
    S = E[0, 0] + E[0, 1] + E[1, 0] - E[1, 1]
    return S, eta_arm

Trace. Independent calibration gives η_arm = 0.75 (1,500,000 singles per arm out of 2,000,000 source fires). Coincidences are then 2,000,000 × 0.75² = 1,125,000. Since 0.75 < 0.8284 the function raises and no S is published: correct, because at η = 0.75 the local bound 4/0.75 − 2 = 3.333 exceeds the quantum maximum 2.828, so any observed S is reproducible without entanglement.

Raise η_arm to 0.90: coincidences = 2,000,000 × 0.81 = 1,620,000, i.e. 405,000 used cycles per setting pair. Settings (0,0), (0,1), (1,0) hold 344,250 same-outcome pairs each → E = (2·344250 − 405000)/405000 = +0.700. Setting (1,1) holds 60,750 → E = −0.700. Then S = 0.700 + 0.700 + 0.700 − (−0.700) = 2.800. The local bound at η = 0.90 is 4/0.90 − 2 = 2.444, so 2.800 is a genuine violation, and it sits below the Tsirelson bound 2√2 ≈ 2.8284.

Failure modes and how each is caught.

failuremechanismdetection
outcome-dependent losspolarization-dependent loss drops one outcome preferentiallysingles rate per setting shifts beyond Poisson error
silent retriesFPGA re-arms after a timeout without logging the cyclelen(cycles) != expected_ticks
denominator mismatchS over post-selected pairs, error bar over all cyclesassert len(used) equals the sum of inclusion codes
herald ambiguitytwo herald photons in one window counted as oneP(2)/P(1) = μ/2 = 1% at μ = 0.02; a larger measured ratio means multi-pair events are merged
missing audit trailraw log discardedrecompute the published S from raw; must match exactly

Alternatives and when to pick them. Fair-sampling post-selection is cheap and high-rate but leaves the loophole open below the threshold: use it only for fidelity or link-budget claims. A loss-tolerant test with a non-maximally entangled Eberhard state lowers the threshold to η > 2/3 ≈ 0.667 at the cost of a smaller violation and more trials. Event-ready heralded entanglement with a quantum memory removes the fair-sampling assumption by starting the trial at a herald, but adds memory lifetime and readout efficiency to the budget. If you cannot measure η independently of the coincidence count, do not post-select at all: report the raw coincidence rate and state that the loophole is open.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-25

How would you experimentally quantify the entanglement of a two-qubit state, and what limits the accuracy of that measurement?

Answer

Clarify first. I'd ask whether the goal is a witness (is it entangled?) or a value with an uncertainty. For two qubits I'd quantify with concurrence C or negativity N. I'll assume projective measurements in X, Y, Z on each qubit, repeated state preparation, and readout calibration available.

Route 1: full state tomography. Two-qubit tomography needs 9 settings (X/Y/Z ⊗ X/Y/Z). With N shots per setting, reconstruct ρ by maximum likelihood (linear inversion gives negative eigenvalues at finite N). Then compute the measure:

Python
from qiskit.quantum_info import concurrence, negativity
# rho: 4x4 density matrix from tomography
C = concurrence(rho)   # 0 separable, 1 Bell
N = negativity(rho)    # 0 separable, 0.5 Bell

For a Bell state |Φ⁺⟩, ideal C=1. With N=10,000 per setting (90,000 shots total), the standard error on a Pauli expectation is ~1/√N = 0.01; propagated to C, the 1σ band is a few times 10^-2. Near C=0 the estimator is non-analytic (max(0, λ1-λ2-λ3-λ4)), so errors are asymmetric and a positive bias of order 0.01 can appear. That is why you report an interval, not a point.

Route 2: randomized measurements. Instead of 9 fixed settings, apply random single-qubit Clifford or Pauli rotations before computational-basis readout. From the same shots you estimate purity and moments of the partially transposed density matrix, then plug into a concurrence/negativity estimator. This avoids full tomography and can use fewer settings, but it trades settings for samples and post-processing. For two qubits it is usually not worth it; for larger systems the known hardness results bite: estimating concurrence or negativity to constant additive error for worst-case n-qubit states requires exponentially many samples in n, so randomized estimators do not escape the scaling wall.

What limits accuracy. Statistical: shot noise, and for nonlinear measures the error propagation is not Gaussian near the separable boundary. Systematic: readout assignment error (typically 1-5% on superconducting hardware), state-preparation and gate error, drift between settings, and basis-label mistakes. Estimator: positivity projection bias, choice of reconstruction, and the fact that different entanglement monotones give different numbers. Basis choice matters: X/Y/Z are mutually unbiased and minimize overlap for tomography; for a witness or CHSH you instead pick settings that maximize violation. Always report the estimator, the settings, the shots per setting, and the calibration used.

Curated: · Written: · Reviewed:

Difficulty: Medium
Q&A-24

Design and validate an entanglement or measurement workflow for experimental provenance.

Answer

What I'd say first

Provenance means one thing operationally: an independent verifier, given only what you published, recomputes your entanglement claim from the raw shots and gets the same number inside the stated uncertainty. I'll assume a two-qubit experiment, superconducting transmon or photonic, where the claim is a Bell-state fidelity or a CHSH S value, and the raw data is per-shot bitstrings plus the readout calibration that produced them. The workflow is a content-addressed DAG: hash every artefact, make every transformation a node recording its inputs' hashes, the code commit, and the environment, and publish the claim as the root. Validation is replay.

Why hashing and versioning establish provenance

A hash binds content to an identifier; a DAG of hashes binds each derived number to the exact inputs and code that produced it. That is what makes the claim checkable rather than asserted. Versioning the code and the target (device, qubit pair, coupling map) matters because the same analysis on a different target gives a different number: the target is an input, not context.

Manifest

run-2024-11-03T14:22Z/
  raw/shots.h5           sha256:9f2c…   (1e6 shots × 2 qubits, 2.1 GB)
  cal/readout.npz        sha256:4a71…   (acquired 14:05Z, same session)
  code/analysis.py       git:8c1d3f2
  env/requirements.lock  sha256:…
  manifest.json          cosign keyless signature (OIDC identity = CI workflow)

Merkle root over the five leaves: SHA-256 of the five 32-byte digests concatenated in sorted-path order. 160 bytes in, one 32-byte root out. Publish the root and the DOI; the leaves stay in cold storage.

Verifier replay (trace)

  1. Fetch manifest.json, verify the cosign signature against the recorded OIDC identity. Fail → stop.
  2. Recompute SHA-256 of raw/shots.h5. Mismatch → data altered or truncated.
  3. Check cal/readout.npz hash and that its acquisition timestamp falls inside the run window. A calibration pulled from a different day fails here: that is the cherry-picked-calibration check.
  4. Check out git 8c1d3f2, install requirements.lock, re-run analysis.py on the raw shots.
  5. Compare recomputed fidelity to the published value inside the stated uncertainty.

Alternatives and when to use them

approachgivescostuse when
git + DVC remotecontent hashes, pointers in gitDVC's default file hash is MD5; add SHA-256 in the manifestmost lab pipelines
in-toto + Sigstoresigned per-step attestationsCI plumbingclaims leaving the lab
ELN/LIMShuman record, timestampsmanual, weak on raw dataregulated labs
raw-shot archivefull replay2.1 GB/run at 1e6 shotsheadline results

Failure modes and detection

Raw counts deleted → hash missing from manifest. Setting labels lost → analysis can't map shots to qubits; detect by re-running and getting a different fidelity. Calibration cherry-picked → timestamp outside the run window. Ideal result substituted → recomputed value from raw shots disagrees. Analysis changed after seeing outcomes → code hash differs from the manifest's.

When not to

If the claim is a device characterization you'll re-measure next week, full raw-shot retention is overkill; keep the manifest and summary statistics. Signing is worth the plumbing only when someone outside your group will rely on the number.

Curated: · Written: · Reviewed:

Difficulty: Medium