# Homological Inclusion-Exclusion and the Mayer-Vietoris sequence

In Algebra, Combinatorics, Homology and Homotopy, Mathematics, Topology.

This blogpost is inspired to a large part by comments made by Rob Ghrist, in connection to his talks on using the Euler characteristic integration theory to count targets detected by sensor networks.

In this blog post, I'd like to give more meat to this assertion as well as point out how the general principle of Inclusion-Exclusion for finite sets follows immediately from Mayer-Vietoris.

## Inclusion-Exclusion, and the passage from two sets to many

If you think this formula is imposing, let me show you the first few ways it works out, so that you can get a feeling for it:

[tex]|A_{1}\cup A_{2}| = |A_{1}| + |A_{2}| - |A_{1}\cap A_{2}[/tex]

Here it starts becoming apparent why it is called the Inclusion-Exclusion formula: we include all elements from all sets, but then we've gotten too many elements from the pairwise intersections, so we exclude those, but then we've gotten too few elements from the triple intersections, so we re-include those, but then we've gotten too few elements from the quadruple intersections - and on it goes.

If our assumption holds, we can consider what the appropriate size of the union of [tex]n[/tex] different sets should be. We can pick one set, say [tex]A_{n}[/tex], and treat it separately. Then, certainly, the union of the rest has size given by the formula, by our induction assumption. So, consider what happens when we add in the elements in [tex]A_{n}[/tex]. We then overcount all elements in any of the intersections [tex]A_{i}\cap A_{n}[/tex], so we have to subtract those. But we then have undercounted all elements in any intersection on the form [tex]A_{i}\cap A_{j}\cap A_{n}[/tex], so we need to add those back in. And so we go on, and for each intersection that occurred in the formula for [tex]n-1[/tex] sets, we find ourselves forced to add one new term, of the opposite sign, that counts the intersection of that old term with [tex]A_{n}[/tex].

Thus, the new formula takes on the exact guise of the general formula we wanted to prove, since the terms involving [tex]A_{n}[/tex] are precisely indexed, in that formula, by the terms excluding [tex]A_{n}[/tex], but with opposite signs.

## Encoding set sizes homologically

So, now that we know that pairwise Inclusion-Exclusion implies the general Inclusion-Exclusion, let us take a look on how we can express Inclusion-Exclusion with homology. We note first of all that [tex]H_{0}(X)[/tex] counts the number of path-connected components of a space [tex]X[/tex]. This follows easily from a few properties. First, a basis for the [tex]0[/tex]-chains of [tex]X[/tex] is given by the points in [tex]X[/tex]. Second, two [tex]0[/tex]-chains are homologous precisely if there is a [tex]1[/tex]-chain whose boundary is the difference between those [tex]0[/tex]-chains. The boundary of a path is the difference of its endpoints, so we end up with two basis elements being homologous precisely if there is a path connecting them.

Thus, two [tex]0[/tex]-chain elements are homologous precisely if they're in the same path-component of [tex]X[/tex]. So, the homology classes of [tex]0[/tex]-chains are precisely the path-connected components.

So, the [tex]0[/tex]-degree homology classes count path-components. How do we use that? Well ... if we consider a finite set [tex]X[/tex] with the discrete topology - i.e. open sets are single points and any unions of single point sets, then a path is a continuous function [tex][0,1]\to X[/tex], i.e. one where the preimage of any open set is open. Thus, the preimage of any point is an open set. Suppose a path contains more than one point. Then we can partition the interval [tex][0,1][/tex] into two disjoint open sets, by taking one set to be the preimage of one of the points, and the other set to be the preimage of everything else. However, the interval [tex][0,1][/tex] is connected, which means that if there are two such open sets, one of them has to be empty.

Thus, the path-connected components of a discrete topological space are the points themselves. So if [tex]X[/tex] is discrete, then [tex]H_{0}(X) = |X|[/tex].

## Long exact sequences in homology and the Mayer-Vietoris sequence

Almost all interesting long exact sequences in topology are special cases of this particular fact. We will derive one interesting sequence: the Mayer-Vietoris sequence from this.

Take a topological space [tex]X[/tex]. The singular chain complex [tex]C_{*}(X)[/tex] forms a chain complex with [tex]C_{n}(X)[/tex] the free abelian group of [tex]n[/tex]-chains and the differential given by the usual formula.

