B: Generate Minus state

Time Limit: 3 sec

Memory Limit: 512 MiB

Score: 200

Writer: admin

Editorial

By applying an XX gate to a qubit followed by a Hadamard (HH) gate, the zero state is transformed into the minus state:

0X(0)1H(0)12(01)=\begin{align} \ket{0} &\xrightarrow{X(0)} \ket{1} \nonumber\\ &\xrightarrow{H(0)} \frac{1}{\sqrt{2}} (\ket{0} - \ket{1}) = \ket{-} \end{align}

Since the observation probability is given by the squared absolute value of its probability amplitudes, measuring the qubit results in observing the computational basis states 0\ket{0} and 1\ket{1} with equal probabilities 1/21/2 each.

Such states in a probabilistic superposition are one of the unique properties of quantum computers that do not exist in classical computers.

Sample Code

Below is a sample code:

from qiskit import QuantumCircuit
 
 
def solve() -> QuantumCircuit:
    qc = QuantumCircuit(1)
 
    qc.x(0)
    qc.h(0)
 
    return qc

Supplements

  • There are many types of quantum gates besides the XX gate and the Hadamard gate that we use in this contest. Understanding the meaning and function of each quantum gate can be helpful in solving future problems: