BITS Pilani
CS F364: Design and Analysis of Algorithms

Matroids

Lecture 17 |2026-06-11

Matroids: Definition & Axioms

  • Matroids: Definition & Axioms
  • Examples of Matroids
  • Matroid Properties
  • Summary

Vector Spaces — A Quick Refresher

A vector space V has a notion of linear independence:

  • A set of vectors \{v_1, \dots, v_k\} is linearly independent if no non-trivial linear combination gives \mathbf{0}.
  • A set is linearly dependent if one vector can be expressed as a combination of others.

Example: In \mathbb{R}^3, the vectors (1,0,0), (0,1,0) are independent. Adding (1,1,0) makes the set dependent.

Basis of a Vector Space

A basis B of a vector space V is a maximal linearly independent set — equivalently, a minimal spanning set.

Key properties of bases:

  • All bases of V have the same cardinality — called the dimension of V.
  • Every vector in V can be written uniquely as a linear combination of basis vectors.

Examples:

  • \mathbb{R}^n: standard basis \{e_1, \dots, e_n\} has n vectors.
  • \mathbb{R}^2: both \{(1,0), (0,1)\} and \{(1,2), (3,5)\} are bases — same size.

Exchange Property of Bases

The defining property of bases in vector spaces is the exchange property:

Lemma

Let A and B be two bases of V. For any a \in A \setminus B, there exists b \in B \setminus A such that (A \setminus \{a\}) \cup \{b\} is also a basis.

This is not true for arbitrary families of sets — it is a special property of linear independence.

Matroids abstract exactly this property and apply it to other structures (graphs, partitions, etc.).

Matroids

  • Matroids are combinatorial structures that generalize the notion of linear independence in vector spaces.
  • A matroid M = (E, \mathcal{I}) consists of:
    • A finite ground set E.
    • A family \mathcal{I} of subsets of E called independent sets.
  • Two axioms define \mathcal{I}:
    • (I1) Hereditary property: If X \in \mathcal{I} and Y \subseteq X, then Y \in \mathcal{I}.
    • (I2) Exchange property: If X, Y \in \mathcal{I} and |Y| > |X|, then \exists e \in Y \setminus X such that X \cup \{e\} \in \mathcal{I}.

Why Matroids?

  • Matroids capture exactly the structures where the greedy algorithm finds an optimal solution.
  • Many greedy-solvable problems are optimization over matroids.
  • Examples — all satisfy the same exchange property we saw for vector spaces:
    • Graphic matroid: Independent sets = acyclic edge sets (forests)
    • Uniform matroid: All subsets of size \le k
    • Linear/Vector matroid: Linearly independent vectors
    • Partition matroid: At most one element from each partition block
  • Understanding matroids provides a unified theory of greedy optimality.

Examples of Matroids

  • Matroids: Definition & Axioms
  • Examples of Matroids
  • Matroid Properties
  • Summary

Graphic Matroid — Definition

Let G = (V, E) be an undirected graph. Define M_G = (S_G, \mathcal{I}_G):

  • S_G = E (the edges of G)
  • A \subseteq E is independent (A \in \mathcal{I}_G) iff G_A = (V, A) is a forest (acyclic).

Claim: M_G is a matroid.

Proof of (I1): Any subset of a forest is a forest. ✓

Proof of (I2): Let A, B \in \mathcal{I}_G with |B| > |A|. Both G_A and G_B are forests on the same vertex set V.

Recall: a forest with t trees and |V| vertices has exactly |V| - t edges.

Graphic Matroid — Exchange (1)

  • G_A: |A| = |V| - t_A \;\Rightarrow\; t_A = |V| - |A|
  • G_B: |B| = |V| - t_B \;\Rightarrow\; t_B = |V| - |B|
  • Since |B| > |A|, we have t_B < t_A. So G_B has fewer trees.

Thus G_B contains a tree T whose vertices lie in at least two different trees of G_A.

Since T is connected, it contains an edge (u, v) with u and v in different trees of G_A.

