A1: Generate Plus state

Time Limit: 3 sec

Memory Limit: 512 MiB

Score: 100

Writer: admin

Editorial

Quantum computers use the concept of "quantum gates" to manipulate the state of qubits.

In this problem, you can transition from the zero state to the plus state using the Hadamard (HH) gate, a fundamental quantum gate:

0H(0)12(0+1)\begin{equation} \ket{0} \xrightarrow{H(0)} \frac{1}{\sqrt{2}} (\ket{0} + \ket{1}) \end{equation}

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

Such a probabilistic superposition state is one of the unique properties of quantum computers that does not exist in classical computers.

Sample Code

Below is a sample program:

from qiskit import QuantumCircuit
 
 
def solve() -> QuantumCircuit:
    qc = QuantumCircuit(1)
    
    # Apply Hadamard gate to the 1st qubit (index 0)
    qc.h(0)
 
    return qc

Alternatively, the quantum gate can be applied using a slightly different syntax:

from qiskit import QuantumCircuit
from qiskit.circuit.library import HGate
 
 
def solve() -> QuantumCircuit:
    qc = QuantumCircuit(1)
 
    qc.append(HGate(), [0])
 
    return qc

Supplementary Information

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