Linear algebra shaped like a graph
Many problems of linear algebra ask for normal forms of a configuration of vector spaces and linear maps:
- one linear map (normal form: its rank);
- one endomorphism (normal form: Jordan blocks, depending on eigenvalues);
- a chain — for instance the homology of a growing sequence of spaces in data analysis;
- two maps (Kronecker's matrix pencils).
Each is described by a directed graph — a quiver — with a vector space at each vertex and a linear map on each arrow. Gabriel (1972) observed that such representations of a quiver are precisely the modules over a single algebra, the path algebra , whose basis is the set of paths in and whose multiplication is concatenation. So the whole theory of modules — submodules, quotients, direct sums, projectives, — applies to these problems at once, and conversely quivers give a concrete, pictorial handle on finite-dimensional algebras.
This lesson builds path algebras, proves the equivalence between representations and modules, and classifies the representations of the simplest family, the linearly oriented quivers . It assumes modules; the classification of all quivers of finite type (Gabriel's theorem) is the subject of quiver representations.
Paths multiply when they meet
Picture the quiver . Its paths are the three "stay-at-home" paths , the arrows , and the path ("first , then "). Multiply two paths by walking one after the other if the first ends where the second starts, and get otherwise: , but because ends at and starts at . The trivial paths act as "you are here" markers: and , while .
Now give each vertex a vector space and each arrow a linear map. A path acts by composing the maps along it, and a vector sitting at vertex can be pushed along , then along . That is a module over the algebra of paths: the vector space is , the idempotent projects onto , and the arrows act by the maps. Every module arises this way.
Cycles change everything. A single loop at one vertex has paths , all different: the path algebra is the polynomial ring , infinite-dimensional, and its finite-dimensional modules are vector spaces with an operator, classified by Jordan normal form — with a continuous parameter, the eigenvalue.
Definitions and conventions
Definition— quiver; path
A quiver consists of a set of vertices, a set of arrows, and maps giving the source and target of each arrow. Loops () and multiple arrows are allowed. is finite if and are finite. A path of length from to is a sequence of arrows with , and ; for each vertex there is also a trivial path of length from to . An oriented cycle is a path of positive length from a vertex to itself.
Definition— path algebra
Let be a field. The path algebra is the -vector space with basis the set of all paths of , with multiplication defined on basis elements by
and extended bilinearly. Convention. This "left to right" order is used by Assem, Simson and Skowroński, among others; many texts multiply in the opposite order, like composition of functions. The two conventions give opposite algebras, and they interchange left and right modules — the main source of sign-of-the-direction confusion in the literature.
Definition— representation of a quiver
A representation of over assigns a vector space to each vertex and a linear map to each arrow. A morphism is a family of linear maps with for every arrow. Representations and morphisms form a -linear abelian category (kernels and cokernels are computed vertex by vertex). For finite-dimensional , the dimension vector is . A path acts by , and .
Definition— simple, projective and injective representations
For a vertex : the simple representation has at and elsewhere; the projective representation has = the vector space with basis the paths from to , with arrows acting by extending paths (); the injective representation has = the dual of the space spanned by the paths from to .
Definition— indecomposable; interval module
A non-zero representation is indecomposable if it is not a direct sum of two non-zero subrepresentations. For the linearly oriented quiver and , the interval module has at the vertices , the identity on the arrows between them, and elsewhere.
Examples
Example— Path algebras you already know
- One vertex, no arrows: . vertices, no arrows: .
- One loop : paths with , so . Representations are pairs : a vector space with an operator, as in modules over .
- One vertex, loops: is the free algebra on non-commuting variables; there are paths of length .
- Kronecker quiver (arrows ): basis , so ; . Representations are pairs of matrices up to : matrix pencils.
Example— Linear Aₙ is upper triangular matrices
In there is exactly one path from to for each (with ), and none for . The multiplication is and for — exactly the rule for matrix units. So is an isomorphism from onto the algebra of upper triangular matrices, and .
Example— Projectives and injectives of A₃
For : (paths from reach ), , ; , , . So is projective and injective, the sink gives a simple projective and the source a simple injective. The six interval modules are all the indecomposables (Theorem 4).
Example— Orientation matters
The quivers and have the same underlying graph but different path algebras: the first has paths ( trivial, arrows, of length ), the second only . Their representation categories are not equivalent — the first has an indecomposable representation that is both projective and injective, , and the second has none — though they have the same number of indecomposables, as Gabriel's theorem predicts for every orientation of a Dynkin diagram.
The main theorems
Theorem— Proposition 1 (structure of kQ)
is an associative algebra. The trivial paths are orthogonal idempotents, and for ; if starts at and otherwise, and if ends at and otherwise. If is finite, is the identity element, and with spanned by the paths from to .
Proof
On basis elements, and are both non-zero exactly when and , and then both equal the concatenation ; by bilinearity, multiplication is associative. The statements about are the definition of the product, with the path of length at . If is finite, and similarly on the right. Finally is if runs from to and otherwise.
∎
Theorem— Theorem 2 (finite dimension)
For a finite quiver , is finite-dimensional if and only if has no oriented cycles. In that case every path has length less than .
Proof
If is an oriented cycle, its powers are paths of lengths (), all distinct basis elements, so . Conversely, if there is no oriented cycle, a path visits the vertices , and these vertices are distinct — a repetition would contain an oriented cycle. So . There are at most paths of length , hence finitely many paths in all.
∎
The Lean proof of the second half uses a height function: in an acyclic finite quiver one can number the vertices so that every arrow increases the number (a topological sort), and then a path from to has length at most . The first experiment counts paths with powers of the adjacency matrix : the number of paths of length from to is , and is acyclic iff is nilpotent.
Theorem— Theorem 3 (representations are modules)
Let be a finite quiver, and use the multiplication convention above. Then is equivalent to the category of right -modules (finite-dimensional representations corresponding to finite-dimensional modules). Under this equivalence , and correspond to the simple module, the projective module and the injective module , and for every representation .
Proof
From representations to modules. Given , let , and for a vector and a path put if , and otherwise; extend bilinearly. Then when the paths compose, and both sides are otherwise; and . So is a right -module. A morphism gives , which commutes with the action of arrows — hence of all paths — because .
From modules to representations. Given a right module , put and, for an arrow , ; this lies in because . A module homomorphism restricts to maps commuting with the arrows.
They are inverse. with the original maps, so . Conversely, since the are orthogonal idempotents with sum , , and the action of a path on is the composite of the actions of its arrows, so , naturally in .
Special objects. is spanned by the paths starting at , that is, , a direct summand of and hence projective. A module map is determined by the image of , which can be any element with , so . The statement for is clear, and that for is the dual argument.
∎
The isomorphism is the Yoneda lemma in disguise: is the linearised representable functor "paths out of " (see the categories viewpoint).
Theorem— Theorem 4 (representations of linear Aₙ)
Every finite-dimensional representation of is isomorphic to a direct sum of interval modules , . The interval modules are indecomposable and pairwise non-isomorphic, so has exactly indecomposable representations up to isomorphism. The multiplicity of in is
where is the rank of the composite map (for ), and if or . In particular the decomposition is unique up to isomorphism.
Proof
Reformulation. Let , graded by vertex, and let act as on (and as on ). Then is nilpotent and raises degree by . Subrepresentations of are exactly the -invariant graded subspaces, and direct sum decompositions of are decompositions of into -invariant graded subspaces. Call a homogeneous vector with and the top of a chain ; these vectors lie in different degrees, so they are linearly independent, and they span a subrepresentation isomorphic to . It suffices to show that has a basis that is a disjoint union of chains.
Existence of a chain basis — the Jordan normal form argument for nilpotent operators, done with homogeneous vectors. Induct on ; if , any homogeneous basis consists of chains of length one. Otherwise is a graded -invariant subspace of smaller dimension (a nilpotent map is not surjective unless ), so it has a chain basis, with chains with tops and last vectors . Each with homogeneous: if and , take for the component of in . The last vectors form a basis of , because maps each other chain vector to the next vector of its chain. Choose homogeneous forming a basis of a graded complement of in (complements can be chosen degree by degree). We claim that the extended chains together with the chains of length one form a basis of . Count: their number is . Independence: apply to a vanishing linear combination; the result is a combination of chain vectors of in which each appears only with the coefficient of , and the other vectors are images of distinct chain vectors, so all coefficients of the and of the non-last vectors of the vanish; what remains is a combination of the and the , which are independent.
Indecomposability. An endomorphism of is a family of scalars with (commutation with the identity maps), so . A decomposition into two non-zero summands would give an idempotent endomorphism other than and , which does not have.
Multiplicities. On , the composite map from vertex to vertex is the identity of if and otherwise. Ranks add over direct sums, so if then . Inclusion–exclusion over the conditions and gives the formula for . The ranks depend only on , so the multiplicities do too; in particular non-isomorphic interval modules are distinguished and the decomposition is unique.
∎
The same reformulation shows that representations of linear are graded modules over killed by , and Theorem 4 is the graded version of the structure theorem for modules over the PID — the statement behind barcodes in persistent homology (topology viewpoint below). The second experiment hides a known decomposition by random changes of basis and recovers it from the ranks.
Theorem— Theorem 5 (path algebras are hereditary; stated)
Let be a finite quiver without oriented cycles. For every representation there is a short exact sequence, the standard resolution,
Hence every representation has projective dimension at most , submodules of projective modules are projective, and for : is hereditary. Moreover, for finite-dimensional ,
the Euler form of the dimension vectors , .
For a proof see Crawley-Boevey's Lectures on Representations of Quivers (1992), §1, or Schiffler, Quiver Representations, Chapter 2. For the hereditary property can be seen directly: the subrepresentations of are the for , all projective. The Euler form leads to Gabriel's and Kac's theorems, treated in quiver representations.
Explore: paths that compose
The diagram below is a representation of the linearly oriented quiver in sets rather than vector spaces: each vertex carries a finite set and each arrow a function. Build a path by clicking arrows. When the next arrow starts where your path ends, the path grows and acts by the composite function; when it does not, the widget refuses — that refusal is the rule " unless " of the path algebra. The comparison of and is associativity, Proposition 1. (The widget writes composites in function order, for "first , then ", which is the path in this lesson's convention.)
Arrows that compose
Click arrows to build a path. Every path composes to a single arrow — and brackets never matter.
Your composite
Start by clicking any arrow.
Two ways to bracket h ∘ g ∘ f
| x | (g∘f)(x) | h((g∘f)(x)) | (h∘g)(f(x)) |
|---|---|---|---|
| 1 | x | 1 | 1 |
| 2 | z | 0 | 0 |
| 3 | x | 1 | 1 |
The last two columns always agree: h ∘ (g ∘ f) = (h ∘ g) ∘ f. That is associativity.
Representations of the one-loop quiver are vector spaces with an operator: on , a matrix. Its subrepresentations are the invariant subspaces, which the widget draws as dashed lines. A diagonal matrix with distinct eigenvalues decomposes into two simple representations; a shear is indecomposable but not simple; and the scaling preset, with its sliders, decomposes into one-dimensional representations , which are pairwise non-isomorphic for different — a continuous family of indecomposables. This is why a quiver with a loop has infinitely many indecomposable representations, while has .
Representations of the one-loop quiver
A representation of x ↻ on the plane is a matrix; dashed lines are subrepresentations.
- image of the grid
- image of the unit square
- image of the flag
- before the transformation
- invariant line
The columns of A are the images of e₁ = (1, 0) and e₂ = (0, 1): Ae₁ = (1, 0), Ae₂ = (1, 1)
det A = ad − bc = 1
The unit square (area 1) becomes a parallelogram of area |det A| = 1. Since det A > 0, orientation is preserved.
Invariant lines (real eigenvectors)
λ = 1, v = (1, 0)
Only one invariant line, with eigenvalue 1: there is no second eigenvector direction.
Quivers in Lean and Mathlib
Mathlib has quivers and their paths, but not path algebras. We formalise the multiplication table of the basis of — paths with a zero adjoined — and prove that it is associative, which is the combinatorial content of Proposition 1; extending it bilinearly gives .
/-- The basis of the path algebra together with zero: either a path `p` from some vertex `a` to
some vertex `b` (recorded with its endpoints), or `none`, standing for `0`. -/
abbrev PathOrZero (V : Type u) [Quiver.{v + 1} V] := Option (Σ a b : V, Quiver.Path a b)/-- The product of basis paths in `kQ`, with the convention used in the lesson: `p · q` means
"first `p`, then `q`", defined when `p` ends where `q` starts, and `0` otherwise. (Many books
use the opposite order; the two conventions give opposite algebras.) -/
def pmul : PathOrZero V → PathOrZero V → PathOrZero V
| some ⟨a, b, p⟩, some ⟨c, d, q⟩ =>
if h : b = c then some ⟨a, d, p.comp (h ▸ q)⟩ else none
| _, _ => none/-- **The multiplication of paths is associative**, including the cases where some product is
`0`. Human proof: `(p · q) · r` and `p · (q · r)` are both defined exactly when `p` ends where `q`
starts and `q` ends where `r` starts, and then both equal the concatenation `pqr`, by
associativity of concatenation (`Quiver.Path.comp_assoc`). Extended bilinearly, this makes `kQ`
an associative algebra. -/
theorem pmul_assoc (x y z : PathOrZero V) : pmul (pmul x y) z = pmul x (pmul y z) := by
rcases x with _ | ⟨a, b, p⟩
· rfl
rcases y with _ | ⟨c, d, q⟩
· simp [pmul]
rcases z with _ | ⟨e, f, r⟩
· by_cases h : b = c
· subst h; simp [pmul]
· simp [pmul, h]
by_cases h1 : b = c
· subst h1
by_cases h2 : d = e
· subst h2
simp [pmul, Quiver.Path.comp_assoc]
· simp [pmul, h2]
· by_cases h2 : d = e
· subst h2
simp [pmul, h1]
· simp [pmul, h1, h2]/-- **The trivial paths `eₐ` are orthogonal idempotents**: `eₐ · eₐ = eₐ` and `eₐ · e_b = 0` for
`a ≠ b`. (For a finite quiver their sum is the identity of `kQ`.) -/
theorem idempotents (a b : V) :
pmul (some ⟨a, a, Quiver.Path.nil⟩) (some ⟨b, b, Quiver.Path.nil⟩) =
if a = b then some ⟨a, a, Quiver.Path.nil⟩ else none := by
by_cases h : a = b
· subst h; simp [pmul]
· simp [pmul, h]/-- Concatenation of paths is associative: Mathlib's `Quiver.Path.comp_assoc`. (Mathlib's
`p.comp q` is "first `p`, then `q`".) -/
theorem concat_assoc {V : Type u} [Quiver.{v + 1} V] {a b c d : V} (p : Quiver.Path a b)
(q : Quiver.Path b c) (r : Quiver.Path c d) : (p.comp q).comp r = p.comp (q.comp r) :=
Quiver.Path.comp_assoc p q rBoth halves of Theorem 2: a height function bounds the lengths of paths, and a cycle of positive length has infinitely many distinct powers.
/-- **Acyclic quivers have bounded paths.** If every arrow strictly increases a height function
`h : V → ℕ`, then every path from `a` to `b` has length at most `h b - h a`. Such a function exists
for every finite quiver without oriented cycles (number the vertices compatibly with the arrows),
so then paths have length less than the number of vertices, and with finitely many arrows there
are only finitely many paths: `kQ` is finite-dimensional. Proof: induction on the path. -/
theorem path_length_le {V : Type u} [Quiver.{v + 1} V] (h : V → ℕ)
(hh : ∀ {a b : V}, (a ⟶ b) → h a < h b) {a b : V} (p : Quiver.Path a b) :
h a + p.length ≤ h b := by
induction p with
| nil => simp
| cons p e ih =>
rw [Quiver.Path.length_cons]
have := hh e
omega/-- The powers `cⁿ = c c ⋯ c` of a cycle `c` at a vertex `a`. -/
def cyclePow {V : Type u} [Quiver.{v + 1} V] {a : V} (c : Quiver.Path a a) : ℕ → Quiver.Path a a
| 0 => Quiver.Path.nil
| n + 1 => (cyclePow c n).comp c/-- **A cycle makes `kQ` infinite-dimensional.** If `c` is an oriented cycle of positive length,
its powers `cⁿ` have lengths `n · length c`, all different, so there are infinitely many paths
from `a` to `a`. With the previous theorem: a finite quiver has finite-dimensional path algebra
exactly when it has no oriented cycles. -/
theorem cycle_infinite {V : Type u} [Quiver.{v + 1} V] {a : V} (c : Quiver.Path a a)
(hc : 0 < c.length) : Infinite (Quiver.Path a a) := by
have hlen : ∀ n : ℕ, (cyclePow c n).length = n * c.length := by
intro n
induction n with
| zero => simp [cyclePow]
| succ n ih => rw [cyclePow, Quiver.Path.length_comp, ih, Nat.succ_mul]
refine Infinite.of_injective (cyclePow c) fun m n hmn => ?_
have := congrArg Quiver.Path.length hmn
rw [hlen, hlen] at this
exact Nat.eq_of_mul_eq_mul_right hc thisThe linearly oriented quiver on the vertices Fin n, and the length of its paths:
/-- The linearly oriented quiver `Aₙ`: vertices `0, 1, …, n-1` and one arrow `i → i+1`. -/
def LinA (n : ℕ) : Type := Fin n/-- The arrows of `Aₙ`: there is an arrow from `i` to `j` exactly when `j = i + 1`. -/
instance linAQuiver (n : ℕ) : Quiver (LinA n) where
Hom i j := PLift ((j : Fin n).val = (i : Fin n).val + 1)/-- **Paths in `Aₙ`.** Every path from `i` to `j` in the linearly oriented quiver has length
exactly `j - i`; in particular paths `i → j` exist only for `i ≤ j`. (There is in fact exactly
one for each `i ≤ j`, so `kAₙ` has dimension `n(n+1)/2` and is isomorphic to the algebra of upper
triangular `n × n` matrices.) Proof: induction on the path, each arrow adding `1`. -/
theorem lin_a_length {n : ℕ} {i j : LinA n} (p : Quiver.Path i j) :
(i : Fin n).val + p.length = (j : Fin n).val := by
induction p with
| nil => simp
| cons p e ih =>
rw [Quiver.Path.length_cons]
have := e.down
omegaFinally the categorical half of Theorem 3, from Mathlib's universal property of the free category: a representation is the same as a functor out of the path category.
/-- **Representations of `Q` are functors out of the path category.** A representation — a
prefunctor `ρ : Q ⥤q ModuleCat k` — extends to a functor `F` on the free category `Paths Q`
(paths act by composites of the arrow maps), and `F` is the unique functor that restricts to `ρ`
on arrows. Mathlib: `Paths.lift`, `Paths.lift_spec`, `Paths.lift_unique`. Linearising, a functor
`Paths Q ⥤ ModuleCat k` is the same as a `kQ`-module — the equivalence proved in the lesson. -/
theorem rep_extends {Q : Type u} [Quiver.{w} Q] {k : Type v} [Field k]
(ρ : Q ⥤q ModuleCat.{v} k) :
∃ F : Paths Q ⥤ ModuleCat.{v} k, Paths.of Q ⋙q F.toPrefunctor = ρ ∧
∀ G : Paths Q ⥤ ModuleCat.{v} k, Paths.of Q ⋙q G.toPrefunctor = ρ → G = F :=
⟨Paths.lift ρ, Paths.lift_spec ρ, fun G hG => Paths.lift_unique ρ G hG⟩What is and is not formalised. Proved here: associativity of path multiplication with zero, orthogonality of the trivial idempotents, the length bound for acyclic quivers, infinitely many paths in the presence of a cycle, and the length of paths in . From Mathlib: associativity of concatenation and the universal property of the free category. Not formalised: as a -algebra (it is the contracted semigroup algebra of PathOrZero), the equivalence with -modules, the existence of a height function for every finite acyclic quiver, Theorem 4 and Theorem 5. The research lesson on quiver representations formalises Tits forms and the root combinatorics of .
Paths and barcodes, computed
The first experiment counts paths with powers of the adjacency matrix: it finds for several acyclic quivers (including for linear ), the Cartan matrix whose entries are the dimensions , and the growth of path counts when the quiver has cycles.
"""Counting paths: when is a path algebra finite-dimensional?
The path algebra kQ has a basis of all paths, including one trivial path at
each vertex. If A is the adjacency matrix of Q (A[i][j] = number of arrows
i -> j), the number of paths of length k from i to j is the (i, j) entry of
A^k, so dim kQ = sum over k of the entries of A^k. This is finite exactly when
A is nilpotent, that is, when Q has no oriented cycles; then the Cartan
matrix C = I + A + A^2 + ... = (I - A)^(-1) records dim e_i kQ e_j, the number
of paths from i to j. We compute these for several quivers, and the growth of
the number of paths when there are cycles. Exact integer arithmetic.
"""
def matmul(a, b):
"""Product of square integer matrices."""
n = len(a)
return [[sum(a[i][k] * b[k][j] for k in range(n)) for j in range(n)]
for i in range(n)]
def identity(n):
"""The n x n identity matrix."""
return [[int(i == j) for j in range(n)] for i in range(n)]
def adjacency(n, arrows):
"""Adjacency matrix from a list of arrows (i, j), vertices 0..n-1."""
a = [[0] * n for _ in range(n)]
for i, j in arrows:
a[i][j] += 1
return a
def paths_by_length(a, max_len):
"""Total number of paths of each length 0..max_len."""
counts, power = [], identity(len(a))
for _ in range(max_len + 1):
counts.append(sum(map(sum, power)))
power = matmul(power, a)
return counts
def is_acyclic(a):
"""Q has no oriented cycle iff A^n = 0, n = number of vertices."""
power = identity(len(a))
for _ in range(len(a)):
power = matmul(power, a)
return all(v == 0 for row in power for v in row)
def cartan(a):
"""C = I + A + A^2 + ... for acyclic Q: C[i][j] = paths from i to j."""
n = len(a)
total, power = identity(n), identity(n)
for _ in range(n):
power = matmul(power, a)
total = [[x + y for x, y in zip(r, s)] for r, s in zip(total, power)]
return total
QUIVERS = {
"A_4 linear 0->1->2->3": (4, [(0, 1), (1, 2), (2, 3)]),
"A_4 zigzag 0->1<-2->3": (4, [(0, 1), (2, 1), (2, 3)]),
"D_4, arms into centre": (4, [(1, 0), (2, 0), (3, 0)]),
"Kronecker 0 => 1": (2, [(0, 1), (0, 1)]),
"A_3 cyclic 0->1->2->0": (3, [(0, 1), (1, 2), (2, 0)]),
"one loop (Jordan)": (1, [(0, 0)]),
"two loops": (1, [(0, 0), (0, 0)]),
}
def main():
print("Quiver acyclic dim kQ paths of length 0..6")
for name, (n, arrows) in QUIVERS.items():
a = adjacency(n, arrows)
counts = paths_by_length(a, 6)
dim = sum(map(sum, cartan(a))) if is_acyclic(a) else "inf"
print(f"{name:26} {str(is_acyclic(a)):7} {str(dim):6} {counts}")
lin = [sum(map(sum, cartan(adjacency(n, [(i, i + 1) for i in range(n - 1)]))))
for n in range(1, 9)]
print("dim kA_n, linear A_n, n = 1..8:", lin)
print(" equal to n(n+1)/2:", lin == [n * (n + 1) // 2 for n in range(1, 9)])
print("Cartan matrix of linear A_4 (row i: paths from i to j):")
for row in cartan(adjacency(4, QUIVERS["A_4 linear 0->1->2->3"][1])):
print(" ", row)
print()
print("Epistemic status: exact counts for the listed quivers and lengths. "
"That dim kQ\nis finite exactly for acyclic finite quivers is proved "
"in the lesson (and its\ntwo halves in Lean); the growth figures for "
"cyclic quivers are illustrations.")
if __name__ == "__main__":
main()The second builds random representations of over as sums of interval modules, disguises them by random changes of basis at every vertex, and recovers the multiplicities from ranks alone, using the formula of Theorem 4.
"""Recovering the interval decomposition of a representation of linear A_n.
A representation of 1 -> 2 -> ... -> n over F_p is a list of matrices. The
lesson proves it is a direct sum of interval modules [a, b] (k at vertices
a..b, identity maps inside), and that the multiplicity of [i, j] is
m(i, j) = r(i, j) - r(i-1, j) - r(i, j+1) + r(i-1, j+1),
where r(i, j) is the rank of the composite map V_i -> V_j (and r = 0 when
i = 0 or j = n + 1). We build random representations as sums of known
intervals, hide the decomposition by random changes of basis at each vertex,
and recover the multiplicities from ranks alone. Exact arithmetic mod p,
seeded random examples.
"""
import random
P = 7
def matmul(a, b, p=P):
"""Matrix product mod p (a is m x k, b is k x n, lists of rows)."""
if not a or not b or not b[0]:
return [[0] * (len(b[0]) if b else 0) for _ in a]
return [[sum(x * y for x, y in zip(row, col)) % p for col in zip(*b)]
for row in a]
def rank(mat, p=P):
"""Rank mod p by row reduction."""
rows = [[v % p for v in r] for r in mat]
r = 0
for c in range(len(rows[0]) if rows else 0):
piv = next((i for i in range(r, len(rows)) if rows[i][c]), None)
if piv is None:
continue
rows[r], rows[piv] = rows[piv], rows[r]
inv = pow(rows[r][c], p - 2, p)
rows[r] = [v * inv % p for v in rows[r]]
for i in range(len(rows)):
if i != r and rows[i][c]:
k = rows[i][c]
rows[i] = [(x - k * y) % p for x, y in zip(rows[i], rows[r])]
r += 1
return r
def inverse(mat, p=P):
"""Inverse of an invertible square matrix mod p (Gauss-Jordan)."""
n = len(mat)
aug = [[v % p for v in row] + [int(i == j) for j in range(n)]
for i, row in enumerate(mat)]
for c in range(n):
piv = next(i for i in range(c, n) if aug[i][c])
aug[c], aug[piv] = aug[piv], aug[c]
inv = pow(aug[c][c], p - 2, p)
aug[c] = [v * inv % p for v in aug[c]]
for i in range(n):
if i != c and aug[i][c]:
k = aug[i][c]
aug[i] = [(x - k * y) % p for x, y in zip(aug[i], aug[c])]
return [row[n:] for row in aug]
def random_invertible(n, rng, p=P):
"""A random invertible n x n matrix mod p."""
while True:
m = [[rng.randrange(p) for _ in range(n)] for _ in range(n)]
if rank(m, p) == n:
return m
def interval_sum(n, intervals):
"""Dimensions and maps (V_k -> V_(k+1), rows = target) of a sum of
interval modules [a, b], vertices 1..n."""
dims = [sum(1 for a, b in intervals if a <= k <= b) for k in range(1, n + 1)]
maps = []
for k in range(1, n):
src = [t for t, (a, b) in enumerate(intervals) if a <= k <= b]
dst = [t for t, (a, b) in enumerate(intervals) if a <= k + 1 <= b]
maps.append([[int(s == d) for s in src] for d in dst])
return dims, maps
def disguise(dims, maps, rng):
"""Change basis at every vertex: f_k -> g_(k+1) f_k g_k^(-1)."""
g = [random_invertible(d, rng) for d in dims]
return [matmul(matmul(g[k + 1], f), inverse(g[k]))
for k, f in enumerate(maps)]
def composite_rank(dims, maps, i, j):
"""Rank of V_i -> V_j (1 <= i <= j <= n); 0 outside that range."""
n = len(dims)
if i < 1 or j > n:
return 0
if dims[i - 1] == 0:
return 0
m = [[int(r == c) for c in range(dims[i - 1])] for r in range(dims[i - 1])]
for k in range(i, j):
if dims[k] == 0:
return 0
m = matmul(maps[k - 1], m)
return rank(m)
def multiplicities(dims, maps):
"""{(i, j): m(i, j)} from ranks by inclusion-exclusion."""
n = len(dims)
def r(i, j):
return composite_rank(dims, maps, i, j)
return {(i, j): r(i, j) - r(i - 1, j) - r(i, j + 1) + r(i - 1, j + 1)
for i in range(1, n + 1) for j in range(i, n + 1)}
def main():
rng = random.Random(1972)
n, trials, recovered = 5, 200, 0
example = None
for _ in range(trials):
intervals = sorted((a, b) for a, b in
(sorted(rng.choices(range(1, n + 1), k=2))
for _ in range(rng.randint(1, 6))))
dims, maps = interval_sum(n, intervals)
hidden = disguise(dims, maps, rng)
mult = multiplicities(dims, hidden)
truth = {(i, j): intervals.count((i, j))
for i in range(1, n + 1) for j in range(i, n + 1)}
recovered += mult == truth
if example is None and len(intervals) >= 4:
example = (intervals, dims, hidden, mult)
intervals, dims, hidden, mult = example
print(f"Linear A_{n} over F_{P}: {n * (n + 1) // 2} interval modules "
"[a, b] are the indecomposables.")
print(f"Hidden barcode {intervals}")
print(f" dimension vector {dims}; after random changes of basis the map")
print(f" V_1 -> V_2 is {hidden[0]}")
found = sorted(k for k, v in mult.items() for _ in range(v))
print(f" recovered from ranks: {found}")
print(f"Barcode recovered exactly in {recovered} of {trials} random trials")
print()
print("Epistemic status: exact arithmetic mod 7 on 200 seeded random "
"examples; evidence\nthat the rank formula recovers the "
"decomposition, not a proof. The lesson proves\nthe interval "
"decomposition and the formula for every representation.")
if __name__ == "__main__":
main()Exercises
1. Quivers and path algebras
Warm-upHumanThe quiver has vertices and arrows , and . What is ?
2. Quivers and path algebras
Warm-upHumanFor which of these finite quivers is the path algebra finite-dimensional? (Choose all that apply.)
3. Quivers and path algebras
CoreHumanIn for , with the lesson's convention ( = first , then ), which products are non-zero? (Choose all that apply.)
4. Quivers and path algebras
CoreHumanHow many indecomposable representations, up to isomorphism, does the linearly oriented quiver have?
5. Quivers and path algebras
CoreHumanA representation of has dimension vector , and the composite maps have ranks , , . What is its decomposition into interval modules?
6. Quivers and path algebras
StretchHumanIn the proof that representations of are the same as -modules, where is it used that has finitely many vertices?
7. Quivers and path algebras
CoreFormalWhich Lean statement expresses the half of Theorem 2 proved in cycle_infinite (for a vertex a of a quiver V)?
8. Quivers and path algebras
StretchComputationalFor an acyclic quiver with vertices and a list of arrows (i, j) (from to , repeats allowed), write projective_dims(n, arrows, a) returning the dimension vector of the projective representation : entry is the number of paths from to (including the trivial path when ).
Common misconceptions
Misconception
"The order of multiplication of paths is standard." It is not. This lesson writes for "first , then ", and representations become right modules; texts that multiply like composition of functions write for the same path, and representations become left modules. Neither is wrong, but mixing them silently replaces by its opposite algebra — which is the path algebra of the quiver with all arrows reversed — and exchanges projectives with injectives. Always check a book's convention before using its formulas.
Misconception
"A quiver is just a graph." Orientation and multiplicity matter. and have the same underlying graph but path algebras of different dimensions ( and ) and inequivalent representation categories. Two arrows give the Kronecker quiver, with infinitely many indecomposables, while one arrow gives , with three. What the underlying graph does control, by Gabriel's theorem, is whether there are finitely many indecomposables at all.
Misconception
"Path algebras are always finite-dimensional" — or, conversely, "an infinite-dimensional path algebra has no interesting finite-dimensional representations". A single loop already gives , whose finite-dimensional modules are all square matrices up to similarity. Finiteness of is about oriented cycles (Theorem 2), not about the number of arrows.
Misconception
"The dimension vector determines a representation." For , the representations and both have dimension vector , but the rank of is for the first and for the second. The dimension vector is the first invariant; the ranks of composite maps complete it for (Theorem 4).
Viewpoints
Category theory— Free categories, functors and Yoneda
The paths of form the free category on : objects are vertices, morphisms are paths, composition is concatenation, and every graph morphism from to the underlying graph of a category extends uniquely to a functor . The path algebra is its linearisation — the free -linear category with all objects added together — and a representation is a functor , with morphisms of representations the natural transformations (see categories and functors). The projective is the linearised representable functor , and is the Yoneda lemma. Representations in sets, as in the widget above, are functors to .
Algebra— Every finite-dimensional algebra is a quotient of a path algebra
Path algebras are the free objects among finite-dimensional algebras of a certain kind: is the tensor algebra of the -bimodule spanned by the arrows. Gabriel proved that every finite-dimensional algebra over an algebraically closed field is Morita equivalent to a bound quiver algebra , where — the Gabriel quiver of — has one vertex for each simple module and arrows joining and (oriented according to the chosen convention), and is an admissible ideal of relations (Assem–Simson–Skowroński, Chapter II). So quivers with relations are a universal language for finite-dimensional algebras; for instance the group algebra of a cyclic -group over is , one loop with one relation. Conversely, the basic connected hereditary finite-dimensional algebras over an algebraically closed field are exactly the path algebras of acyclic quivers, with no relations (Assem–Simson–Skowroński, Chapter VII).
Topology— Persistence modules and barcodes
In topological data analysis a point cloud is thickened at increasing scales , giving spaces and, for each degree , a representation of linear — a persistence module. Theorem 4 decomposes it into intervals : homological features (components, loops, voids) born at scale and dying after . This barcode is computed from the ranks exactly as in the formula of Theorem 4, and the stability theorem of Cohen-Steiner, Edelsbrunner and Harer (2007) shows it changes little when the data change little (in the bottleneck distance). Zigzag persistence (Carlsson and de Silva, 2010) uses with arbitrary orientations, where Gabriel's theorem again guarantees interval decompositions (see algebraic topology).
Geometry— Representation spaces and orbits
Fix a dimension vector . All representations with form the affine space , on which the group acts by change of basis; isomorphism classes of representations are its orbits. For the orbits in are the matrices of fixed rank, and orbit closures are the determinantal varieties "rank ". Counting dimensions — against (scalars act trivially) — shows that finitely many orbits force : the Euler form of Theorem 5 again, the starting point of Tits' proof of one half of Gabriel's theorem. Quotients of by in geometric invariant theory give quiver varieties, used for example in Nakajima's geometric construction of representations of Kac–Moody algebras.
History and global context
- Special cases are classical: Karl Weierstrass (1868) and Leopold Kronecker (1890) classified matrix pencils — representations of the Kronecker quiver — and Jordan normal form classifies representations of the loop.
- Israel Gelfand and V. A. Ponomarev solved the four-subspace problem (1970). Pierre Gabriel introduced the word Köcher (quiver) and the general notion of quiver representation, and proved that a connected quiver has finitely many indecomposables exactly when its graph is of type , or (1972). I. N. Bernstein, I. M. Gelfand and V. A. Ponomarev gave a new proof with reflection functors (1973), and the tame quivers (extended Dynkin diagrams) were classified independently by L. A. Nazarova (1973) and by Peter Donovan and Mary Ruth Freislich (1973).
- The Kyiv school of matrix problems (A. V. Roiter, who proved the first Brauer–Thrall conjecture in 1968, and Nazarova), Maurice Auslander and Idun Reiten's almost split sequences (1970s), Claus Michael Ringel's work on tame algebras, and Victor Kac's theorem relating indecomposables to roots (1980) shaped the representation theory of finite-dimensional algebras, now pursued by research groups across Europe, the Americas and Asia; a standard textbook is by Ibrahim Assem (Sherbrooke), Daniel Simson and Andrzej Skowroński (Toruń).
- Persistence: Herbert Edelsbrunner, David Letscher and Afra Zomorodian introduced persistent homology (2002); Zomorodian and Gunnar Carlsson gave its module-theoretic form (2005); Carlsson and Vin de Silva connected it to quiver representations through zigzag persistence (2010).
Further reading
- Ralf Schiffler, Quiver Representations (2014) — an accessible first course: path algebras, the equivalence of categories, Auslander–Reiten theory and Gabriel's theorem.
- Ibrahim Assem, Daniel Simson and Andrzej Skowroński, Elements of the Representation Theory of Associative Algebras, Volume 1 (2006) — bound quiver algebras, Gabriel's theorem on finite-dimensional algebras, hereditary algebras.
- Harm Derksen and Jerzy Weyman, An Introduction to Quiver Representations (2017) — with invariant theory and the geometric viewpoint.
- William Crawley-Boevey, Lectures on Representations of Quivers (1992 lecture notes) — a short, classic introduction including the standard resolution and Gabriel's theorem.
- Alexander Kirillov Jr., Quiver Representations and Quiver Varieties (2016) — from quivers to Lie theory and geometry.
- Steve Y. Oudot, Persistence Theory: From Quiver Representations to Data Analysis (2015) — barcodes, stability and zigzags.