Z-Gate

What You Get Is Not What You See

The Z-gate changes the phase of the state by (or radians) while leaving the state unchanged. This means the amplitude of gains a negative sign, effectively flipping its phase. It's a phase-flip operation that rotates the quantum state vector a half turn around the Z-axis of the Bloch sphere.

by Frank Zickert
November 12, 2025
Z-Gate

What You Get Is Not What You See

When you apply a A quantum gate is a basic operation that changes the state of one or more qubits, similar to how a logic gate operates on bits in classical computing. It uses unitary transformations, meaning it preserves the total probability (the state’s length in complex space). Quantum gates enable superposition and entanglement, allowing quantum computers to perform computations that classical ones cannot efficiently replicate.
Learn more about Quantum Gate
to a A qubit is the basic unit of quantum information, representing a superposition of 0 and 1 states.
Learn more about Quantum Bit
, you expect to see a change when you In quantum computing, measurement is the process of extracting classical information from a quantum state. It collapses a qubit’s superposition into one of its basis states (usually or ), with probabilities determined by the amplitudes of those states. After measurement, the qubit’s state becomes definite, destroying the original superposition.
Learn more about Measurement
it. That is how classical logic works: flip a A bit (short for “binary digit”) is the smallest unit of data in computing, representing a value of either 0 or 1. It’s the fundamental building block of all digital information. Multiple bits combine to form larger units like bytes (8 bits) and encode more complex data such as numbers, text, or images.
Learn more about Binary Digit
see the result.

This post is accompanied by a PDF file summarizing the key points.

Please Login to Download the PDF (your PyQML subscription works here!)

But that's not how Quantum Computing is a different kind of computation that builds upon the phenomena of Quantum Mechanics.
Learn more about Quantum Computing
works. When we look only at what we can measure immediately, we miss the operation that makes Interference in quantum computing refers to the way probability amplitudes of quantum states combine—sometimes reinforcing each other (constructive interference) or canceling out (destructive interference). Quantum algorithms exploit this to amplify the probability of correct answers while suppressing incorrect ones. It’s a key mechanism that gives quantum computers their computational advantage.
Learn more about Interference
possible.

There is one particular A quantum gate is a basic operation that changes the state of one or more qubits, similar to how a logic gate operates on bits in classical computing. It uses unitary transformations, meaning it preserves the total probability (the state’s length in complex space). Quantum gates enable superposition and entanglement, allowing quantum computers to perform computations that classical ones cannot efficiently replicate.
Learn more about Quantum Gate
that perfectly exposes this misconception. On paper, it seems pointless. When you measure after applying it, nothing looks different. Yet this single gate is one of the key tools that gives Quantum Computing is a different kind of computation that builds upon the phenomena of Quantum Mechanics.
Learn more about Quantum Computing
its power. This is the Pauli -Gate.

The Pauli -Gate is a basic A quantum operator is a mathematical object that represents a physical action or measurement on a quantum state. It transforms one quantum state into another, often expressed as a matrix acting on a vector in Hilbert space. In quantum computing, operators correspond to quantum gates, which manipulate qubits according to the rules of linear algebra and quantum mechanics.
Learn more about Quantum Operator
that flips the A **quantum phase** is the angle component of a particle’s wavefunction that determines how its probability amplitude interferes with others. It doesn’t affect observable probabilities directly but becomes crucial when comparing two or more states, as phase differences lead to interference effects. Essentially, it encodes the relative timing or “alignment” of quantum waves.
Learn more about Quantum Phase
of the A qubit is the basic unit of quantum information, representing a superposition of 0 and 1 states.
Learn more about Quantum Bit
is a basis state.
Learn more about
In quantum computing an amplitude is a complex number that describes the weight of a basis state in a quantum superposition. The squared magnitude of an amplitude gives the probability of measuring that basis state. Amplitudes can interfere, this means adding or canceling, allowing quantum algorithms to bias outcomes toward correct solutions.
Learn more about Amplitude
while leaving the is a basis state.
Learn more about
In quantum computing an amplitude is a complex number that describes the weight of a basis state in a quantum superposition. The squared magnitude of an amplitude gives the probability of measuring that basis state. Amplitudes can interfere, this means adding or canceling, allowing quantum algorithms to bias outcomes toward correct solutions.
Learn more about Amplitude
unchanged. Mathematically, it multiplies is a basis state.
Learn more about
by as depicted in ?.

