A3: Generate state 12(∣0⟩+∣3⟩)\frac{1}{\sqrt{2}} (\ket{0} + \ket{3})

Time Limit: 3 seconds

Memory Limit: 512 MiB

Score: 200 points

Writer:admin

Editorial

The objective is to prepare a uniform superposition state of the two computational basis states ∣0⟩\ket{0} and ∣3⟩\ket{3}.

First, apply a Hadamard gate to the 11st qubit:

∣00⟩→H(0)12(∣00⟩+∣10⟩)\begin{equation} \ket{00} \xrightarrow{H(0)} \frac{1}{\sqrt{2}} (\ket{00} + \ket{10}) \end{equation}

Since the target state is 12(∣00⟩+∣11⟩)\frac{1}{\sqrt{2}} (\ket{00} + \ket{11}), our goal is achieved if we can somehow transition the computational basis state ∣10⟩\ket{10} in Equation (1)(1) to ∣11⟩\ket{11}.

Such a transition is achieved by using a controlled gate. These can apply a quantum gate upon only the desired computational basis state(s) in the superposition state.

The controlled gate operates upon two qubits. One is called the "control qubit" and the other is the "target qubit". The controlled gate modifies the state of the target qubit only when the control qubit is in state ∣1⟩\ket{1}, but does nothing if it is ∣0⟩\ket{0}.

In this problem, apply a controlled XX (controlled-X; CXCX) gate with the 11st qubit as the control qubit and the 22nd as the target qubit. The XX gate flips the target qubit only in the computational basis state ∣10⟩\ket{10}, where the 11st qubit is ∣1⟩\ket{1}.

12(∣00⟩+∣10⟩)→CX(0,1)12(∣00⟩+∣11⟩)\begin{equation} \frac{1}{\sqrt{2}} (\ket{00} + \ket{10}) \xrightarrow{CX(0, 1)} \frac{1}{\sqrt{2}} (\ket{00} + \ket{11}) \end{equation}

Sample Code

Below is a sample program:

from qiskit import QuantumCircuit
 
 
def solve() -> QuantumCircuit:
    qc = QuantumCircuit(2)
 
    qc.h(0)
    # qc.cx(制御ビットのインデックス, 標的ビットのインデックス)
    qc.cx(0, 1)
 
    return qc

Supplementary Information

  • The state 12(∣00⟩+∣11⟩)\frac{1}{\sqrt{2}} (\ket{00} + \ket{11}) is known as the Bell state.
  • Measuring either qubit in the Bell state will determine the outcome of the other qubit. This phenomenon is known as quantum entanglement.
  • The controlled gate can be generalized to the multi-controlled gate which operates upon multiple control qubits. This modifies computational basis states wherein all control qubits are in the state ∣1⟩\ket{1}.