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, apply the Hadamard () gate to the first 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-X (CX) gate, with the first qubit as the control bit and the second qubit as the target bit. The gate only applies the gate to the target bit when the control bit is .
Finally, to invert the phase of the state and create , apply a gate to the second qubit.
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 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 .