Editorial
To begin with, we demonstrate the necessary gate operations in the following quantum circuit.

First, we apply a Hadamard () gate to the first qubit.
By applying the Hadamard gate in this way, we can bring the qubit into a superposition state.
Next, we need an operation that transforms to . For this, we can use a controlled- (controlled-X; ) gate with the first qubit as the control and the second qubit as the target. The controlled- gate applies an gate to the second qubit only when the first qubit is in state , acting on in particular.
Finally, by applying an gate to the first qubit, we arrive at the solution.
Sample Code
Below is a sample program:
from qiskit import QuantumCircuit
def solve() -> QuantumCircuit:
qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)
qc.x(0)
return qc
Supplementary Information
- Measuring either qubit in the 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 .