First time studying this topic?

Launch the interactive walkthrough to discover each component, including the 3D Q-Sphere Lab & Python in Colab.

Topic 6.4

The Pauli-X Gate: The Quantum NOT Gate

Master the fundamental bit-flip gate: matrix formulation, 180-degree rotation around the X-axis of the Bloch sphere, and code execution.

Learning Objectives

  • βœ“Define the Pauli-X matrix: [[0, 1], [1, 0]]
  • βœ“Demonstrate bit-flip action: X|0> = |1> and X|1> = |0>
  • βœ“Visualize the 180-degree rotation around the X-axis on the Bloch Sphere

πŸ“–Let's Begin with a Story

In classical computers, the simplest gate is the NOT gate (the inverter): 0 becomes 1, and 1 becomes 0. In quantum computing, its direct analog is named after Austrian theoretical physicist Wolfgang Pauli: the Pauli-X Gate. When you pass a qubit through an X gate: - If it was at the North Pole (∣0⟩|0\rangle), it flips to the South Pole (∣1⟩|1\rangle). - If it was at the South Pole (∣1⟩|1\rangle), it flips to the North Pole (∣0⟩|0\rangle). On the Bloch sphere, this corresponds to spinning the entire globe 180 degrees (Ο€\pi radians) around the horizontal X-axis!

Why Should You Learn The Pauli-X Gate: The Quantum NOT Gate?

🎯 Practical & Engineering Stakes

The foundational bit-flip operator

The X gate is the universal initialization and state-flipping tool used across virtually all quantum algorithms to prepare excited states, construct ancilla qubits, and implement conditional logic.

What Is It?

Simple Explanation

The Pauli-X gate is the Quantum NOT gate: - X flips ∣0⟩|0\rangle into ∣1⟩|1\rangle. - X flips ∣1⟩|1\rangle into ∣0⟩|0\rangle. - If you apply X twice in a row, it flips it back to where it started (Xβ‹…X=IX \cdot X = I)!

Technical Explanation

The Pauli-X operator Οƒx∈C2Γ—2\sigma_x \in \mathbb{C}^{2 \times 2} is represented in the computational basis by the Hermitian and unitary matrix: X=(0110)X = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix} It acts as a bit-flip operator: X∣x⟩=∣xβŠ•1⟩X|x\rangle = |x \oplus 1\rangle for x∈{0,1}x \in \{0, 1\}. Geometrically, it generates the rotation group element Rx(Ο€)=βˆ’iXR_x(\pi) = -iX corresponding to a Ο€\pi-radian rotation about the x^\hat{x} axis of the Bloch sphere.

πŸ“š Key Terms

Pauli-X Gate

Simple: The quantum NOT gate that flips 0 to 1 and 1 to 0.
Technical: The Οƒx\sigma_x Pauli matrix operating as a bit-flip transformation with eigenvalues +1+1 and βˆ’1-1.

Eigenstates of X (|+> and |->)

Simple: Special states that don’t flip when hit with an X gate, only changing by a plus or minus sign.
Technical: The vectors ∣+⟩=∣0⟩+∣1⟩2|+\rangle = \frac{|0\rangle+|1\rangle}{\sqrt{2}} (eigenvalue +1+1) and βˆ£βˆ’βŸ©=∣0βŸ©βˆ’βˆ£1⟩2|-\rangle = \frac{|0\rangle-|1\rangle}{\sqrt{2}} (eigenvalue βˆ’1-1).

Q-Sphere Lab: The Pauli-X Gate: The Quantum NOT Gate

IBM Q-Sphere Model

Interactive 3D state vector exploration, unitary transformation gates, and Born rule collapse for Topic 6.4

Azimuth: 45Β°Elevation: 25Β°
+Z |0⟩-Z |1⟩+X |+⟩+Y |+i⟩01|ψ⟩
Q-Sphere Phase Color:
0 Ο€/2 Ο€ 3Ο€/2

Quantum Statevector

dim(H) = 2
|ψ⟩ = (1.000 + 0.000i)|0⟩
     + (0.000 + 0.000i)|1⟩
Polar Angle (ΞΈ):0.0Β° (0.000Ο€ rad)
Phase Angle (Ο•):0.0Β° (0.000Ο€ rad)

Born Rule Probabilities: P(x) = |⟨x|ψ⟩|²Σ P = 1.00

P(|0⟩) = |α|²100.0%
P(|1⟩) = |β|²0.0%
Quantum Measurement