Figure 1 The Pauli-Z operator

So, apparently, the -Gate is not supposed to have an effect on a A qubit is the basic unit of quantum information, representing a superposition of 0 and 1 states.
Learn more about Quantum Bit
in state is a basis state.
Learn more about
. And it doesn't as depicted in ?. Of course, it doesn't. It only adds a minus sign to the is a basis state.
Learn more about
component of the A qubit is the basic unit of quantum information, representing a superposition of 0 and 1 states.
Learn more about Quantum Bit
. But that is . And .

Figure 2 The effect of the Z operator in state |0>

Need some proof?

Take the definition of the -Gate and is a basis state.
Learn more about
:

Applying a A quantum operator is a mathematical object that represents a physical action or measurement on a quantum state. It transforms one quantum state into another, often expressed as a matrix acting on a vector in Hilbert space. In quantum computing, operators correspond to quantum gates, which manipulate qubits according to the rules of linear algebra and quantum mechanics.
Learn more about Quantum Operator
on a A quantum state is the complete mathematical description of a quantum system, containing all the information needed to predict measurement outcomes. It’s usually represented by a wavefunction or a state vector in a Hilbert space. The state defines probabilities, not certainties, for observable quantities like position, momentum, or spin.
Learn more about Quantum State
means multiplying the operator matrix with the state vector:

Anyone can just write that down.

I have a (classical) computer to do that for me!

? compares the A quantum state is the complete mathematical description of a quantum system, containing all the information needed to predict measurement outcomes. It’s usually represented by a wavefunction or a state vector in a Hilbert space. The state defines probabilities, not certainties, for observable quantities like position, momentum, or spin.
Learn more about Quantum State
is a basis state.
Learn more about
and

z_gate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from numpy import allclose
from qiskit import QuantumCircuit
from qiskit.circuit.library import ZGate
from qiskit.quantum_info import Statevector
 
# start with one qubit in |0>
qc = QuantumCircuit(1)
 
# store the statevector of |0>
sv0 = Statevector.from_instruction(qc)
 
# apply Z to |0>
qc.z(0)
 
# store the statevector of Z|0>
svZ0 = Statevector.from_instruction(qc)
 
print(f"|0>: {sv0}")
print(f"Z|0>: {svZ0}")
print("|0> == Z|0> ?", allclose(sv0, svZ0))
Listing 1 Comparing |0> and Z|0>
    In this code listing, we
  1. a A quantum circuit is a sequence of quantum gates applied to qubits, representing the operations in a quantum computation. Each gate changes the qubits’ state using quantum mechanics principles like superposition and entanglement. The final qubit states, when measured, yield the circuit’s computational result probabilistically.
    Learn more about Quantum Circuit
    with a single Qubit in state is a basis state.
    Learn more about
    .
  2. the statevector of is a basis state.
    Learn more about
  3. the The Z-gate changes the phase of the state by (or radians) while leaving the state unchanged. This means the amplitude of gains a negative sign, effectively flipping its phase. It's a phase-flip operation that rotates the quantum state vector a half turn around the Z-axis of the Bloch sphere.
    Learn more about Z-Gate
  4. the statevector of

? shows the output.

1
2
3
|0>: Statevector([1.+0.j, 0.+0.j], dims=(2,))
Z|0>: Statevector([1.+0.j, 0.+0.j], dims=(2,))
|0> == Z|0> ? True
Listing 2 Output of comparing |0> and Z|0>

