“The universe is an enormous direct product of representations of symmetry groups.”
— Steven Weinberg

Welcome to the first step of our journey. We are about to discover that the diverse landscapes of physics—the swing of a pendulum, the spin of an electron, the glow of a star—are all built from the same mathematical clay. That clay is the vector space.

In this session, we will:


1.1.1 The Abstract Definition

A vector space over a field \(\mathbb{F}\) (usually the real numbers \(\mathbb{R}\) or the complex numbers \(\mathbb{C}\)) is a set \(V\) equipped with two operations:

  1. Addition: For any \(\mathbf{u}, \mathbf{v} \in V\), there is a vector \(\mathbf{u} + \mathbf{v} \in V\).
  2. Scalar multiplication: For any \(\alpha \in \mathbb{F}\) and \(\mathbf{v} \in V\), there is a vector \(\alpha \mathbf{v} \in V\).

These operations must satisfy a familiar list of axioms: commutativity, associativity, existence of a zero vector, existence of additive inverses, distributivity of scalars, and so on. You have seen these before—they are the rules that make vectors “behave nicely.”

But a definition without a soul is empty. The magic happens when we realise that the elements of \(V\) need not be geometric arrows. They can be positions, quantum states, functions, or even abstract symbols. The only requirement is that they obey the same handful of rules.

Let us meet three very different physical systems, each of which forms a vector space.


1.1.2 Three Appearances of a Vector Space

Appearance 1: A Classical Particle on a Line

Imagine a particle that can only move along a straight line (the \(x\)-axis). Its position is a real number \(x\). The set of all possible positions is \(\mathbb{R}\). Is this a vector space? Yes!

  • Addition: If the particle is at \(x_1\) and then moves by \(x_2\), its new position is \(x_1 + x_2\).
  • Scalar multiplication: If the particle is at \(x\) and we stretch the coordinate system by a factor \(\alpha\), its new position is \(\alpha x\).

But wait—does “addition of positions” make physical sense? In everyday language, we add displacements, not positions. However, if we fix an origin, every position can be thought of as a displacement from that origin. Then adding two positions means: start at the origin, go to the first position, then go from there by the displacement equal to the second position. This yields a new position (the sum). So indeed, positions form a vector space once we choose an origin.

More naturally, the space of displacements (arrows from one point to another) is a vector space. Displacements add tip‑to‑tail, and scaling a displacement changes its length. This is the classic picture of vectors as arrows.

Appearance 2: A Quantum Spin‑½ Particle

A spin‑½ particle, like an electron, has an internal degree of freedom: its spin can point “up” or “down” along some axis. In quantum mechanics, the state of the spin is not simply “up or down” but a superposition of both possibilities. Mathematically, the state is a vector in a two‑dimensional complex vector space, usually denoted \(\mathbb{C}^2\).

  • Basis vectors: \(|{\uparrow}\rangle = \begin{pmatrix}1\\0\end{pmatrix}\) and \(|{\downarrow}\rangle = \begin{pmatrix}0\\1\end{pmatrix}\) represent spin up and spin down along the \(z\)-axis.
  • Addition: A state like \(\frac{1}{\sqrt{2}}|{\uparrow}\rangle + \frac{1}{\sqrt{2}}|{\downarrow}\rangle\) represents a particle that is in a superposition—it has equal probability to be found up or down when measured.
  • Scalar multiplication: Multiplying a state by a complex number changes its phase and amplitude, but the physical interpretation requires that the total probability remains one (we normalise later).

This is radically different from classical physics. Here, addition does not correspond to any classical notion of “combining” objects—it is the purely quantum phenomenon of superposition.

Appearance 3: The Electromagnetic Field

Consider the electric field \(\mathbf{E}(\mathbf{r})\) at every point in space. This is a function that assigns a vector to each location. The set of all such functions (subject to suitable conditions like square‑integrability) is a vector space—often called a function space.

  • Addition: If you have two electric fields \(\mathbf{E}_1\) and \(\mathbf{E}_2\), their sum \(\mathbf{E}_1 + \mathbf{E}_2\) is the field produced by both sources together. This is the principle of superposition for electromagnetic fields.
  • Scalar multiplication: Multiplying an electric field by a real number \(\alpha\) scales its strength everywhere.

