QuantumCore

Hands-on lab · 1 step

Prepare a Bloch state with R_Y and R_Z

Use the identity RZ(ϕ)RY(θ)∣0⟩=e−iϕ/2(cos⁡θ2∣0⟩+eiϕsin⁡θ2∣1⟩)R_Z(\phi)R_Y(\theta)\lvert0\rangle=e^{-i\phi/2}\big(\cos\tfrac\theta2\lvert0\rangle+e^{i\phi}\sin\tfrac\theta2\lvert1\rangle\big) to prepare the state with Bloch angles θ=2π3\theta=\tfrac{2\pi}3, ϕ=π4\phi=\tfrac\pi4 from ∣0⟩\lvert0\rangle with at most two rotation gates.

0/1 step passedBest score 0/100

Step 1: Prepare θ = 2π/3, φ = π/4

Starting from ∣0⟩\lvert0\rangle, prepare the state with Bloch angles θ=2π3\theta=\tfrac{2\pi}3 and ϕ=π4\phi=\tfrac\pi4, that is ∣ψ⟩=cos⁡π3∣0⟩+eiπ/4sin⁡π3∣1⟩=12∣0⟩+32eiπ/4∣1⟩\lvert\psi\rangle=\cos\tfrac\pi3\lvert0\rangle+e^{i\pi/4}\sin\tfrac\pi3\lvert1\rangle=\tfrac12\lvert0\rangle+\tfrac{\sqrt3}2e^{i\pi/4}\lvert1\rangle, using only the gates RY(θ)=(cos⁡θ2−sin⁡θ2sin⁡θ2cos⁡θ2)R_Y(\theta)=\begin{pmatrix}\cos\frac\theta2&-\sin\frac\theta2\\\sin\frac\theta2&\cos\frac\theta2\end{pmatrix} and RZ(ϕ)=diag(e−iϕ/2,eiϕ/2)R_Z(\phi)=\mathrm{diag}(e^{-i\phi/2},e^{i\phi/2}), at most two gates in total. A global phase is allowed: the check measures the fidelity ∣⟨ψ∣χ⟩∣2\lvert\langle\psi\vert\chi\rangle\rvert^2.

  • 1 qubit
  • allowed gates: RY, RZ
  • at most 2 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 circuitq0
Statevector amplitudes
BasisAmplitude α|α|Phase arg αProbability
|0⟩1
1.0000
0
100.00%
1 basis state with zero amplitude hidden