As we can easily see, they're the same.

OK. It doesn't change because the In quantum computing an amplitude is a complex number that describes the weight of a basis state in a quantum superposition. The squared magnitude of an amplitude gives the probability of measuring that basis state. Amplitudes can interfere, this means adding or canceling, allowing quantum algorithms to bias outcomes toward correct solutions.
Learn more about Amplitude
of is a basis state.
Learn more about
is and . So, to see what really happens, we need to test the -Gate on is a basis state.
Learn more about
instead of is a basis state.
Learn more about
.

But things don't even change when the A qubit is the basic unit of quantum information, representing a superposition of 0 and 1 states.
Learn more about Quantum Bit
is in state is a basis state.
Learn more about
.

Take the definition of the -Gate again and multiply it by is a basis state.
Learn more about
:

Wait! That is different. Here, the -Gate turns is a basis state.
Learn more about
into .

However, applying the -Gate on is a basis state.
Learn more about
introduces what’s called a A global phase is a complex phase factor (like multiplying the whole quantum state by ) that changes how the state looks mathematically but not how it behaves physically. Since measurement probabilities depend only on relative phases between components, a global phase has no observable effect. So, the global phase doesn't change outcomes. It's physically meaningless and can be ignored.
Learn more about Global Phase
of . In Quantum mechanics is the branch of physics that describes the behavior of matter and energy at atomic and subatomic scales.
Learn more about Quantum Mechanics
multiplying an entire A quantum state is the complete mathematical description of a quantum system, containing all the information needed to predict measurement outcomes. It’s usually represented by a wavefunction or a state vector in a Hilbert space. The state defines probabilities, not certainties, for observable quantities like position, momentum, or spin.
Learn more about Quantum State
by a constant A **quantum phase** is the angle component of a particle’s wavefunction that determines how its probability amplitude interferes with others. It doesn’t affect observable probabilities directly but becomes crucial when comparing two or more states, as phase differences lead to interference effects. Essentially, it encodes the relative timing or “alignment” of quantum waves.
Learn more about Quantum Phase
, such as , does not change anything you can In quantum computing, measurement is the process of extracting classical information from a quantum state. It collapses a qubit’s superposition into one of its basis states (usually or ), with probabilities determined by the amplitudes of those states. After measurement, the qubit’s state becomes definite, destroying the original superposition.
Learn more about Measurement
.

And here's why. Probabilities in Quantum mechanics is the branch of physics that describes the behavior of matter and energy at atomic and subatomic scales.
Learn more about Quantum Mechanics
depend on the squared magnitude of the A quantum state is the complete mathematical description of a quantum system, containing all the information needed to predict measurement outcomes. It’s usually represented by a wavefunction or a state vector in a Hilbert space. The state defines probabilities, not certainties, for observable quantities like position, momentum, or spin.
Learn more about Quantum State
In quantum computing an amplitude is a complex number that describes the weight of a basis state in a quantum superposition. The squared magnitude of an amplitude gives the probability of measuring that basis state. Amplitudes can interfere, this means adding or canceling, allowing quantum algorithms to bias outcomes toward correct solutions.
Learn more about Amplitude
If every In quantum computing an amplitude is a complex number that describes the weight of a basis state in a quantum superposition. The squared magnitude of an amplitude gives the probability of measuring that basis state. Amplitudes can interfere, this means adding or canceling, allowing quantum algorithms to bias outcomes toward correct solutions.
Learn more about Amplitude
is multiplied by the same phase factor, the magnitudes remain the same.

