QuantumCore

Hands-on lab · 1 step

Purify a mixed qubit

Prepare a two-qubit pure state ∣ψ⟩01\lvert\psi\rangle_{01} whose reduced state on qubit 0 is the mixed state ρ0=Tr1∣ψ⟩⟨ψ∣=diag(34,14)\rho_0=\mathrm{Tr}_1\lvert\psi\rangle\langle\psi\rvert=\mathrm{diag}(\tfrac34,\tfrac14). Mixedness of a marginal cannot come from a single-qubit gate: it must come from entanglement with qubit 1.

0/1 step passedBest score 0/100

Step 1: Prepare a purification

Starting from ∣00⟩\lvert00\rangle, build a circuit with at most four gates from {RY,RX,RZ,H,X,CNOT,CZ}\{R_Y,R_X,R_Z,H,X,\mathrm{CNOT},\mathrm{CZ}\} whose output ∣ψ⟩\lvert\psi\rangle is a two-qubit pure state with reduced state on qubit 0

ρ0=Tr1∣ψ⟩⟨ψ∣=(340014).\rho_0=\mathrm{Tr}_1\lvert\psi\rangle\langle\psi\rvert=\begin{pmatrix}\tfrac34&0\\0&\tfrac14\end{pmatrix}.

Qubit 0 is the leftmost bit, and the components of the partial trace are (ρ0)aa′=∑bψ(a,b)ψ(a′,b)‾(\rho_0)_{aa'}=\sum_b\psi_{(a,b)}\overline{\psi_{(a',b)}}. The check computes the trace distance T(ρ0,σ)=12∑i∣λi(ρ0−σ)∣T(\rho_0,\sigma)=\tfrac12\sum_i\lvert\lambda_i(\rho_0-\sigma)\rvert to the target σ\sigma and accepts T≤10−6T\le10^{-6}.

  • 2 qubits
  • allowed gates: RY, RX, RZ, H, X, CNOT, CZ
  • at most 4 gates
  • no measurements

One gate per line or separated by ;, e.g. H(0); CNOT(0,1); RY(1, pi/3); measure(1 -> 0). Qubit 0 is the top wire (most significant bit); controls come first. # starts a comment.

Measure into a classical bit with measure(q -> c); apply a gate only when a bit is set with X(2) if c1==1 (several bits, first = most significant: if c[0,1]==3).

Circuit diagram of your answerEmpty circuitq0q1
Statevector amplitudes
BasisAmplitude α|α|Phase arg αProbability
|00⟩1
1.0000
0
100.00%
3 basis states with zero amplitude hidden