How do I measure a qubit in the x or y basis?
Rotate the basis before a computational measurement: H then measure for x; S† then H then measure for y.
Hardware and simulators usually measure only in the computational ($z$) basis. To measure in another basis, we apply a gate that maps that basis to the computational basis and then measure:
- The $x$ basis: $H$ maps $|+\rangle\to|0\rangle$ and $|-\rangle\to|1\rangle$; so outcome 0 means “+”.
- The $y$ basis: $S^\dagger$ then $H$ map $|{+i}\rangle\to|0\rangle$ and $|{-i}\rangle\to|1\rangle$.
Example: the state $|+\rangle$ gives 0 or 1 equally in the $z$ basis, but always gives 0 in the $x$ basis. In the lab's measurement module, choose the basis (z, x or y) and the appropriate rotation is added automatically. This rotation is also what is used to estimate the expectation values of Pauli strings such as $\langle X\rangle$ and $\langle Y\rangle$.
Related topics
References
- Michael A. Nielsen; Isaac L. Chuang (2010). Quantum Computation and Quantum Information (10th Anniversary Edition). Cambridge University Press doi:10.1017/CBO9780511976667The standard reference for quantum computing; the Crossref record gives 2012 for the Cambridge Core online edition.
- Microsoft (2025). Pauli Measurements in Quantum Computing. Azure Quantum documentation learn.microsoft.com
