Quantum Gate Matrices

A comprehensive reference for quantum gate matrix representations and their effects on qubit states.

Single Qubit Gates

X

Pauli-X Gate

X

The Pauli-X gate performs a bit flip operation, equivalent to a classical NOT gate.

Matrix Representation:

0 1
1 0

Effect:

|0⟩ → |1⟩, |1⟩ → |0⟩

Y

Pauli-Y Gate

Y

The Pauli-Y gate performs a bit and phase flip operation.

Matrix Representation:

0 -i
i 0

Effect:

|0⟩ → i|1⟩, |1⟩ → -i|0⟩

Z

Pauli-Z Gate

Z

The Pauli-Z gate performs a phase flip operation.

Matrix Representation:

1 0
0 -1

Effect:

|0⟩ → |0⟩, |1⟩ → -|1⟩

H

Hadamard Gate

H

The Hadamard gate creates superposition by rotating the qubit state.

Matrix Representation:

1/√2 1/√2
1/√2 -1/√2

Effect:

|0⟩ → (|0⟩ + |1⟩)/√2, |1⟩ → (|0⟩ - |1⟩)/√2

S

S Gate

S

The S gate applies a π/2 phase shift.

Matrix Representation:

1 0
0 i

Effect:

|0⟩ → |0⟩, |1⟩ → i|1⟩

S†

S† Gate

S†

The S† (S-dagger) gate applies a -π/2 phase shift.

Matrix Representation:

1 0
0 -i

Effect:

|0⟩ → |0⟩, |1⟩ → -i|1⟩

T

T Gate

T

The T gate applies a π/4 phase shift.

Matrix Representation:

1 0
0 e^(iπ/4)

Effect:

|0⟩ → |0⟩, |1⟩ → e^(iπ/4)|1⟩

T†

T† Gate

T†

The T† (T-dagger) gate applies a -π/4 phase shift.

Matrix Representation:

1 0
0 e^(-iπ/4)

Effect:

|0⟩ → |0⟩, |1⟩ → e^(-iπ/4)|1⟩

RX(θ)

RX Gate

RX(θ)

The RX gate rotates the qubit around the X-axis by angle θ.

Matrix Representation:

cos(θ/2) -i·sin(θ/2)
-i·sin(θ/2) cos(θ/2)

Effect:

Rotates qubit state around X-axis

RY(θ)

RY Gate

RY(θ)

The RY gate rotates the qubit around the Y-axis by angle θ.

Matrix Representation:

cos(θ/2) -sin(θ/2)
sin(θ/2) cos(θ/2)

Effect:

Rotates qubit state around Y-axis

RZ(θ)

RZ Gate

RZ(θ)

The RZ gate rotates the qubit around the Z-axis by angle θ.

Matrix Representation:

e^(-iθ/2) 0
0 e^(iθ/2)

Effect:

Rotates qubit state around Z-axis

Two Qubit Gates

CNOT

CNOT Gate

CNOT

The Controlled-NOT gate flips the target qubit if the control qubit is |1⟩.

Matrix Representation:

1 0 0 0
0 1 0 0
0 0 0 1
0 0 1 0

Effect:

|00⟩ → |00⟩, |01⟩ → |01⟩, |10⟩ → |11⟩, |11⟩ → |10⟩

CZ

CZ Gate

CZ

The Controlled-Z gate applies a phase flip to the target qubit if the control qubit is |1⟩.

Matrix Representation:

1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 -1

Effect:

|00⟩ → |00⟩, |01⟩ → |01⟩, |10⟩ → |10⟩, |11⟩ → -|11⟩

SWAP

SWAP Gate

SWAP

The SWAP gate exchanges the states of two qubits.

Matrix Representation:

1 0 0 0
0 0 1 0
0 1 0 0
0 0 0 1

Effect:

|01⟩ ↔ |10⟩, other states unchanged

Mathematical Properties

Unitary Operations

All quantum gates are unitary operations, meaning they preserve the norm of quantum states and are reversible.

U†U = I (where U† is the conjugate transpose)

Matrix Multiplication

When multiple gates are applied sequentially, their effects are combined through matrix multiplication.

|ψ⟩ → U₂U₁|ψ⟩ (U₁ applied first, then U₂)

Try It Yourself!

Visit the Playground to see these gates in action with real-time matrix multiplication visualization.

Go to Playground