Graphic Matroid — Exchange (2)

  • Adding (u, v) to A connects two different trees, creating no cycle.
  • Therefore A \cup \{(u,v)\} \in \mathcal{I}_G, satisfying the exchange property. ✓

Hence M_G = (E, \mathcal{I}_G) is a matroid. ◻

This is called the graphic matroid of G.

Intuition: Exchange Property

The exchange property says: if B is “more independent” than A (larger), then B has an element that can safely extend A.

Graphic matroid intuition:

  • Independent sets = forests (acyclic edge sets).
  • A larger forest B has fewer connected components than a smaller forest A.
  • Since B spans more vertices per component, it must have an edge connecting two different components of A — which cannot create a cycle when added to A.

This is exactly why Kruskal’s algorithm can keep adding edges without forming cycles: any heavier edge that would create a cycle can be skipped.

Example: Uniform Matroid

For a set E and integer k \ge 0, define:

\mathcal{I} = \{ X \subseteq E : |X| \le k \}

This is the uniform matroid U_{n,k} where n = |E|.

  • (I1): Any subset of a set of size \le k also has size \le k. ✓
  • (I2): If |X| < |Y| \le k, pick any e \in Y \setminus X. Then |X \cup \{e\}| \le |X| + 1 \le |Y| \le k. ✓

Example: U_{n,1} means we can pick at most one element — “select the best single item.”

Example: Partition Matroid

Scenario: A company has m departments. From each department E_i, you can select at most c_i representatives for a committee.

  • Ground set E = E_1 \cup E_2 \cup \dots \cup E_m (all employees, partitioned by department).
  • X \subseteq E is independent if it respects every department’s quota: |X \cap E_i| \le c_i for each i.

Example:

  • Dept A has 5 employees (E_1), quota c_1 = 2.
  • Dept B has 3 employees (E_2), quota c_2 = 1.
  • X = \{\text{Alice},\,\text{Bob}\} from Dept A is independent (2 \le 2 ✓).
  • Adding Charlie from Dept A gives |X \cap E_1| = 3 > 2, violating the quota → not independent.

Why it’s a matroid:

  • (I1): Removing people from a committee never violates a quota. ✓
  • (I2): If committee Y has more people than X from some department E_i, then Y has someone from E_i not in X who can safely join X without exceeding c_i. ✓

Application: Selecting the c_i best candidates from each department — greedy works because this is a matroid.

Matroid Properties

  • Matroids: Definition & Axioms
  • Examples of Matroids
  • Matroid Properties
  • Summary

Bases (Maximal Independent Sets)

  • Extension: Given A \in \mathcal{I}, an element x \notin A is an extension if A \cup \{x\} \in \mathcal{I}.
  • A basis (or maximal independent set) is an independent set with no extensions.

Lemma

All bases of a matroid have the same cardinality.

Proof

Let A and B be bases with |B| > |A|. By (I2), \exists e \in B \setminus A such that A \cup \{e\} \in \mathcal{I}, contradicting maximality of A. Thus |A| = |B|. ◻

This common size is called the rank of the matroid.

Rank of a Matroid

  • The rank of M = (E, \mathcal{I}) is:

\text{rank}(M) = \max \{ |X| : X \in \mathcal{I} \}

  • More generally, for S \subseteq E, the rank function is:

\rho(S) = \max \{ |X| : X \subseteq S,\; X \in \mathcal{I} \}

  • Graphic matroid: \rho(S) = |V| - \kappa(S) where \kappa(S) is the number of connected components in (V, S).
  • Uniform matroid U_{n,k}: \rho(S) = \min(|S|, k).

Summary

  • Matroids: Definition & Axioms
  • Examples of Matroids
  • Matroid Properties
  • Summary

Matroid Examples Summary

Matroid Ground Set E Independent Sets Rank
Graphic Edges of G Acyclic edge sets (forests) |V| - \kappa(S)
Uniform U_{n,k} Any n elements Subsets of size \le k k
Partition Disjoint blocks E_i At most c_i per block \sum c_i
Linear Vectors in \mathbb{R}^d Linearly independent sets \dim(\text{span})

Next lecture: How matroids characterize problems where the greedy algorithm works optimally.