Apply Single-Qubit Unitary Gates

Presets:
Continuous Polar Angle θ (0° = |0⟩, 180° = |1⟩):0.0°
Continuous Phase Angle Ο• (0Β° to 360Β°):0.0Β°
Recent Operations Log:
#1Initial state: |0⟩

πŸ“ Mathematical Foundation

LaTeX KaTeX
X=(0110),X∣0⟩=∣1⟩,X∣1⟩=∣0⟩,X2=IX = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}, \quad X |0\rangle = |1\rangle, \quad X |1\rangle = |0\rangle, \quad X^2 = I

What does it mean?

The Pauli-X Quantum NOT Gate: Acts as a 180-degree rotation around the X-axis of the Bloch sphere. It swaps the probability amplitudes of ∣0⟩|0\rangle and ∣1⟩|1\rangle. Applying the X gate twice (X² = X · X = I) returns the qubit back to its original state.

Understanding the Symbols

Symbol / TermMeaningBeginner Interpretation
XXPauli-X matrixThe quantum bit-flip operator [[0, 1], [1, 0]]
X∣0⟩=∣1⟩X |0\rangle = |1\rangleBit-flip on ground stateTransforms standard 0 into standard 1
X∣1⟩=∣0⟩X |1\rangle = |0\rangleBit-flip on excited stateTransforms standard 1 into standard 0
X2=IX^2 = ISelf-inverse propertyApplying NOT twice flips back to original (NOT NOT = no change)

πŸ“Š Numerical Example

Applying Pauli-X to superposition state |ψ⟩ = 0.6|0⟩ + 0.8|1⟩:

Step 1: Write state as vector: ∣ψ⟩|\psi\rangle = [0.6, 0.8]^T Step 2: Multiply by X matrix: X ∣ψ⟩|\psi\rangle = [[0, 1], [1, 0]] Γ— [0.6, 0.8]^T = [(0 Γ— 0.6 + 1 Γ— 0.8), (1 Γ— 0.6 + 0 Γ— 0.8)]^T = [0.8, 0.6]^T = 0.8∣0⟩|0\rangle + 0.6∣1⟩|1\rangle Step 3: Check probabilities: Before: P(0) = 36%, P(1) = 64% After: P(0) = 64%, P(1) = 36% (Swapped!) Step 4: Check self-inverse: X(X ∣ψ⟩|\psi\rangle) = X [0.8, 0.6]^T = [0.6, 0.8]^T = ∣ψ⟩|\psi\rangle βœ“

Result: Amplitudes and probabilities are completely swapped, and applying X again restores the original state.

βš™οΈ How Does It Work?

1

Input State

Ingest single qubit state alpha|0> + beta|1>.

2

Swap Amplitudes

The X gate swaps the amplitudes: beta|0> + alpha|1>.

3

Reversibility

Applying X a second time swaps them back to alpha|0> + beta|1>.

🌍 Where Is It Used?

Ancilla Initialization in Grover’s Search

Problem: Grover’s algorithm requires an auxiliary qubit initialized to the minus state |->.

Solution: Applying X followed by H to |0> produces state |->: H(X|0>) = H|1> = |->.

🎯 Try It Yourself

If you apply a Pauli-X gate to the superposition state |+> = (|0> + |1>)/sqrt(2), what is the resulting state?

Interactive activity component

🐍 Python Hands-On: Simulating the Quantum NOT (Pauli-X) Gate in Qiskit

Apply the Pauli-X gate to basis states |0> and |1> in Qiskit and verify bit-flip behavior with Statevector simulation.

Open Colab

1Install Required Packages

For Google Colab or Jupyter notebooks, run this shell command to install the required dependencies:

Terminal / Notebook Install Commandbash
!pip install qiskit
Packages:
qiskit

2Import Libraries

Import Statementspython
1from qiskit import QuantumCircuit
2from qiskit.quantum_info import Statevector

from qiskit import QuantumCircuit β†’ Circuit module

from qiskit.quantum_info import Statevector β†’ Statevector module

3Demonstration Code & Logic

