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 () gate, a fundamental quantum gate:
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 and with equal probabilities 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: