Editorial
In problem A1, we addressed the inversion of the global phase.
Now, how can we prepare a state with a different phase between two computational basis states?

First, prepare without considering the phase. Apply the Hadamard () gate to the st qubit.
By applying the Hadamard gate, we can create a superposition state of qubits.
Next, we need to transform to . To do this, we use the controlled () gate, with the st qubit as the control qubit and the nd qubit as the target qubit. This controlled gate applies the gate to the nd qubit only in , where the st qubit is .
Finally, apply a gate to the st qubit of to transform into .
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.z(0)
return qcSupplementary 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 .