QuantumCore

Hands-on lab · 1 step

Basis-encode the bit string 1011

Prepare the basis encoding ∣1011⟩=X⊗I⊗X⊗X ∣0000⟩\lvert1011\rangle=X\otimes I\otimes X\otimes X\,\lvert0000\rangle of the bit string x=1011x=1011 on four qubits, using at most three XX gates. Qubit 0 is the leftmost (most significant) bit, so the target is the basis vector with index k=8+2+1=11k=8+2+1=11 of C16\mathbb C^{16}.

0/1 step passedBest score 0/100

Step 1: Prepare the basis state of 1011

Starting from ∣0000⟩\lvert0000\rangle, prepare the basis encoding of the bit string x=x0x1x2x3=1011x=x_0x_1x_2x_3=1011:

∣1011⟩=∣1⟩⊗∣0⟩⊗∣1⟩⊗∣1⟩=e11∈C16,\lvert1011\rangle=\lvert1\rangle\otimes\lvert0\rangle\otimes\lvert1\rangle\otimes\lvert1\rangle=e_{11}\in\mathbb C^{16},

the column vector with a 11 in position k=∑j=03xj23−j=8+0+2+1=11k=\sum_{j=0}^{3}x_j2^{3-j}=8+0+2+1=11 (counting from 00) and 00 everywhere else. Qubit jj carries bit xjx_j, and qubit 0 is the leftmost, most significant bit.

Only XX gates are allowed, at most three of them. The grader computes the fidelity F=∣⟨1011∣ψ⟩∣2F=\lvert\langle1011\vert\psi\rangle\rvert^2 of your final state ∣ψ⟩\lvert\psi\rangle and requires F≥1−10−6F\ge1-10^{-6}.

  • 4 qubits
  • allowed gates: X
  • at most 3 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 circuitq0q1q2q3
Statevector amplitudes
BasisAmplitude α|α|Phase arg αProbability
|0000⟩1
1.0000
0
100.00%
15 basis states with zero amplitude hidden