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

Time Limit: 3 sec

Memory Limit: 512 MiB

Score: 200

Writer: admin

Editorial

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

First, observe that applying the Hadamard gate to the first (and leftmost) qubit of 00\ket{00} effects the transformation

00H(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, we can apply a controlled-NOT gate (concisely notated as CXCX) upon the plus state, treating the first (leftmost) qubit as the control qubit, and the second (rightmost) qubit as the target qubit. This effects the Pauli XX gate upon the target qubit, flipping its classical bit in all computational basis states where the control qubit has classical bit 11. Basis state 00\ket{00} is unmodified, but state 10\ket{10} becomes 11\ket{11}.

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(control qubit, target qubit)
    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}.