Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Pauli X flips the computational-basis states and rotates a qubit 180° around the Bloch sphere’s x axis. Pauli Z leaves the basis labels in place, changes the sign of the |1⟩ amplitude, and rotates 180° around the z axis. For a general superposition, X exchanges the two amplitudes; Z changes their relative sign. That distinction is why X is called a bit flip and Z a phase flip.

Start with a general qubit

A pure qubit can be written as |ψ⟩ = α|0⟩ + β|1⟩, where α and β are complex amplitudes and |α|² + |β|² = 1. The Pauli gates are represented by these matrices:

Gate Matrix Effect on |ψ⟩
X [[0, 1], [1, 0]] β|0⟩ + α|1⟩
Z [[1, 0], [0, −1]] α|0⟩ − β|1⟩

The formulas show the essential difference: X swaps which basis state carries each amplitude, while Z preserves the basis labels and negates the |1⟩ amplitude. The matrices and gate descriptions are documented in IBM Quantum Learning’s “Bits, gates, and circuits” and the Qiskit ZGate reference.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What does the X gate do to a qubit?

Applying X gives X|ψ⟩ = β|0⟩ + α|1⟩. On the computational-basis states, it swaps |0⟩ and |1⟩:

  • X|0⟩ = |1⟩
  • X|1⟩ = |0⟩

This basis-state action is analogous to a classical NOT operation, so X is often called a bit flip. On the Bloch sphere, X is a π-radian (180°) rotation around the x axis. The corresponding Bloch-vector transformation is (x, y, z) → (x, −y, −z): the x coordinate stays fixed, while y and z reverse sign.

“Bit flip” is shorthand for what X does to the computational-basis states, not a claim that every superposition becomes a classical bit. For an arbitrary qubit, X exchanges α and β, and the result may still be a superposition.

What does the Z gate do to a qubit?

Applying Z gives Z|ψ⟩ = α|0⟩ − β|1⟩. It leaves |0⟩ unchanged and multiplies |1⟩ by −1:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Z|0⟩ = |0⟩
  • Z|1⟩ = −|1⟩

This is called a phase flip: for a superposition, the sign change alters the relative phase between the |0⟩ and |1⟩ components rather than swapping them. Z is a π-radian (180°) rotation around the z axis, mapping a Bloch vector (x, y, z) to (−x, −y, z). The z coordinate remains fixed; x and y reverse sign. See the Qiskit ZGate reference for the matrix, phase-flip description, and rotation convention.

How the rotations appear on the Bloch sphere

A Bloch-sphere point represents a pure-qubit state up to an overall, or global, phase. The computational basis is aligned with the z axis: |0⟩ is the north pole and |1⟩ is the south pole. Consequently, a half-turn around x exchanges the poles, while a half-turn around z leaves both pole locations fixed.

That does not mean Z has no effect on the state vector |1⟩: it changes |1⟩ to −|1⟩. For |1⟩ alone, this is only a global phase and does not change its physical state. When |0⟩ and |1⟩ amplitudes coexist, however, changing the sign of just one component changes the relative phase and can change later interference or measurement outcomes. IBM’s lesson describes measurement along z and uses |+⟩ as an equal superposition: IBM Quantum Learning, “Lesson 02: Bits, gates, and circuits”.

A quick example: X and Z on |+⟩

Let |+⟩ = (|0⟩ + |1⟩)/√2, an equal superposition. Then:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • X|+⟩ = |+⟩: exchanging two equal amplitudes leaves the state unchanged.
  • Z|+⟩ = |−⟩ = (|0⟩ − |1⟩)/√2: the |1⟩ amplitude changes sign.

|+⟩ and |−⟩ have the same probabilities when measured in the computational basis, but their relative phases differ. The states occupy opposite points on the Bloch sphere’s equator, illustrating how Z can change a qubit without changing its immediate computational-basis probabilities.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

X versus Z at a glance

Property Pauli X Pauli Z
Matrix [[0, 1], [1, 0]] [[1, 0], [0, −1]]
Basis-state action |0⟩ ↔ |1⟩ |0⟩ → |0⟩; |1⟩ → −|1⟩
Bloch-sphere rotation 180° around x 180° around z
Bloch-vector map (x, y, z) → (x, −y, −z) (x, y, z) → (−x, −y, z)
Common name Bit flip Phase flip

Global phase and rotation-gate conventions

Rotation-gate formulas can differ from Pauli matrices by an overall phase. Under the convention documented by Qiskit, RZ(π) = −iZ, not literally Z as a matrix; the factor −i is a global phase and does not change the physical action on an isolated qubit. Qiskit notes the same kind of convention for RX(π) = −iX. Compare physical states up to global phase rather than assuming every named rotation matrix exactly equals its Pauli gate.

Further reading

For a broader treatment of quantum gates and quantum circuits, Cambridge University Press lists Nielsen and Chuang’s Quantum Computation and Quantum Information, 10th Anniversary Edition, published in 2010.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.