Here the vectors are entire fields. The vector space is infinite‑dimensional because specifying a field requires infinitely many numbers (one for each point in space). Yet the algebraic rules are exactly the same as for the humble displacements in one dimension.


1.1.3 The Same Rules, Different Realities

Let us put these three examples side by side.

System Vectors are … Addition means … Scalar multiplication means …
Classical particle Positions / displacements Combining displacements (tip‑to‑tail) Stretching a displacement
Quantum spin State vectors in \(\mathbb{C}^2\) Superposition of possibilities Changing amplitude and phase
Electromagnetic field Electric field functions Fields from different sources add Amplifying the field strength everywhere

Despite the wildly different physical interpretations, the mathematical operations are identical. In every case:

This is the first glimpse of the unity we will explore throughout this book. Physics may seem fragmented into separate domains, but beneath the surface, a common mathematical language flows.


1.1.4 Why This Matters: The Principle of Superposition

The ability to add vectors is so central that it has a special name in physics: the principle of superposition. Let’s see what it enables in each of our three worlds.

In each case, the same mathematical act—addition—produces phenomena that define the character of the field.


1.1.5 A First Glimpse of Categorical Thinking

We have seen that many different physical systems are instances of the same abstract structure: a vector space. Mathematicians have a way of capturing this idea: they organise vector spaces into a category, called \(\mathbf{Vect}\).

Why introduce this language now? Because it gives us a bird’s‑eye view. Instead of studying each physical system in isolation, we can study the relationships between them. For example, the Fourier transform is a linear map from the space of wave functions to the space of momentum functions—it connects two different physical representations of the same quantum system.

Throughout this book, we will gradually build up the categorical toolkit. For now, just remember: vector spaces are objects, and the maps that respect their structure are the arrows that connect them.


1.1.6 Computational Explorations: Seeing Unity Through Code

Enough talk—let’s write some code. We will use Python with three libraries:

Our goal: implement the three physical systems and show that the same addition and scalar multiplication operations work for all, while the visualisations differ.

Setup

First, install the libraries if you haven’t already:

pip install discopy numpy matplotlib sympy

Now, open a Jupyter notebook or Python script and import what we need:

import numpy as np
import matplotlib.pyplot as plt
import sympy as sp
from discopy.tensor import Tensor, Dim

Classical Displacement (2D)

We represent a displacement vector as a Tensor from DisCoPy. (Don’t worry about the details yet—think of it as a generalised array.)

# Two displacement vectors
from discopy.tensor import Tensor, Dim
import numpy as np
import matplotlib.pyplot as plt

# Two displacement vectors (as morphisms from unit to 2D)
v1 = Tensor([2, 1], Dim(1), Dim(2))
v2 = Tensor([1, 3], Dim(1), Dim(2))

# Addition works as expected (since both have same dom/cod)
v_sum = v1 + v2
print("v1 + v2 =", v_sum.array)

Now visualise them as arrows:

def draw_vector(v, origin=(0,0), color='b', label=None):
    # v.array is a numpy array of shape (1,2) because dom=Dim(1), cod=Dim(2)
    arr = v.array.flatten()  # flatten to 1D for plotting
    plt.arrow(origin[0], origin[1], arr[0], arr[1],
              head_width=0.1, head_length=0.1, fc=color, ec=color, label=label)

plt.figure(figsize=(6,6))
draw_vector(v1, color='blue', label='v1')
draw_vector(v2, origin=v1.array.flatten(), color='red', label='v2')
draw_vector(v_sum, color='green', label='v1+v2')
plt.xlim(-1,5); plt.ylim(-1,5)
plt.grid(); plt.legend(); plt.title('Classical Displacement Addition')
plt.show()

You should see the two vectors added tip‑to‑tail, with the resultant vector closing the triangle.

Quantum Spin State

We represent spin states as complex vectors in \(\mathbb{C}^2\). DisCoPy’s Tensor can handle complex numbers.

import numpy as np
import matplotlib.pyplot as plt
from discopy.tensor import Tensor, Dim

def scale_tensor(t, factor):
    """Return a new tensor with the array multiplied by factor."""
    return Tensor(t.array * factor, t.dom, t.cod)

# --- Quantum spin state ---
up = Tensor([1, 0], Dim(1), Dim(2))
down = Tensor([0, 1], Dim(1), Dim(2))

