Launch the interactive walkthrough to discover each component, including the 3D Q-Sphere Lab & Python in Colab.
Master the phase-flip gate: leaving |0> unchanged while multiplying |1> by -1, rotating 180 degrees around the Z-axis.
Interactive 3D state vector exploration, unitary transformation gates, and Born rule collapse for Topic 6.6
| Symbol / Term | Meaning | Beginner Interpretation |
|---|---|---|
| Pauli-Z matrix | Diagonal phase-inversion operator [[1, 0], [0, -1]] | |
| Zero invariance | Basis state 0 experiences zero phase shift | |
| Phase flip on 1 | Basis state 1 is multiplied by -1 (180-degree phase shift) | |
| Superposition phase toggle | Transforms into |
Applying Pauli-Z to equal superposition state |+β© = [1/β2, 1/β2]^T:
Result: Probabilities remain 50/50, but the internal quantum phase is flipped from + to -, ready for interference.
Leaves |0> amplitude unchanged (multiplies by +1).
Multiplies |1> amplitude by -1.
Rotates equator coordinates by 180 degrees around vertical Z-axis.
Problem: Marking the winning item in an unsorted database without destroying the superposition.
Solution: The Grover Oracle applies a controlled-Z gate that flips the phase of the winning solution to negative: -|winner>.
Interactive activity component
Demonstrate the quantum phase-flip gate: show that Z leaves |0> unaffected while flipping the relative phase of |1> to -|1>.
For Google Colab or Jupyter notebooks, run this shell command to install the required dependencies:
!pip install qiskit1 from qiskit import QuantumCircuit 2 from qiskit.quantum_info import Statevector
from qiskit import QuantumCircuit β Circuit module
from qiskit.quantum_info import Statevector β Statevector module
1 # 1. Action on Basis States: Z|0> = |0>, Z|1> = -|1> 2 qc_basis = QuantumCircuit(1) 3 qc_basis.z(0) # Z on |0> 4 print('Z on |0> -> Leaves state unchanged:', Statevector.from_instruction(qc_basis).data.round(2)) 5 6 # 2. Action on Superposition: Z|+> = |-> 7 qc_super = QuantumCircuit(1) 8 qc_super.h(0) # Create |+> = (|0> + |1>)/sqrt(2) 9 print('Before Z (State |+>):', Statevector.from_instruction(qc_super).data.round(3)) 10 qc_super.z(0) # Apply Z -> transforms to |-> = (|0> - |1>)/sqrt(2) 11 sv_minus = Statevector.from_instruction(qc_super) 12 print('After Z (State |->):', sv_minus.data.round(3)) 13 print('Notice: Probabilities for both |+> and |-> are 50/50, but relative phase is flipped!')
# 1. Action on Basis States: Z|0> = |0>, Z|1> = -|1>
Basis action
qc_basis = QuantumCircuit(1)
Init |0>
qc_basis.z(0) # Z on |0>
Apply Z to 0
print('Z on |0> -> Leaves state unchanged:', Statevector.from_instruction(qc_basis).data.round(2))
Result [1, 0]
# 2. Action on Superposition: Z|+> = |->
Superposition action
qc_super = QuantumCircuit(1)
Init qubit
qc_super.h(0) # Create |+> = (|0> + |1>)/sqrt(2)
Put in |+>
print('Before Z (State |+>):', Statevector.from_instruction(qc_super).data.round(3))
[0.707, 0.707]
qc_super.z(0) # Apply Z -> transforms to |-> = (|0> - |1>)/sqrt(2)
Apply Z
sv_minus = Statevector.from_instruction(qc_super)
Extract state
print('After Z (State |->):', sv_minus.data.round(3))
[0.707, -0.707]
print('Notice: Probabilities for both |+> and |-> are 50/50, but relative phase is flipped!')
Phase insight
Click "Copy for Colab", open Google Colab, paste into a single cell, and run.
1 # ========================================================= 2 # Simulating the Pauli-Z Phase-Flip Gate in Qiskit 3 # Prepared for Google Colab (Run with Shift + Enter) 4 # ========================================================= 5 6 # Step 1: Install required packages 7 !pip install qiskit 8 9 # Step 2: Import libraries 10 from qiskit import QuantumCircuit 11 from qiskit.quantum_info import Statevector 12 13 # Step 3: Run Demonstration 14 # 1. Action on Basis States: Z|0> = |0>, Z|1> = -|1> 15 qc_basis = QuantumCircuit(1) 16 qc_basis.z(0) # Z on |0> 17 print('Z on |0> -> Leaves state unchanged:', Statevector.from_instruction(qc_basis).data.round(2)) 18 19 # 2. Action on Superposition: Z|+> = |-> 20 qc_super = QuantumCircuit(1) 21 qc_super.h(0) # Create |+> = (|0> + |1>)/sqrt(2) 22 print('Before Z (State |+>):', Statevector.from_instruction(qc_super).data.round(3)) 23 qc_super.z(0) # Apply Z -> transforms to |-> = (|0> - |1>)/sqrt(2) 24 sv_minus = Statevector.from_instruction(qc_super) 25 print('After Z (State |->):', sv_minus.data.round(3)) 26 print('Notice: Probabilities for both |+> and |-> are 50/50, but relative phase is flipped!')
Verify that basis state |0> is an eigenstate with eigenvalue +1.
Verify that relative phase flips, transforming |+> into |-> with eigenvalue -1 on the |1> component.
Observe that measurement probabilities remain 50/50, demonstrating phase sensitivity.
Quantum circuits applying Z to |0> and |+>.
Z on |0> -> [1.0, 0.0] Before Z (|+>): [0.707, 0.707] After Z (|->): [0.707, -0.707]
The Pauli-Z gate has no classical equivalent: it leaves classical probabilities unchanged while altering the relative quantum phase that drives wave interference in quantum algorithms.
Hadamard, CNOT, Bell-state intuition, and correlated quantum circuits.
Test your understanding with these questions. Remember, this is for learning, not examination!