Compatibility of this map with the differential is almost as easy. If we first apply the differential and then map into the direct sum, we get the map [tex]\sigma\mapsto d\sigma\mapsto(d\sigma,-d\sigma)[/tex]. If we instead first map into the direct sum, and then apply the differentials, we get the map [tex]\sigma\mapsto(\sigma,-\sigma)\mapsto(d\sigma,-d\sigma)[/tex]. These are equal, and thus the map we've constructed is a chain map.

So, [tex]C_{*}(X\cap Y)\to C_{*}(X)\oplus C_{*}(Y)[/tex] is an injective map of chain complexes.

If we now have a pair of chains, we can construct a chain on the union of the two spaces. An [tex]n[/tex]-chain on [tex]X[/tex] is automatically an [tex]n[/tex]-chain on [tex]X\cup Y[/tex]. Similarly, an [tex]n[/tex]-chain on [tex]Y[/tex] is automatically an [tex]n[/tex]-chain on [tex]X\cup Y[/tex]. So both [tex]C_{n}(X)[/tex] and [tex]C_{n}(Y)[/tex] inject into [tex]C_{n}(X\cup Y)[/tex] by the same kind of argument as with the injection [tex]C_{n}(X\cap Y)\to C_{n}(X)[/tex].

The injections we get this way can be put together to a map [tex]C_{n}(X)\oplus C_{n}(Y)\to C_{n}(X\cup Y)[/tex] by, for instance, [tex](\sigma,\tau)\mapsto\sigma+\tau[/tex]. I am going to fudge over the issue of whether the [tex]n[/tex]-chains on [tex]X[/tex] and [tex]Y[/tex] form a generating set for the [tex]n[/tex]-chains on [tex]X\cup Y[/tex], and just take it on faith that this works. The details are not particularly difficult - they are just obnoxiously long and annoying.

Now, given that we believe we can get a generating set by taking the union of the bases for the [tex]n[/tex]-chains on [tex]X[/tex] and [tex]Y[/tex], then this means that the map I gave above is surjective. Indeed, a basis element [tex]\sigma\in C_{n}(X)[/tex] is hit by the element [tex](\sigma,0)[/tex], and a basis element [tex]\tau\in C_{n}(Y)[/tex] is hit by the element [tex](0,\tau)[/tex].

## Putting it all together

Suppose [tex]X[/tex] is a discrete topological space. Then any continuous map from a [tex]k[/tex]-simplex [tex]\Delta^{k}[/tex] to [tex]X[/tex] is by necessity constant at one point. So all the singular simplices in [tex]X[/tex] are constant maps, and thus a basis for any [tex]n[/tex]-chain group is given by just the points in [tex]X[/tex] as such. The differential acts on such a constant map by sending it to an alternating sum of identical maps the cardinality of which is one more than the dimension of the simplex. So the differential vanishes at every other point in the chain complex, and is an isomorphism on the rest. But then we have exactly two possibilities for a homology computation:

Case 1: [tex]C_{n}(X)\overset1\to C_{n-1}(X)\overset0\to C_{n-2}(X)[/tex]

Here, the kernel is the entire chain group. But so is the image. Thus the homology group is trivial.

Case 2: [tex]C_{n}(X)\overset0\to C_{n-1}(X)\overset1\to C_{n-2}(X)[/tex]

Here, the kernel is trivial, but then again, so is the image. Thus, again, so is the homology group.

The only part not really covered by this is the homology group [tex]H_{0}(X)[/tex], since this is computed from a diagram on the shape [tex]C_{1}(X)\overset0\to C_{0}(X)\to0[/tex]. So [tex]H_{0}(X)[/tex] behaves like we showed above, and is the only non-trivial homology group of the discrete space.

If we have a short exact sequence of free abelian groups, then this relates the number of basis elements in each of the groups with the structure of the sequence. Let our short exact sequence be given by [tex]0\to A\to B\to C\to 0[/tex]. then, by injectivity of the map [tex]A\to B[/tex], the cardinality of a basis of the image in [tex]B[/tex] is equal to the cardinality of a basis for [tex]A[/tex]. By surjectivity of the map [tex]B\to C[/tex], and by Noether's theorem, the cardinality of a basis of [tex]B[/tex] is equal to the cardinality of a basis of the kernel of this map, plus the cardinality of a basis of [tex]C[/tex]. By exactness in the middle, this kernel basis is equal to the image basis from A. So, we have, writing [tex]|G|[/tex] for the cardinality of a basis of the free abelian group [tex]G[/tex], that [tex]|B| = |A|+|C|[/tex]. Thus, [tex]|A|-|B|+|C|=0[/tex].