Definition · Independence systemA pair (E, I) where E is a finite ground set and I is a collection of subsets of E, called independent, such that I is nonempty and downward closed: if B is in I and A ⊆ B then A is in I. A maximal independent set is called a basis; the size of a largest one is the rank.
Definition · MatroidAn independence system (E, I) satisfying the exchange property: whenever A and B are independent with |A| < |B|, there is an element x in B but not in A such that A ∪ {x} is independent.
One consequence is worth stating immediately, because it is what the counterexample later violates: in a matroid every basis has the same size. If two maximal independent sets had different sizes, the exchange property applied to the smaller and the larger would produce an element extending the smaller one, contradicting its maximality.
The lab opens on the forests of a four-vertex graph with edges 1-2, 2-3, 3-1, 3-4, 1-4, labelled A to E in that order. A set of edges is independent when it contains no cycle. The oracle is asked about all 32 subsets and accepts 24 of them; the rank is 3, there are 8 bases, and the family is downward closed — dropping an edge from a forest leaves a forest.
Example · The exchange property on 193 pairsThe panel forms every ordered pair (A, B) of independent sets with |A| < |B| — 193 of them on this family — and for each asks whether some element of B can join A. Every one of the 193 succeeds, so the forests of this graph form a matroid. The 8 bases are its spanning trees, and every one of them has 3 edges, which is |V| − 1 for a connected graph on four vertices.
Greedy on this family is an algorithm you already know
Sort the elements by weight and add each one if it keeps the set independent. On the forests of a graph that is Kruskal's algorithm. The one difference from the version proved in the graph course is the direction: matroid greedy maximises, so it sorts heaviest first and builds a maximum spanning tree. With weights 8 6 5 4 2 it takes A, takes B, rejects C because 1-2, 2-3 and 3-1 would close a cycle, takes D, rejects E, and finishes with {A, B, D} worth 18 — the best any independent set can do.
That is the point of the whole construction. The cut property gave a proof of Kruskal that is about graphs: lightest edge crossing a cut, cycles, connectivity. The matroid theorem gives a proof that is about the family of feasible sets and mentions no graph at all, and the same proof then covers families that have nothing to do with graphs.
Two more matroids, and one family that is not
The uniform family takes every subset of at most k elements from a ground set of five. With k = 2 that is 16 sets, rank 2, and all 10 pairs are bases; 65 ordered pairs are tested and none fails. The partition family allows at most one element from each group; with groups 1 1 2 2 3 that is 18 sets, rank 3, 4 bases, 109 pairs, and no failure. Greedy with weights 7 6 5 4 3 takes the heaviest element of each group, {A, C, E}, worth 15.
Example · The matchings of a path are not a matroidGround set: the three edges 1-2, 2-3, 3-4 of a path, labelled A, B, C. A set is independent when no two of its edges share a vertex. The oracle accepts 5 of the 8 subsets: the empty set, each single edge, and {A, C}. The family is downward closed. Of the 7 ordered pairs tested, exactly one fails: A = {B} and B = {A, C}. Neither end can join the middle edge, because each shares a vertex with it.
So this family has two maximal independent sets of different sizes: {B}, which cannot be grown, and {A, C}, which is the only basis. That is the same statement as the exchange failure, and it is the first place on this course where the shape of the feasible family, rather than the rule, is what goes wrong.
It is also the smallest possible instance. Two elements cannot produce a failure — with |A| < |B| ≤ 2 and downward closure, the singleton inside B is available — so three elements is where a non-matroid independence system can first appear, and a path with three edges is the one everybody meets first.
Measured on this page: 24 independent sets of 32 for the forests, rank 3, 8 bases, 193 exchange pairs and 0 failures; 5 independent sets of 8 for the matchings, 7 pairs and 1 failure. Proved on this page: in any matroid all bases have the same size, which the matchings family visibly violates. What is not on this page is the reason any of this predicts whether greedy works — that is a theorem in both directions, and it is next.