Python Execution Codepython
1# 1. Apply X to |0> -> should yield |1>
2qc0 = QuantumCircuit(1)
3qc0.x(0) # Apply Pauli-X
4sv0 = Statevector.from_instruction(qc0)
5print('Input |0> -> After X gate:', sv0.data.round(2))
6print('Probabilities:', sv0.probabilities_dict())
7
8# 2. Apply X to |1> -> should yield |0>
9qc1 = QuantumCircuit(1)
10qc1.x(0) # Make |1>
11qc1.x(0) # Apply X again
12sv1 = Statevector.from_instruction(qc1)
13print('\nInput |1> -> After X gate:', sv1.data.round(2))
14print('Probabilities:', sv1.probabilities_dict())
15print('\nProves: X * X = I (Pauli-X is self-inverse)')
Step-by-Step Code Breakdown:

# 1. Apply X to |0> -> should yield |1>

Flip 0

qc0 = QuantumCircuit(1)

Init |0>

qc0.x(0) # Apply Pauli-X

Apply X

sv0 = Statevector.from_instruction(qc0)

Simulate

print('Input |0> -> After X gate:', sv0.data.round(2))

Result |1>

print('Probabilities:', sv0.probabilities_dict())

{'1': 1.0}

# 2. Apply X to |1> -> should yield |0>

Flip 1

qc1 = QuantumCircuit(1)

Init |0>

qc1.x(0) # Make |1>

Flip to 1

qc1.x(0) # Apply X again

Flip back to 0

sv1 = Statevector.from_instruction(qc1)

Simulate

print('\nInput |1> -> After X gate:', sv1.data.round(2))

Result |0>

print('Probabilities:', sv1.probabilities_dict())

{'0': 1.0}

print('\nProves: X * X = I (Pauli-X is self-inverse)')

Self-inverse

πŸ“‹ Complete Script (All-in-One)

Click "Copy for Colab", open Google Colab, paste into a single cell, and run.

Google Colab Notebook Scriptpython
1# =========================================================
2# Simulating the Quantum NOT (Pauli-X) 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
10from qiskit import QuantumCircuit
11from qiskit.quantum_info import Statevector
12
13# Step 3: Run Demonstration
14# 1. Apply X to |0> -> should yield |1>
15qc0 = QuantumCircuit(1)
16qc0.x(0) # Apply Pauli-X
17sv0 = Statevector.from_instruction(qc0)
18print('Input |0> -> After X gate:', sv0.data.round(2))
19print('Probabilities:', sv0.probabilities_dict())
20
21# 2. Apply X to |1> -> should yield |0>
22qc1 = QuantumCircuit(1)
23qc1.x(0) # Make |1>
24qc1.x(0) # Apply X again
25sv1 = Statevector.from_instruction(qc1)
26print('\nInput |1> -> After X gate:', sv1.data.round(2))
27print('Probabilities:', sv1.probabilities_dict())
28print('\nProves: X * X = I (Pauli-X is self-inverse)')
⚑ How to Run in Google Colab (3 Quick Steps)
  1. Click "Copy for Google Colab" above.
  2. Click Open New Google Colab Notebook (opens in a new tab).
  3. Click on the first empty code cell, press Ctrl + V (or Cmd + V) to paste, then press Shift + Enter to execute!

πŸ”„ Algorithmic Execution Flow

1
Apply X to |0>

Verify that state |0> rotates 180 degrees around X-axis into state |1>.

β†’
2
Apply X to |1>

Verify that applying X again restores state |0>.

β†’
3
Self-Inverse Check

Confirm that X^2 = Identity.

πŸ“₯ Input / Initial State
QuantumCircuit(1) with X and X^2 operations.
πŸ“€ Expected Output
Input |0> -> After X: [0.0, 1.0] -> P(1) = 100%
Input |1> -> After X: [1.0, 0.0] -> P(0) = 100%
X * X = I
πŸ’‘ What Does This Demonstration Show?

The Pauli-X gate acts as the quantum equivalent of the classical NOT gate, rotating states by pi radians around the X-axis of the Bloch sphere.

Course Learning Resource β€’ Slide DeckLesson 810 Slides

Lesson 8: Two Qubits and Entanglement

Hadamard, CNOT, Bell-state intuition, and correlated quantum circuits.

Author: Dr. Syed Muzamil Bashaβ€’ FDP Approved Curriculum
Open in New Tab

πŸ“ Learning Check

Test your understanding with these questions. Remember, this is for learning, not examination!

Question 1: Geometrically on the Bloch Sphere, what physical rotation does the Pauli-X gate execute?

Question 2: What is the matrix representation of the Pauli-X gate?

Question 3: What happens when you apply the X gate twice to any qubit state?

Question 4: Which Bloch sphere rotation does the X gate perform?

Question 5: Why is the X gate called the "quantum NOT gate"?