# Superposition: (|up> + |down>) / √2
plus_raw = up + down                # array becomes [1, 1]
plus = scale_tensor(plus_raw, 1 / np.sqrt(2))

print("|+> =", plus.array)          # shape (1,2)
probs = np.abs(plus.array.flatten())**2
print("Probabilities:", probs)

# Visualise
plt.figure()
plt.bar(['|↑⟩', '|↓⟩'], probs, color='purple')
plt.ylim(0, 1)
plt.ylabel('Probability')
plt.title('Quantum Superposition')
plt.show()

The bar chart shows that the particle has a 50% chance to be found up and 50% down—a direct consequence of vector addition.

Electromagnetic Wave Addition

We’ll work with 1D waves for simplicity. Define two sine waves and add them pointwise.

# Define spatial domain
x = np.linspace(0, 4*np.pi, 500)

# Two waves with different amplitudes, phases
A1, k1, phi1 = 1.0, 1.0, 0.0
A2, k2, phi2 = 0.8, 2.0, np.pi/4

wave1 = A1 * np.sin(k1 * x + phi1)
wave2 = A2 * np.sin(k2 * x + phi2)
wave_sum = wave1 + wave2

# Plot
plt.figure()
plt.plot(x, wave1, label='wave1')
plt.plot(x, wave2, label='wave2')
plt.plot(x, wave_sum, 'k--', label='sum')
plt.xlabel('Position x')
plt.ylabel('Electric field')
plt.legend()
plt.title('EM Wave Superposition')
plt.show()

You’ll see interference patterns—places where the waves reinforce or cancel. This is vector addition in function space.

Symbolic Verification (Optional)

Let’s use SymPy to derive the interference condition symbolically.

# Define symbols
k, x, A1, A2, phi1, phi2 = sp.symbols('k x A1 A2 phi1 phi2', real=True)

# Two waves with same k (for simplicity)
wave1 = A1 * sp.sin(k*x + phi1)
wave2 = A2 * sp.sin(k*x + phi2)

# Sum and simplify using trigonometric identity
wave_sum = sp.simplify(wave1 + wave2)
print("Sum of waves:", wave_sum)

# Combine into a single sine
amplitude = sp.sqrt(A1**2 + A2**2 + 2*A1*A2*sp.cos(phi1 - phi2))
phase = sp.atan2(A1*sp.sin(phi1) + A2*sp.sin(phi2),
                 A1*sp.cos(phi1) + A2*sp.cos(phi2))
print("Amplitude =", amplitude)
print("Phase =", phase)

This shows that the sum of two sine waves is another sine wave with modified amplitude and phase—a perfect illustration of vector addition in the space of sinusoidal functions.


1.1.7 What Have We Learned?

In the next session, we will dig deeper into the concept of a basis and discover how coordinates allow us to turn abstract vectors into concrete numbers—and why physics should be independent of the basis we choose.


1.1.8 Computational Tasks

To solidify your understanding, complete the following tasks. They are designed to be solved with the Python tools we introduced.

  1. Classical: Create three displacement vectors in 2D. Compute their sum in different orders and verify that addition is commutative and associative. Visualise each order to see that the final resultant is the same.

  2. Quantum: Create the state \(|\psi\rangle = \frac{1}{\sqrt{3}}|{\uparrow}\rangle + \sqrt{\frac{2}{3}}|{\downarrow}\rangle\). Compute its probabilities and verify they sum to 1. What is the probability of measuring spin up? Now create another state \(|\phi\rangle = \frac{1}{\sqrt{2}}(|{\uparrow}\rangle - |{\downarrow}\rangle)\) and compute their inner product \(\langle\phi|\psi\rangle\). What does this inner product represent physically?

  3. Electromagnetic: Generate two waves with different frequencies (e.g., \(k_1=1\), \(k_2=1.5\)). Plot their sum and observe the beat pattern. Explain how this arises from vector addition.

  4. Symbolic: Use SymPy to derive the general formula for the sum of two waves with different wave numbers. Is the result still a pure sine wave? Why or why not?

  5. Categorical thought (optional): Write a short paragraph explaining how the concept of a vector space unifies the three systems you explored. Use the language of objects and maps if you can.


Notes for the Reader


In the next chapter, we will meet bases—the coordinate systems that let us label vectors—and learn why physics must be invariant under changes of basis. Prepare to rotate your point of view!