QuantumCore

Hands-on lab · 1 step

Build a product-state joint distribution

Prepare a product state ∣a⟩⊗∣b⟩\lvert a\rangle\otimes\lvert b\rangle whose joint distribution is P(00)=P(01)=38P(00)=P(01)=\tfrac38, P(10)=P(11)=18P(10)=P(11)=\tfrac18, using the factorisation P(q0,q1)=PA(q0)PB(q1)P(q_0,q_1)=P_A(q_0)P_B(q_1) and the big-endian ordering (qubit 0 is the leftmost bit).

0/1 step passedBest score 0/100

Step 1: Match the joint distribution

Using only single-qubit gates from {RX,RY,RZ,H,X}\{R_X,R_Y,R_Z,H,X\} (no two-qubit gates, at most four gates), prepare a two-qubit state whose computational-basis distribution is

P(00)=38,P(01)=38,P(10)=18,P(11)=18.P(00)=\tfrac38,\quad P(01)=\tfrac38,\quad P(10)=\tfrac18,\quad P(11)=\tfrac18 .

Basis labels are ∣q0q1⟩\lvert q_0q_1\rangle with index k=2q0+q1k=2q_0+q_1: qubit 0 is the leftmost bit. Each probability is graded with absolute tolerance 10−610^{-6}; the grader also checks the equivalent single-qubit expectations ⟨Z⊗I⟩=Pq0(0)−Pq0(1)\langle Z\otimes I\rangle=P_{q_0}(0)-P_{q_0}(1) and ⟨I⊗Z⟩=Pq1(0)−Pq1(1)\langle I\otimes Z\rangle=P_{q_1}(0)-P_{q_1}(1).

  • 2 qubits
  • allowed gates: RX, RY, RZ, H, X
  • at most 4 gates
  • at most 0 two-qubit 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