That’s equivalent to rotating the A qubit is the basic unit of quantum information, representing a superposition of 0 and 1 states.
Learn more about Quantum Bit
overall phase by . But because this A **quantum phase** is the angle component of a particle’s wavefunction that determines how its probability amplitude interferes with others. It doesn’t affect observable probabilities directly but becomes crucial when comparing two or more states, as phase differences lead to interference effects. Essentially, it encodes the relative timing or “alignment” of quantum waves.
Learn more about Quantum Phase
applies equally to the whole A quantum state vector is a mathematical object (usually denoted |ψ⟩) that fully describes the state of a quantum system. Its components give the probability amplitudes for finding the system in each possible basis state. The squared magnitude of each component gives the probability of measuring that corresponding outcome.
Learn more about Quantum State Vector
it has no observable effect. There is no change in In quantum computing, measurement is the process of extracting classical information from a quantum state. It collapses a qubit’s superposition into one of its basis states (usually or ), with probabilities determined by the amplitudes of those states. After measurement, the qubit’s state becomes definite, destroying the original superposition.
Learn more about Measurement
probabilities or Interference in quantum computing refers to the way probability amplitudes of quantum states combine—sometimes reinforcing each other (constructive interference) or canceling out (destructive interference). Quantum algorithms exploit this to amplify the probability of correct answers while suppressing incorrect ones. It’s a key mechanism that gives quantum computers their computational advantage.
Learn more about Interference
patterns if this A qubit is the basic unit of quantum information, representing a superposition of 0 and 1 states.
Learn more about Quantum Bit
is isolated.

Geometrically, ? shows that the vector doesn't effectively change.

Figure 3 The effect of the Z operator in state |1>

The -Gate turns the A quantum state vector is a mathematical object (usually denoted |ψ⟩) that fully describes the state of a quantum system. Its components give the probability amplitudes for finding the system in each possible basis state. The squared magnitude of each component gives the probability of measuring that corresponding outcome.
Learn more about Quantum State Vector
around the axis of the The Bloch sphere is a geometric representation of a single qubit’s quantum state as a point on or inside a unit sphere. The north and south poles represent the classical states |0⟩ and |1⟩, while any other point corresponds to a superposition of them. Its position encodes the qubit’s relative phase and probability amplitudes, making it a visual tool for understanding quantum state evolution.
Learn more about Bloch Sphere
. But since the A quantum state vector is a mathematical object (usually denoted |ψ⟩) that fully describes the state of a quantum system. Its components give the probability amplitudes for finding the system in each possible basis state. The squared magnitude of each component gives the probability of measuring that corresponding outcome.
Learn more about Quantum State Vector
of is a basis state.
Learn more about
lies on that axis, we can turn it as much as we want without actually changing it.


Finally, when "Nothing Happens"

What else can we try? How about a A qubit is the basic unit of quantum information, representing a superposition of 0 and 1 states.
Learn more about Quantum Bit
in Superposition in quantum computing means a quantum bit (qubit) can exist in multiple states (0 and 1) at the same time, rather than being limited to one like a classical bit. Mathematically, it’s a linear combination of basis states with complex probability amplitudes. This allows quantum computers to process many possible inputs simultaneously, enabling exponential speedups for certain problems.
Learn more about Superposition
. That means, a A qubit is the basic unit of quantum information, representing a superposition of 0 and 1 states.
Learn more about Quantum Bit
in a A basis state in quantum computing is one of the fundamental states that form the building blocks of a quantum system’s state space. For a single qubit, the basis states are and ; any other qubit state is a superposition of these. In systems with multiple qubits, basis states are all possible combinations of s and s (e.g., , , , and ), forming an orthonormal basis for the system’s Hilbert space.
Learn more about Basis State
of the The Fourier basis is a set of sine and cosine functions that can represent any periodic signal as a weighted sum of these functions. Each basis function corresponds to a specific frequency, capturing how much of that frequency is present in the signal. In essence, it’s the coordinate system for expressing signals in terms of their frequency components instead of time.
Learn more about Fourier Basis
, such as .

Join to continue

This part is available to PyQML students and above. Log in or start a subscription to unlock member content.

Already a member? Use Log in. New here? Choose Subscribe.