The X gate is a single-qubit bit flip: it exchanges the computational-basis states |0⟩ and |1⟩. Applied to |0⟩, it produces |1⟩; applied to |1⟩, it produces |0⟩. section 5.1.1
A direct measurement makes the X gate operationally useful for distinguishing it from gates with different effects. Applying an unknown gate to |0⟩ yields |1⟩ for X and |0⟩ for Z, so computational-basis outcomes identify the candidate. section 5.1.1
Quantum experiments use the X gate in several related ways:
- Flip a basis state directly before measurement. section 5.1.1
- Normalize measurement conventions in Qiskit when circuit outcomes must encode which unitary was supplied. section 5.1.2
- Form controlled-X operations, including CNOT, where the target flips only when the control is |1⟩. section 2.3.1
Distinguishing X from Z in Qiskit
Prepare one qubit in |0⟩, append the unknown single-qubit circuit, apply X if the circuit convention requires outcome normalization, and measure. Outcome 0 identifies Z; outcome 1 identifies X. The corresponding Qiskit workflow appends the supplied circuit, applies X, and measures one classical bit. section 5.1.1 section 5.1.2
Figure 5.2 To distinguish two unitaries in one experiment, we need to choose an initial state that can be converted to different orthogonal states by applying each of these two unitaries, possibly as part of a longer sequence of unitaries. We then run the experiment by preparing that initial state, applying that sequence of unitaries, and identifying which of the orthogonal states we got using measurements.
Use the circuit-design figure to trace the general pattern: choose an input state, transform candidate outputs into orthogonal states, then identify the result by measurement. section 5.1.1

