DEV Community

Jayaprasanna Roddam
Jayaprasanna Roddam

Posted on

Math for Quantum Computing

Linear Algebra Foundations for Quantum Computing (Explained Clearly)


1. Vector Spaces (Real vs Complex)

A vector space is a collection of objects (called vectors) where you can:

  • Add two vectors
  • Multiply a vector by a scalar

Real Vector Space

  • Scalars are real numbers (ℝ)
  • Example: ℝ² = (x, y)

Complex Vector Space

  • Scalars are complex numbers (ℂ)
  • Example: ℂ² = (a + ib, c + id)

Why Complex Matters in Quantum Computing

  • Quantum states use complex amplitudes
  • Phase (angle in complex plane) is crucial for interference

2. Basis

A basis is a set of vectors that:

  • Can generate every vector in the space (span)
  • Are linearly independent

Example (ℝ²)

Basis:

  • (1, 0)
  • (0, 1)

Any vector:
(x, y) = x(1,0) + y(0,1)

In Quantum Computing

Standard basis:

  • |0⟩ = (1, 0)
  • |1⟩ = (0, 1)

3. Dimension

The dimension of a vector space = number of vectors in a basis.

Examples

  • ℝ² → dimension = 2
  • ℝ³ → dimension = 3

In Quantum Computing

  • 1 qubit → dimension = 2
  • n qubits → dimension = 2ⁿ

This exponential growth is where quantum power comes from.


4. Inner Product

The inner product measures similarity between two vectors.

Real Case

For vectors u = (u₁, u₂), v = (v₁, v₂):

⟨u, v⟩ = u₁v₁ + u₂v₂

Complex Case

⟨u, v⟩ = Σ (conjugate(uᵢ) * vᵢ)

Why It Matters

  • Gives length and angle
  • Used to compute probabilities in quantum mechanics

5. Norm

The norm is the length of a vector.

||v|| = √⟨v, v⟩

Example

v = (3, 4)

||v|| = √(3² + 4²) = 5

In Quantum Computing

  • Quantum states must be normalized:

||ψ|| = 1

  • Ensures probabilities sum to 1

6. Orthogonality

Two vectors are orthogonal if their inner product is zero:

⟨u, v⟩ = 0

Example

(1, 0) · (0, 1) = 0 → orthogonal

In Quantum Computing

  • |0⟩ and |1⟩ are orthogonal
  • Means they are perfectly distinguishable states

7. Eigenvalues & Eigenvectors

A vector v is an eigenvector of matrix A if:

A v = λ v

Where:

  • v = eigenvector
  • λ = eigenvalue

Intuition

Applying A:

  • Changes only the scale, not direction

Example

A = [[2, 0],

[0, 3]]

Eigenvectors:

  • (1, 0) → eigenvalue = 2
  • (0, 1) → eigenvalue = 3

Advanced Linear Algebra for Quantum Computing


1. Spectral Decomposition

Spectral decomposition expresses a matrix in terms of its eigenvalues and eigenvectors.

Definition

If a matrix A has eigenvalues λ₁, λ₂, ..., λₙ and corresponding orthonormal eigenvectors v₁, v₂, ..., vₙ:

A = Σ (λᵢ * |vᵢ⟩⟨vᵢ|)


Intuition

  • Any matrix can be “broken down” into simpler components
  • Each component scales along a specific direction (eigenvector)

Why It Matters in Quantum Computing

  • Measurement operators are decomposed this way
  • Helps compute probabilities of outcomes
  • Used heavily in quantum algorithms and physics

2. Unitary Matrices

A matrix U is unitary if:

U†U = UU† = I

Where:

  • U† = conjugate transpose of U
  • I = identity matrix

Key Properties

  • Preserves length (norm)
  • Reversible transformation
  • Columns are orthonormal

Intuition

Unitary transformations = rotation in complex space


In Quantum Computing

  • All quantum gates are unitary
  • Ensures:
    • No information loss
    • State remains normalized

Example

Hadamard Gate:

H = (1/√2) * [[1, 1],

[1, -1]]


3. Hermitian Operators

A matrix A is Hermitian if:

A† = A


Key Properties

  • Eigenvalues are real
  • Eigenvectors are orthogonal

Intuition

Hermitian matrices represent measurable quantities


In Quantum Computing

  • Observables (like position, energy) are Hermitian
  • Measurement outcomes = eigenvalues
  • System collapses to corresponding eigenvector

Example

A = [[2, i],

[-i, 3]]

This is Hermitian because A† = A


4. Tensor Products (VERY IMPORTANT)

Tensor product combines two vector spaces into a larger one.


Definition

If:
u = (a, b)

v = (c, d)

Then:

u ⊗ v = (ac, ad, bc, bd)


Example (Qubits)

|0⟩ = (1, 0)

|1⟩ = (0, 1)

Then:

|0⟩ ⊗ |1⟩ = |01⟩ = (0, 1, 0, 0)


Key Idea

  • 1 qubit → 2D space
  • 2 qubits → 4D space
  • n qubits → 2ⁿ space

Why Tensor Product is Critical

It enables:

  • Multi-qubit systems
  • Entanglement
  • Exponential state space growth

Important Insight

Not all states can be written as tensor products:

Example:

|ψ⟩ = (|00⟩ + |11⟩)/√2

This is entangled → cannot be separated


Why This Matters in Quantum Computing

  • Observables (like measurement) are operators
  • Eigenvalues = possible measurement results
  • Eigenvectors = corresponding states

Big Picture Connection

  • Vector spaces → where quantum states live
  • Basis → how we represent states
  • Inner product → gives probabilities
  • Norm → ensures valid quantum states
  • Orthogonality → distinguishes states
  • Eigen concepts → define measurement outcomes
  • Spectral decomposition → breaks operators into measurable parts
  • Unitary matrices → define valid quantum evolution
  • Hermitian operators → define measurements
  • Tensor products → scale systems exponentially

🧠 One Line Summary

Quantum computing =

Linear algebra over complex spaces + tensor products + unitary evolution

Top comments (0)