36
An Introduction to Computational Cubical Homology Evan Oman May 18, 2013 Bethany Lutheran College

Senior_Thesis_Evan_Oman

Embed Size (px)

Citation preview

Page 1: Senior_Thesis_Evan_Oman

An Introduction to Computational Cubical Homology

Evan Oman

May 18, 2013

Bethany Lutheran College

Page 2: Senior_Thesis_Evan_Oman

CONTENTS

1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

2. Simplicial Homology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2.1 Complexes and Chains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2.2 Boundary Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2.3 Homology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

2.4 Computing Simplicial Homology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

3. Cubical Homology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3.1 Why a Cubical Space? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3.2 k-cubes and k-chains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3.3 Boundary Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

3.4 Computing Homology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

4. Computational Homology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

4.1 Linear Algebra Over Z . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

4.2 Smith Normal Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

Necessity of Smith Normal Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

The Smith Normal Form Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

4.3 The Homology Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

5. Tools and Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

5.1 CHomP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

5.2 An Application to Minecraft . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

Page 3: Senior_Thesis_Evan_Oman

1. INTRODUCTION

We will begin by identifying an informal, general definition of Homology. Robert Ghrist in [8] states

that: “Homology is a machine that coverts local data about a space into global algebraic structure.” What

he means by this is that homology provides a method of taking the local or geometric configuration of

a Topological Space and transforming it into an algebraic representation which exhibits important global

properties of the given space. We say that the representation is algebraic because the homology process

creates finite products of free abelian groups and cyclic groups whose algebraic properties directly relate to

certain general properties of the topological spaces being analyzed. Clearly then homology and its variants(it

is a large field with many different faces and applications) serve as very useful tools to Topologists but the

title of this paper seems to be looking for applied results. In fact the world of Algebraic Topology, once(and

maybe still to many) the hallmark of extremely abstract mathematics, has recently become a much more

applied science[8]. Then how does the computation of these homology groups serve any purpose outside of

mathematics?

This question then becomes: How do topological spaces relate to the “real world”? Topologist Gunnar

Caarlson bridges this gap by explaining that most modern data sets can be thought of as topological spaces

by defining them as a “point clouds” which are finite sets of points with distance functions applied to

them. Since Geometry and Topology can be thought of as the study of distance functions, we can see how

topology and, consequently, homology, can be applied to these point clouds[2]. So what then is the benefit

of classifying certain data in terms of topology? There are numerous different data analysis tools available

to most researcher so why choose this one over another?

With the daily improvements made to modern data collection techniques, scientific experiments are able

to collect more and more data about a given event. In fact these data sets that are collected begin to pose

a problem: they seem to collect so much data that inferring useful information about an event can become

difficult because the specific desired information is obscured. This difficulty is compounded by the “new

kinds” of data that Caarlson identifies in [2]:

• Sparse vectors which contain a large number of empty(trivial) entries with very few filled entries

• Higher dimensional data which in many cases prevents scientists from visualizing the data in order toinfer structure

• Noisy date with missing information 1

1 This is especially when working with biological data or data which was created through high throughput processes

Page 4: Senior_Thesis_Evan_Oman

So we can see that modern data sets can be large, obfuscated, and generally hard to work with. Recall

then what we said homology can do: turn local data into global algebraic structures which describe key

characteristics. Putting it another way we could say that Homology is a useful tool because it “allows one

to draw conclusions about global properties of spaces and maps from local computations”[10]. So we can

see that homology makes efficient use of the data but as we will see throughout, it is an n-dimensional tool

which can handle the higher dimensional data mentioned by Caarlson.

For a few examples of how homology can be applied we will return to Ghrist’s work in [8]. There Ghirst

identifies three hypothetical applications of homology that expresses its true potential. The first example

describes an array of sensors in a building that can detect the number of people nearby. However the sensors

are so dense that the some data points are counted twice. SO the goal would be to determine the number of

people actually in the building by filtering out those people who are counted twice. Ghirst then decribes how

using Euler Characteristic Integration we can turn the problem into a Topological one to which homology

can be applied. He concludes the example by stating that “Data aggregation is a topological integration.”

Another interesting application that Ghrist identifies has to do with the experimental verification of

chaotic dynamics. The problem is that many physical systems appear to be chaotic but the process of proving

this takes many rigorous years of research. One of the main reasons this verification process is so tedious is

that the data being collected will always have a certain amount of system noise and instrument error which

can make a non-chaotic system seem chaotic. Ghirst then explains how, since topological methods are global,

they are able to ignore this noise in the physical system. He then explains how the Conley Index can be used

to determine chaos in experimental data about a physical system or in a numerical simulation of some system.

Successful implementations of this method, which relies heavily upon computational homology, include the

classification of the dynamics of a magneto-elastic ribbon in an oscillating magnetic field as chaotic and the

discovery of various stable solutions within a simulation of the Kuramoto-Sivashinsky partial differential

equation.

While these applications are still quite abstract, there are a few more simple uses of computational

homology. The definitive text on the subject, Computational Homology[10], focuses on one such example:

image analysis. Here we are working with topological complexes which are used to represent an image2.

Simply stated we are treating each pixel as an elementary piece of the complex. Then computing the

homology of the entire space would tell us important global information which would be the geometric

structure of the image as a whole. Therefore we can see that homology can be used to develop a kind

“low-level” computer vision that can recognize certain shapes and configurations. For further example of

how computational homology has been applied to images see [5] for general computer vision, [7] for pattern

2 Note that while most of the ideas presented from here on will be applicable to the more abstract problem types, the bulkof the discussion, notes, and examples will be focused on the latter example given above concerning image analysis

Page 5: Senior_Thesis_Evan_Oman

2. Simplicial Homology 3

classification, [15] for solving a maze, and [13] for blood vessel topology.

2. SIMPLICIAL HOMOLOGY

We will begin by introducing the idea of Simplical Complexes and the homology of these complexes.

Simplicial Homology is the standard method taught in many topology text books so it is more familiar to

mathematicians in general so we will use the subject as a starting point.

2.1 Complexes and Chains

Simplicial homology is the study of the arrangement of cells withing a complex so we begin with the

definition of a Simplicial Complex:

Definition 2.1.1: Simplicial Complex [9]A simplicial complex K is an ordered pair (V, E) of vertices V = {v1, v2, · · · , vn} and afamily E of non-empty subsets of V whereby for each σ ∈ E whenever τ ⊆ σ then τ ∈ E.

Thus we can think of an Abstract Simplicial Complex as a space containing points, lines, triangles etc.

The final piece of the definition above, “for each σ ∈ E whenever τ ⊆ σ then τ ∈ E” is basically saying that if

we have a triangle in our complex made out of the vertices v1, v2, v3, then the lines made of (v1, v2), (v2, v3),

and (v1, v3), and the points v1, v2, v3 are all contained in the family of subsets E .

We can then think of elements of our complex, such as the triangle made out of v1, v2, v3, as k-simplices:

Definition 2.1.2: k-simplex[9]A k-simplex is the smallest convex subspace of Rn containing a list of k + 1 vertices ingeneral position. We will write k-simplices as

σ = [v0, v1, · · · , vk]

for a k-simplex with vertices v0, v1, · · · , vk.The set of all k-simplices in the simplicial complex K is denoted Kk.

For an example of a k-simplex consider the following simplicial complex X embedded in R2 with the set

of vertices V = {A,B,C,D} and the family of subsets

E = {{A} , {B} , {C} , {D} , {A,B} , {B,C} , {A,C} , {C,D} , {A,D} , {A,B,C} , {A,C,D}}

as shown in Figure 2.1.Then we can see that the elements of X are:

• A,B,C,D ∈ K0

• [A,B], [B,C], [C,D], [D,A], [A,C] ∈ K1

• [A,B,C], [A,C,D] ∈ K2

Page 6: Senior_Thesis_Evan_Oman

2. Simplicial Homology 4

B

C

A

DX

Fig. 2.1: An example of a k-simplex

It is then natural to think of combining elements of Kk to make other elements of Kk. For example we can

combine [A,B] ∈ K2, [B,C] ∈ K1, and [A,C] ∈ K1 to form the perimeter of [A,B,C] ∈ K2.

To introduce the idea of combining simplices we identify Elementary k-chains:

Definition 2.1.3: Elementary k-chainGiven an abstract simplicial complex K an elementary k-chain is an algebraic object σ ∈Kk associated to a k-simplex σ ∈ Kk.

We then combine these elementary k-chains into k-chains.

Definition 2.1.4: k-chainThe group of k-chains of some set X ⊂ Rd is denoted Ck(X) whose elements are linearcombinations of elements from the k-simplex, σ. If c ∈ Ck(X) then

c =∑

σi∈Kk(X)

αiσi

where αi ∈ Z/2Z for all i and σi. As elementary k-chains, each σi represents a basiselement of the group of k-chains, Ck(X).

Then referring Figure 2.1 we can see that the filled square outlined by the vertices A,B,C, and D isactually a sum of two elementary 2-chains:

c1 = [A,B,C] + [A,C,D] ∈ C2(X)

2.2 Boundary Operator

Now that we have established the complexes and chains of a simplicial space, we can introduce the

important idea of finding the “boundary” of a k-simplex.

Consider again Figure 2.1. We can see that the chain

c2 = [A,B] + [B,C] + [A,C] ∈ C1(X)

forms the boundary or perimeter of the lower right triangle [A,B,C]. Then extending this idea informally

we can think of the boundary of a 3-D object(a tetrahedron) to be its faces(the triangles), the boundary of

Page 7: Senior_Thesis_Evan_Oman

2. Simplicial Homology 5

a 2-D object(a triangle) to be its perimeter(the line segments), the boundary of a 1-D object(a line) to be

its end points, and then we define the boundary of a 0-D object(a point) to be 0. Note the the boundary of

each k-dimensional object is itself a (k−1)-dimensional object. We can then identify the boundary operator

as:

Definition 2.2.1: Boundary Operator[17]The boundary operator ∂k : Ck(X)→ Ck−1(X) is a homomorphism defined linearly on achain c by its action on any simplex σ = [v0, v1, v2, . . . , vi, . . . , vk],

∂kσ =∑i

[v0, v1, . . . , vi, . . . , vk]

where vi indicates that vi is deleted from the sequence.

For an example of how the boundary operator functions, consider a 1-chain made of the vertices V =

{A,B,C} and the family of subsets E = {{A}, {B}, {C}, {A,B}, {B,C}} as shown in Figure 2.2.

A B CFig. 2.2: An example of a 1-chain

Then we can see that our boundary of this chain would be:

∂([A,B] + [B,C]) = ∂([A,B]) + ∂([B,C]) = B + A+ C + B = A+ 2B + C = C + A

since the coefficients of the k-chains are elements of Z/2Z. The cancellation of the middle point is desired

because it is not one of the end points of the line.

We can then define subsets of Ck(X) based off of behavior of the boundary operator:

Definition 2.2.2: Cycles and Boundaries[9]We may also define subgroups of Ck using the boundary operator:

• The Cycle Group Zk = ker ∂k

• The Boundary Group Bk = im ∂k+1

For an illustration of these subgroups and how the boundary operator maps them, consider Figure 2.3.

C k

B k−1

Z k−1

C k−1δk+1 δkC k+1

0 00

Z k

kB

Z k+1

k+1B

Fig. 2.3: Illustration of the Boundary Operator Map[17]

In this figure we can see how ∂k maps Ck to its boundary, Bk−1, and maps Zk to 0. Thus we are left

with the important property that

Page 8: Senior_Thesis_Evan_Oman

2. Simplicial Homology 6

∂k ◦ ∂k+1(c) = 0,∀c ∈ Ck(X)

In Figure 2.3 we can see this first because im ∂k+1 is BK ⊂ Zk. Then since ker ∂k = Zk, we know that all

of Zk, including Bk, is sent to 0. For an illustration of how this operation plays out in our example above,

refer to 2.4.

This property of the composition of any two maps equaling the 0 map, along with the fact that our

Ck(X) groups are abelian1, tells us that the string of Ck(X)’s mapped together by ∂k satisfies the conditions

of a Chain Complex:

Definition 2.2.3: Chain Complex[4]Let C be a sequence of abelian group homomorphisms,

· · ·fk+1// Ck(X)

fk // Ck−1(X)fk−1 // · · ·

f2 // C1(X)f1 // C0(X) // 0

Then C is called a Chain Complex if, ∀k,

fk ◦ fk+1 = 0

To see how the chain complex looks like for our example of the line, consider

A B C A C0

1 0

Fig. 2.4: Representation of the Boundary Chain Complex of 2.2

One goal of the classification of chains such as those depicted in Figure 2.1 is to find those cycles which

are not boundaries. In one sense we could say that “cycles that are boundaries are uninteresting and should

be ignored”[10]. The next section will provide tools to find these non-boundary cycles.

2.3 Homology

The fact that the ∂k operators create a chain complex is significant because it introduces the idea of

finding the homology of a space:

Definition 2.3.1: kth Homology Group[4]If C is a chain complex, then its kth homology group is the quotient group:

Hk(C) = ker ∂k/ im ∂k+1

Based off of the above definition it can also be said that

Hk(C) = Zk/Bk

In a very informal sense, this idea of modding out by im ∂k+1 is a way of selecting out the cycles that

are not boundaries. We can think of the homology group as the group where we are sending all those cycles

that are also boundaries to 0 in a similar way that modding out Z by 2Z sends all multiples of 2 to 0.

1 Recall the elements of Ck(X) are merely linear combinations of k-chains under the + operator which is clearly commutative

Page 9: Senior_Thesis_Evan_Oman

2. Simplicial Homology 7

Now that we have defined the idea of creating homology groups out of our groups k-chains, we can look

at the structure of the homology group to find useful information about the objects. First we state the

important theorem:

Theorem 2.3.1: Fundamental Theorem of Finitely Generated Abelian Groups[4]Let G be a finitely generated abelian group. Then

G ∼=r⊕i=1

Z⊕s⊕

ni∈ZZni

Thus we can see that since our homology group is finitely generated and abelian, we can say that it is

isomorphic to a direct sum of groups as depicted above. It is this sum of groups that gives us the most

important property of the Homology Group:

Definition 2.3.2: Free Rank or Betti Number[4]The integer r in the above theorem is called the free rank or Betti number of G.

The Betti number of the kth homology group Hk is denoted βk. For k > 1, βk is the number of non-

equivalent non-bounding k-cycles and this can be interpreted as the number of k-dimensional holes[16]. Thus

we have arrived at the promised global property that the homology group of a topological space expresses:

the structure of the homology group tells us number of “holes” it has in different dimensions. Then we have

the equivalences:

• β0 = Number of “connected components”

• β1 = Number of “holes”

• β2 = Number of “cavities”

•...

......

• βn = Number of n-holes

Consequently we have developed a method of classifying a given k-chain by finding its Topological properties

given through the computation of the nth Homology group.

2.4 Computing Simplicial Homology

Now that we have established what the kth Homology Group can tell us about a k-chain and why, it

would be useful to find the Betti Numbers of a given k-chain. Consider the simplicial complex X shown in

Figure 2.5.

Page 10: Senior_Thesis_Evan_Oman

2. Simplicial Homology 8

B

C

A

X

[A,B]

[A,C] [B,C]

Fig. 2.5: A 1-chain in R2

This complex would have the following sets of elementary chains:

• K0 = {A+ B + C}

• K1 = {A, B + B, C + A, C}

• K2 = {0}

Recall that our Ck(X) groups are linear combinations of elements from Kk. Thus we can write each Ck(X)

in set builder notation where each k-chain is a basis element2:

C0(X) = {α1A+ α2B + α3C | αi ∈ Z/2Z∀i} ∼= Z⊕ Z⊕ Z

C1(X) = {α1 [A,B] + α2 [B,C] + α3 [A,C] | αi ∈ Z/2Z∀i} ∼= Z⊕ Z⊕ Z

C2(X) = 0

For both C0(X) and C1(X) we say that the group of combinations is isomorphic to the group Z⊕Z⊕Z by

the Fundamental Theorem of Finitely Generated Abelian Groups. Thus we would have the Chain Complex

equivalent to

· · · ∂3 // 0∂2 // Z⊕ Z⊕ Z ∂1 // Z⊕ Z⊕ Z ∂0 // 0

where Ck(X) = 0 ∀k ≥ 2.

Then based off of these relations we recall that the elementary chains act as the basis elements of each

Ck(X) group. So we associate a standard basis to each elementary 0-chain

A =

1

0

0

, B =

0

1

0

, C =

0

0

1

2 Note that there are no 2-chains because our triangle is not filled in

Page 11: Senior_Thesis_Evan_Oman

2. Simplicial Homology 9

which collectively generate C0(X) and similarly we associate

[A,B] =

1

0

0

, [B,C] =

0

1

0

, [A,C] =

0

0

1

which collectively generate C1(X).

We can now construct our Boundary Operators ∂k as the matrices:

∂0 = 0

∂1 =

1 0 1

1 1 0

0 1 1

∂2 = 0

which are created row by row so that we map each k-chain to its boundary.

First we will find H1(X) = ker ∂1/ im ∂2. It is clear that

im ∂2 = 0

because ∂2 takes the 0 ∈ C3(X) to 0 ∈ C2(X). Now to find the ker ∂1 we will consider the operation of ∂1

on some arbitrary element

c = α1 [A,B] + α2 [B,C] + α3 [A,C]

Since we are looking for the kernel we need to figure out which combinations of these elements will be mapped

to zero. Thus we have the equation 1 0 11 1 00 1 1

α1

α2

α3

=

000

which, when reduced modulo 2, has a solution space generated by the basis:

111

Thus we know that ker ∂1 ∼= Z and consequently

H1(X) ∼= Z/0 ∼= Z

Following a similar process to that above we find that H0(X) ∼= Z.

Summarizing our findings we have

• H0(X) ∼= Z⇒ β0 = 1

Page 12: Senior_Thesis_Evan_Oman

• H1(X) ∼= Z⇒ β1 = 1

• Hn(X) ∼= 0⇒ βn = 0 ∀n ≥ 2

Then we can conclude that our triangle consists of a single connected component3 having one 2-dimensional

“hole4”, i.e. the empty center of the shape, and containing no higher dimensional holes5. This finding is

consistent with the fact that our triangle is homotopic to the circle S1 which is known to have the same

Betti Numbers.

3. CUBICAL HOMOLOGY

Now that we have reviewed the standard idea of homology, we will introduce the idea of cubical homology,

describe its merits over simplicial homology, and then provide an example computing the homology of a

cubical space.

3.1 Why a Cubical Space?

So why would a cubical space be better in some situations than a simplicial space? In [10], the authors

Kaczynski, Mischaikow, and Mrozek motivate the subject of cubical homology and outline some of the main

benefits that this approach presents. The first point they make is that several types of data, images especially,

break down into natural a cubical representation. If we were to apply a simplicial complex to represent this

naturally cubical data, it would take n! simplices to triangulate a n−dimensional cube. We saw this earlier

because Figure 2.1 took 2 simplices to cover the 2 cube(square) that we will cover with a single cube in

Figure 3.3.

Another point the authors make is in respect to the geometrical makeup of a cube. They point out that

the cube can be represented by a single coordinate, namely the minimal corner point to which we simply

add a unit in each direction to represent the whole cube. Typically a simplex needs every vertex listed

explicitly(as we did in Section 2) in order store the shape. Additionally, a cube has a limit on the maximum

number of other cubes it will border, namely 4 for a cube in R2 and 6 for a cube in R3. This fact can assist

algorithms which safely assume that the boundary is no more that 4 or 6 for the cases listed above. However,

a valid simplex has no limit on the number of bordering elements so those assumptions can not be made.

The authors also note the simplicity of being able to product cubes together. As we will see, the product

of 2 cubes is another cube. However, the product of any two simplices is definitely not another simplex. Thus

3 By β0 = 14 By β1 = 15 By βn = 0 ∀n ≥ 2

Page 13: Senior_Thesis_Evan_Oman

3. Cubical Homology 11

the cubical maps can be computed much more simply because of the similarity between its k dimensional

components. Additionally this inability to product implies that it impossible for higher dimensional simplices

to have a natural projection to lower dimensional simplices. The ability to do so with cubes greatly simplifies

the computation of simple chain maps.

With these befits in mind Kaczynski, Mischaikow, and Mrozek also note that cubical sets are not neces-

sarily the best choice for every situation nor do they say that simplicial sets are completely useless. In fact

the entire field of computer graphics uses triangulations of polyhedra so the practice is not at all without

merit. There are many polyhedra that cucical sets can not represent. Interestingly enough though the ideas

of cubical homology can still be applied to these shapes. In Chapter 11.2 of [10] the authors cover the

CCR reduction algorithm and other techniques which allow computation of cubical homology even if the

polyhedron in question can not be covered by cubes.

3.2 k-cubes and k-chains

Now that justification for using cubical techniques has been provided, we will introduce the cubical

approach to homology. The building block of Cubical Homology is the Elementary Interval:

Definition 3.2.1: Elementary Interval[10]An elementary interval is a closed interval I ⊂ R of the form

I = [l, l + 1] or I = [l, l]

for some l ∈ Z.

Note that intervals of the form [l, l + 1] are considered nondegenerate intervals while those of the form

[l, l] are called degenerate intervals. It is also worth noting that the degenerate intervals are analogous to

the points in a simplicial space and the nondegenerate intervals are analogous to the 1-dimensional lines

of the simplicial space. At first this restriction of our elements to unitary lines may seem restrictive. For

example [1, 3] is not an elementary interval because it has length > 1. However this seeming restriction is

really just a question of scale which can be adjusted depending on the problem at hand. Now that we have

established the fundamental building block of our space we will move on to how these elementary intervals

can be combined into higher dimensional spaces:

Definition 3.2.2: Elementary Cube[10]An elementary cube Q is the finite product of elementary intervals, i.e.

Q = I1 × I2 × I3 × · · · Id ⊂ Rd

where each Ii is an elementary interval. The set of all elementary cubes in Rd is denotedKd. The set of all elementary cubes is denoted by K, namely

K =

∞⋃d=1

Kd

Page 14: Senior_Thesis_Evan_Oman

3. Cubical Homology 12

We can now discuss some of the merits of cubical sets that were alluded to in section 3.1. The represen-

tation of a 3 dimensional cube based off of its lower left coordinate makes sense because if we have the cube

[0, 1]× [0, 1]× [0, 1] we can simply represent it with (0, 0, 0) adding 1 to each direction. Additional the idea of

taking the product of cubes is logical as well because if cubes are the finite product of elementary intervals,

we can think of the product of 2 given cubes as the product of cube1’s intervals with cube2’s intervals.If we let Q ⊂ Rd be an arbitrary elementary cube we can see that Q has the following properties:

• Embedding Number: The embedding number of Q would be the dimension of the space in whichQ is embedded. So embQ = d.

• Dimension: The dimension of Q is said to be the number of nondegenerate intervals in Q denoteddimQ = k.

For an example of an elementary cube, we let

• Q1 = [1]× [4] ⊂ R2

• Q2 = [1, 2]× [3] ⊂ R2

• Q3 = [1, 2]× [1, 2] ⊂ R2

which can be represented as:

-1 4321

-1

4

3

2

1

Q1

Q3

Q2

Fig. 3.1: The Elementary Cubes Q1, Q2, Q3 in R2

So for the cubes above we can think of its position in the standard coordinate form that is customarily

used to denote position:

• Q1 = {(x, y) |x ∈ [1], y ∈ [4]}

• Q2 = {(x, y) |x ∈ [1, 2], y ∈ [3]}

• Q3 = {(x, y) |x ∈ [1, 2], y ∈ [1, 2]}

Then for each elementary cube we have the following properties:

• dimQ1 = 0

• dimQ2 = 1

Page 15: Senior_Thesis_Evan_Oman

3. Cubical Homology 13

• dimQ3 = 2

• embQ1 = embQ2 = embQ3 = 2

We say that a set X ⊂ Rd is cubical if X can written as a finite union of elementary cubes. Therefore

the polyhedra mentioned in Section 3.1 would not be cubical sets because we said they could not be covered

with cubes. We can now define the k-cubes of a Cubical Set X:

Definition 3.2.3: k-cube[10]We define:

K (X) := {Q ∈ K|Q ⊂ X}Kk (X) := {Q ∈ K (X) |dimQ = k}

Where the elements of Kk (X) are called the k-cubes of X.

One can easily see that these k-cubes are analogous to the k-simplices of the simplicial space. Then for

each k-cube Q ∈ Kdk we associate an algebraic object Q ∈ Kdk called an elementary k-chain of Rd. The

combinations of these elementary k-chains would be cubical k-chains:

Definition 3.2.4: Cubical k-chainsWe can consider sums of the form

c =

m∑Qi∈Kd

k

αiQi

where αi ∈ Z to be the Cubical k-chains of a set X ∈ Rd. The set of all k-chains isdenoted Ck(X).

In a similar manner to Simplicial k-chains, we can see that Cdk(X) forms a group under addition of some

c, d ∈ Cdk defined by:

c+ d =

m∑i=1

αiQi +

m∑i=1

βiQi =

m∑i=1

(αi + βi) Qi

Then with addition defined as above we see that ∀c ∈ Cdk , ∃ some c−1 such that c+(c−1)

= 0, namely, given

the arbitrary c above,

c−1 = (−α1) Q1 + (−α2) Q2 + (−α3) Q3 + · · ·+ (−αm) Qm

Therefore it follows that Cdk forms a free abelian group under the commutative operation + with basis Kdk.

For an example of a k-chain refer to Figure 3.1:

• Q1 ⇒ Elementary 0-chain

• Q2 ⇒ Elementary 1-chain

• Q3 ⇒ Elementary 2-chain

Since we are working with elementary intervals in every k-cube in every k-chain, we can easily see that

multiplications of cubes would be useful as well. First we define the scalar product of chains:

Page 16: Senior_Thesis_Evan_Oman

3. Cubical Homology 14

Definition 3.2.5: Scalar Product of Chains[10]

Consider c1, c2 ∈ Cdk , where c1 =

m∑i=1

αiQ1 and c1 =

m∑i=1

βiQ1. The scalar product of

the chains c1 and c2 is defined as:

〈c1, c2〉 :=

m∑i=1

αiβi

This operation, as its title indicates, returns a scalar value, in this case an integer. This operation serves

as a key element of the cubical product:

Definition 3.2.6: Cubical Product[10]Given two elementary cubes P ∈ Kdk and Q ∈ Kd′k′ , set

P � Q:=P ×Q

This definition extends to arbitrary chains c1 ∈ Cdk and c2 ∈ Cd′

k′ by

c1 � c2:=∑

P∈Kk,Q∈Kk′

⟨c1, P

⟩⟨c2, Q

⟩P ×Q.

The chain c1 � c2 ∈ Cd+d′

k+k′ is called the cubical product of c1 and c2.

The differences between simplices and cubes is again exemplified by this definition. We can see that there

is no meaningful way we could product or combine simplices because it is defined in terms of vertices and

not common, defined intervals like the cubes are defined.

The final property of cubes to be discussed is the orientation of a k-cube in R2. The orientation is useful

in determining how one should traverse a given k-cube and plays an important role in the boundary operator

as defined in the next section. We define the orientation of a cube in a counter-clockwise manor as stated in

Figure 3.2

21

2

1

-Q1

-Q4

Q3

Q2

P1

P2 P3

P4

Fig. 3.2: The orientation of a 1-chain

The orientation of a k-cubes provides us with a consistent standard of how to look at the elements of the

given cube. We can then think of P1 being less than P2 in a general sense and based off of how we would

Page 17: Senior_Thesis_Evan_Oman

3. Cubical Homology 15

be traversing the cube. From this orientation we can also see that the line Q1 is defined to have a negative

sigbn because its traversal direction is going toward the lesser coordinate, the same is true for the line Q4.

This convention is then extended to all k-cubes in all dimensions and will play an important role in finding

the boundary of a k-cube as we will see in the next section.

3.3 Boundary Operator

Now that we have a well defined set of operations to work with our cubical sets, we can move on to

finding the boundary of a k-chain with the Cubical Boundary Operator. The basic idea of this function is

exactly the same as it was for the simplicial case but here we have a few more details to add to the operation

of the function so as to prepare this function for use in a computer system.

Definition 3.3.1: Boundary Operator[10]Given k ∈ Z, the cubical boundary operator or cubical boundary map

∂k : Cdk → Cdk−1

is a homomorphism of free abelian groups, which is defined for an elementary chain Q ∈Kdk by induction on the embedding number d as follows:

• Base Case

Let d = 1. Then Q is an elementary interval and hence Q = [l] ∈ K10 or Q =

[l, l + 1] ∈ K11 for some l ∈ Z. Define:

∂kQ :=

{0 if Q = [l]

[l + 1]− [l] if Q = [l, l + 1]

• d > 1 Case

Now assume d > 1. Let I = I1 (Q) and P = I2 (Q) × I3 (Q) × · · · Id (Q). We canthen let

Q = I � P .

and then define

∂kQ:=∂k1 I � P + (−1)dim I

I � ∂k2 P

where k1 = dim I and k2 = dim P .

Finally, we extend the definitions to all chains by linearity; that is, if c = α1Q1 +α2Q2 +· · ·+ αmQm, then

∂kc:=α1∂kQ1 + α2∂kQ2 + · · ·+ αm∂kQm

While this definition of the Boundary Operator contains quite a bit more detail and finer points than the

simplicial operator, the function still maps each Ck(X) down to the next lowest group of chains. Additionally,

the idea of the Boundaries and Cycles with the property that ∂k ◦ ∂k+1 = 0 is analogous to the simplcial

case. Thus in the same manner the boundary maps create the chain complex:

· · ·∂k+1 // Ck(X)

∂k // Ck−1(X) · · · ∂3 // C2(X)∂2 // C1(X)

∂1 // C0(X)∂0 // 0

Page 18: Senior_Thesis_Evan_Oman

3. Cubical Homology 16

with the kth Homology Group again given by

Hk(X) = ker ∂k/ im ∂k+1 = Zk/Bk

Then finally we would be looking again for the direct sum of free abelian groups equivalent to Hk(X) in

order to find our Betti Number as defined in Chapter 2.

3.4 Computing Homology

Now that we have developed an understanding of Homology on a Cubical Set, let us compute the homology

of the figure below:

21

2

1

Q1

Q4

Q3

Q2

P3

P4

P2

P1

Fig. 3.3: A 1-chain in R2

We can see that our elementary chains are:

• P1 = [1]× [2] ∈ K20

• P2 = [1]× [1] ∈ K20

• P3 = [2]× [1] ∈ K20

• P4 = [2]× [2] ∈ K20

• Q1 = [1]× [1, 2] ∈ K21

• Q2 = [1, 2]× [1] ∈ K21

• Q3 = [2]× [1, 2] ∈ K21

• Q4 = [1, 2]× [2] ∈ K21

Then converting these elementary chains to their cubical product counterparts we have:

• P1 ≈ [1] � [2] ∈ K20

• P2 ≈ [1] � [1] ∈ K20

• P3 ≈ [2] � [1] ∈ K20

• P4 ≈ [2] � [2] ∈ K20

• Q1 ≈ [1] � [1, 2] ∈ K21

• Q2 ≈ [1, 2] � [1] ∈ K21

• Q3 ≈ [2] � [1, 2] ∈ K21

• Q4 ≈ [1, 2] � [2] ∈ K21

Page 19: Senior_Thesis_Evan_Oman

3. Cubical Homology 17

Then as an example of the boundary operator we will compute the boundary of each the elementary

intervals defined above according to the boundary operator defined in Section 3.3:

• ∂1(P1

)= ∂1

(P2

)= ∂1

(P3

)= ∂1

(P4

)= 0

• ∂2(Q1

)= ∂2

([1] � [1, 2]

)= −[1] � [1] + [1] � [2] = −P2 + P1

• ∂2(Q2

)= ∂2

([1, 2] � [1])

= −[2] � [1] + [1] � [1] = −P3 + P2

• ∂2(Q3

)= ∂2

([2] � [1, 2]

)= −[2] � [2] + [2] � [1] = −P4 + P3

• ∂2(Q4

)= ∂2

([1, 2] � [2])

= −[1] � [2] + [2] � [2] = −P1 + P4

We can see here that the elements with a negative sign are exactly those elements who are defined as

“greater” or traversed second according to the orientation defined in section 3.3. From the example given

in Chapter 2 for computing Simplicial Homology, we can see that each of the elements given above, as

elementary chains, act as a basis element of their Ck(X) space. Therefore we can define:

P1 ≈ [1] � [2] =

1000

, P2 ≈ [1] � [1] =

0100

, P3 ≈ [2] � [1] =

0010

, P4 ≈ [2] � [2] =

0001

as the generators for C0(X). Then for the generators of C1(X) we have:

Q1 ≈ [1] � [1, 2] =

1000

, Q2 ≈ [1, 2] � [1] =

0100

, Q3 ≈ [2] � [1, 2] =

0010

, Q4 ≈ [1, 2] � [2] =

0001

Then since we have 4 basis elements for each group we can see that our k-chain groups for k = 0, 1 are both

isomorphic to Z⊕ Z⊕ Z⊕ Z giving us the chain complex:

· · · ∂3 // 0∂2 // Z⊕ Z⊕ Z⊕ Z ∂1 // Z⊕ Z⊕ Z⊕ Z ∂0 // 0

Again since there are no k-cubes for k > 1, there are no generators for Ck(X) and we say that these are the

trivial group 0. We can now construct our kth boundary operator with the following set of matrices:

∂0 = 0

∂1 =

1 0 0 −1

−1 1 0 0

0 −1 1 0

0 0 −1 1

∂2 = 0

Again this map is designed so that the operation on say, Q1 =

1

0

0

0

, is equal to its boundary, in this case

Page 20: Senior_Thesis_Evan_Oman

−P2 + P1 =

0−100

+

1000

=

1−100

Then we can see that, based off of the nature of matrix multiplication, the resulting matrix of the above

equation becomes the first column of the boundary operator matrix. Then moving forward in this manner

for each element we find a matrix representation of ∂1. With this construction process in mind it would

be trivial to check the boundary operator on our elements because it would be the reverse of the process

described above.

Now to find the kth Homology Group of this object we will follow a similar method as done in Chapter

2. First we will find H1(X) = ker ∂1/ im ∂2. To find ker ∂1 we operate ∂1 on an arbitrary element of C1(X)

and finding the set of values that map to 0. Thus we have1 0 0 −1−1 1 0 00 −1 1 00 0 −1 1

α1

α2

α3

α4

=

0000

Which, after row reducing, gives us that

α1 = α2 = α3 = −α4

Therefore the solution space has the basis:

111−1

Thus we are left with a group with a single generator and consequently we can say that ker ∂1 ∼= Z.

Now we will compute H0(X) = ker ∂0/ im ∂1. First we can see that ker ∂0 = C0(X) because ∂0 is the

zero map which sends all of C0(X) to 0 which implies that all of C)(X) is in the kernel of ∂0. We will then

say that ker ∂0 ∼= Z⊕ Z⊕ Z⊕ Z = Z4

To find im ∂1 we will use the property of linear maps[6] that:

dim (C1(X)) = rank (∂1) + nullity (∂1) = dim (im ∂1) + dim (ker ∂1)

Then from the computations above we found that dim (C1(X)) = dim(Z4)

= 4 and dim (ker ∂1) =

dim (Z) = 1. Then rearranging and solving we have:

dim (C1(X)) = dim (im ∂1) + dim (ker ∂1)⇒ dim (im ∂1) = dim (C1(X))− dim (ker ∂1) = 4− 1 = 3

Thus im ∂1 ∼= Z⊕ Z⊕ Z. We can then conclude that:

H0(X) = ker ∂0/ im ∂1 ∼= Z⊕ Z⊕ Z⊕ Z/Z⊕ Z⊕ Z ∼= Z

So in conclusion βk = 1 for k = 0, 1 and βk = 0 ∀k > 1. These numbers tell us that the square perimeter

shown in Figure 3.3 has a single connected component, one 2 D hole, and no other higher dimensional holes.

We can then see that based off of these number, the perimeter of the square and the and the triangle are

in the same homotopy class which means that the can be continuously mormphed into one another[9]. This

Page 21: Senior_Thesis_Evan_Oman

4. Computational Homology 19

is a great example of how the computing the homology of a space can quickly highlight important global

properties.

4. COMPUTATIONAL HOMOLOGY

As it has become clear through the computation of homology so far, a lot of work needs to be done

before the homology can be computed. Even the simple example of the triangle and square required a series

of several complicated and tedious steps. These were two dimensional examples of 3-4 components but

this method should be able to be applied to an n-dimensional object with a large number of objects. For

example if we were to analyze a photo in 1080p resolution we would be handling 1080 ∗ 1920 = 2, 073, 600

pixels(2-cubes); far too many to do any kind of efficient computation by hand. Therefore it follows that

there is a need to computerize the process of homology group computation. We will begin with a discussion

of a few Linear Algebra techniques which help make the question of homology a computer question.

4.1 Linear Algebra Over Z

In section 3.4 and 4.4 we saw that it was convenient to represent the boundary operator homomorphism

∂k as a linear map or matrix operator. Thus we can see that the computerizing of the process followed in

section 3.4 and 4.4 will include a fair amount of linear algebra operations in Mm,n(Z). We use matrices to

represent these maps not only because it is convenient but also because the matrices are something that

efficient algorithms have been shown to handle well. Additionally there has been a large body research into

the interaction between computer systems and linear algebra[6].

In order to motivate Algorithm 4.2 we will begin by introducing a few important ideas.

Proposition 4.1.1:Let A be an m × n integer matrix and let B be obtained from A by elementary columnoperations. More precisely, let B := AR, where R is the product of elementary n × nmatrices representing the column operations. Then

imA = imB

and

kerA = R(kerB)

Proof:Let A,B,R ∈Mm,n(Z) such that AR = B. First, since B is the result of elementary oper-ations A, it clearly follows that imA = imB because we know elementary row operationsto be rank preserving.Then for the second piece, since R is invertible we can say that

Page 22: Senior_Thesis_Evan_Oman

4. Computational Homology 20

BR−1 = A

by the right multiplication of R−1 on both sides. Given this equivalence we can say thatfor any x ∈ Zn,

x ∈ kerA⇒ Ax = 0⇒ BR−1x = 0⇒ R−1x ∈ kerA⇒ x ∈ kerAR⇒ x ∈ kerB

Therefore kerA ⊆ kerB. To show kerB ⊆ kerA we follow an identical argument asabove because one can see each implication is an if and only if statement. Then we havekerA ⊆ kerB and kerB ⊆ kerA which implies that kerA = kerB.

The algorithms defined later in this chapter all make heavy use of column operations, thus necessitating

the following proposition:

Proposition 4.1.2:Suppose that A = [aij ] ∈ Mm,n(Z) is in column echelon form. If v1, v2, . . . , vn are thecolumns of A and vk is the last nonzero column of A, then {v1, v2, . . . , , vk} is a basis ofimA and {ek+1, ek+2, . . . , en} is a basis of kerA.

Proof:To show that the submatrix A[i, 1 : k] formed by the columns v1, v2, . . . , vk is a basis ofimA we must show that the columns are linearly independent. By definition of echelonform, we know that since A is in column echelon, AT is in row echelon form. Thenfrom Linear Algebra we know that A[i, 1 : k]T is in row echelon form if and only ifdet(A[i, 1 : k]T ) = d 6= 0 for some d ∈ Z [6]. Then we also know that

det(MT ) = det(M) [6]

Thus we have that det(A[i, 1 : k]) = det(A[i, 1 : k]T ) = d 6= 0. Therefore we can concludethat the columns v1, v2, . . . , vk are linearly independent and clearly form a basis of imA.Then by definition of column echelon form, the remaining submatrix A[i, k+ 1 : m] is thezero matrix which clearly forms a basis of kerA.

With these ideas in mind we move on to our first algorithm which finds the row echelon form of a given

matrix. Note that the following Algorithms 4.1 - 4.7 are quoted directly from Computational Homology[10]

whose authors deserve the full credit for the contents. We will not go through the process of how this

algorithm works because it is a familiar problem within matrices. The algorithm is defined in order to see

exactly what is returned.

Algorithm 4.1: Row echelon

1: function rowEchelon(matrix B)2: m := numberOfRows(B);3: n := numberOfColumns(B);4: repeat5: while l ≤ n and B[k + 1 : m, l] = 0 do6: l := l + 1;

7: if l = n then8: break ;9: end if

10: k := k + 1;

11: (B, Q, Q) := rowReduce(B, Q, Q, k, l);

12: end while13: until k = m

14: return (B, Q, Q, k);

15: end function

Page 23: Senior_Thesis_Evan_Oman

4. Computational Homology 21

We can see that the basic operation of Algorithm 4.1 is to iterate across all of the rows and reduce in a

manner similar to that taught in [6]. For further information leading to an actual implementation of any of

these algorithms consult [10].

We will now state an important theorem about Algorithm 4.1:

Theorem 4.1.1: Given a matrix A ∈ Mm,n(Z), on input rowEchelon returns a matrixB ∈ Mm,n(Z), mutually inverse Z invertible matrices Q,Q ∈ Mm,n(Z), and a number ksuch that B is in row echelon form. Furthermore, exactly the first k of B are nonzero and

B = QA [10]

Therefore we can see that this algorithm returns not only the row echelon form of a given matrix (B),

but also the record of the operations leading to that form (Q), Q’s inverse (Q), and the number of nonzero

rows (k).

We have then laid the foundation for Algorithm 4.2 which returns the bases of the kernel and image of

a matrix A:

Algorithm 4.2: Kernel-image algorithm

1: function kernelImage(matrix B)2: m := numberOfRows(B);3: n := numberOfColumns(B);4: BT := transpose(B);

5: (B, P, P, k) := rowEchelon(BT);

6: BT := transpose(B);

7: PT := transpose(P);

8: return (PT[1 : m, k + 1 : n], BT[1 : m, 1 : k]);

9: end function

To see that this algorithm returns the correct output, recall again Theorem 4.2.1. This theorem tells us

that B = PAT where B is in row echelon form with the first k rows being nonzero. Then by Proposition

4.2.2 we can say that the submatrix BT [1 : m, 1 : k] is a basis of imBT and the remaining submatrix

BT [1 : m, k + 1 : n] is a basis of kerBT . Then since BT = APT and PT is invertible, Proposition 4.2.2 tells

us that imBT = imA. Therefore the columns of V constitute a basis of imA. Then also by Proposition

4.2.2 we have that kerA = PT (kerBT ). So we can see that

PT {ek+1, ek+2, . . . , en ∈ Zn} = PT ek+1, PT ek+2, . . . , P

T en ∈ Zn = basis(kerA)

However these basis elements are exactly the columns of W . Therefore Algorithm 4.2 returns the expected

output.

4.2 Smith Normal Form

Necessity of Smith Normal Form

Now that we have motivated a few basic ideas from linear algebra which will allow us to find the kernel

and image of a given matrix map, we will focus in on a more specific problem: maintaining the integer

Page 24: Senior_Thesis_Evan_Oman

4. Computational Homology 22

entries of our matrices. The bulk of linear algebra focuses on solving a system of equations over the reals.

Therefore fractional matrix entries are allowable. However since we are still working with elementary intervals

and boundary maps, we should never have a non-integer matrix entry. The problem is that fulfilling this

requirement is a nontrivial process. To begin developing tools to ensure integer matrix values we will

introduce the Smith Normal Form of a matrix.

Definition 4.2.1: Smith Normal Form[11]Let A ∈Mm,n(Z) be a nonzero matrix. Then we say that the Smith Normal Form of A isthe matrix

M =

α1 0 0 · · · 00 α2 0 · · · 0

0 0. . . 0

... αr...

0. . .

0 · · · 0

where the diagonal elements αi satisfy αi|αi+1∀1 ≤ i ≤ r. The elements αi are unique upto multiplication by a unit and are called the elementary divisors, invariants, or invariantfactors.Note that since the matrix M is formed by a series of elementary row and column opera-tions we can say that there exists some matrix P corresponding to the column operationsand then some other matrix R corresponding to the row operations. Then we can say that:

M = PAR

The Smith Normal Form of a matrix is then a specific way of solving for the solution set of a matrix

where only integer entries are wanted. However the more significant result of the Smith Normal Form of a

matrix has to do with computing our homology groups.

Recall the worked examples of computing homology in sections 2.4 and 3.4. We saw that we can represent

the boundary operator ∂k : Ck → Ck−1 relative to the standard bases of the chain groups1 as an integer

matrix Ak with entries in {−1, 0, 1}2. The matrix is called the standard matrix representation of ∂k with

mk columns and mk−1 rows(the number of k−cubes and (k − 1)−cubes respectively). Again as we saw in

our worked example, imAk = Zk(the set of cycles) and kerAk = Bk−1(the set of boundaries). Then an

algorithm reducing Ak to its Smith Normal Form derives alternate bases for the chain groups, relative to

which the matrix for ∂k is diagonal. The algorithm would utilize elementary row and column operations on

Ak which would correspond to a change in basis for Ck / Ck−1. We continue performing these operations

until we reach the Smith Normal form of Ak which we call Mk. Then we have the important property that

rk = rankAk = rankMk[17]

1 i.e. the set of elementary chains Kk

2 Where the sign of the element was defined according to the boundary operator function and therefore the orientation ofthe element

Page 25: Senior_Thesis_Evan_Oman

4. Computational Homology 23

It is important to note here that the subscript k in the above equation tells us that we are working with

the kth boundary operator ∂k. Then computing the Smith Normal Form for all dimensions we get a full

characterization of Hk:

• {ei|rk ≤ i ≤ mk} is a basis for Zk. Therefore rankZk = mk − rk

• {αiei|1 < i < rk} is a basis for Bk−1. Equivalently, rankBk = rankAk+1 = rk+1

Then combining these two facts we can say that:

βk = rankZk − rankBk = mk − rk − rk+1[17]

Therefore we can see the significance of computing the Smith Normal form of our boundary operator

matrices because this method, which is contrived in order to be performed easily by computers, allows us to

write programs to automate the work done in Sections 2.4 and 3.4.

So for an example let us consider the matrix

A1 =

1 0 0 −1−1 1 0 00 −1 1 00 0 −1 1

from section 3.4 where we were computing the homology of the boundary of a square. Therefore we can see

that A1 is the matrix representation of the boundary map ∂1. Then computing the Smith Normal Form3 of

A1 we find that

M1 =

1 0 0 00 1 0 00 0 1 00 0 0 0

Based on the properties of this reduced matrix which are outlined above, we can say that:

r1 = 3 = rankA1 = rankB0

rankZk = m1 − r1 = 4− 3 = 1

which both agree exactly with the results computed much more arduously in section 3.4.

The Smith Normal Form Algorithm

Now that we have identified the essential utility of the Smith Normal Form of our boundary operator

matrices we can move on to how we will go about computing the Smith Normal Form of a Matrix.

The basic idea of Smith Normal Form is very similar to that of Row Echelon Form. We will perform a

series of row and column operation until we arrive at a matrix with the desired properties. The difference in

this case is that we are looking for a different form: one where the series of diagonal entries is sequentially

divisible. In order to keep track of the elementary row and column operations we augment our matrix A in

the following manner: (I A0 I

)3 A process which will be covered in the following subsection

Page 26: Senior_Thesis_Evan_Oman

4. Computational Homology 24

Then reducing to Smith Normal we arrive at the following form of the above matrix:(P M0 R

)where M is in Smith Normal Form, P is a record of all the row operations because we can see that only row

operations on A will affect P , and then similarly R is the record of all the column operations because it is

only these operations that change P . Then we can see that

M = PAR

as required in the definition of Smith Normal Form.

We then define the following algorithm which represents the recursive step of this process.

Algorithm 4.3: Partial Smith form algorithm

1: function partSmithForm(matrix B, Q, Q, R, R, int k)2: m := numberOfRows(B);3: n := numberOfColumns(B);4: repeat5: (B, Q, Q, R, R) := moveMinNonzero(B, Q, Q, R, R, k);

6: (B, Q, Q) := partRowReduce(B, Q, Q, k, k);

7: if B[k + 1 : m, k] 6= 0 then8: next;9: end if

10: B, R, R) := partColumnReduce(B, R, R, k, k)

11: if B[k, k + 1 : n] 6= 0 then12: next;13: end if14: divisible, i, j, q) := checkForDivisibility(B, k);

15: if not divisible then16: (B, Q, Q) := rowAddOperation(B, Q, Q, i, k, 1);

17: (B, R, R) := columnAddOperation(B, R, R, k, j, -q);

18: end if19: until divisible20: return (B, Q, Q, R, R);

21: end function

We can see that in the parameters list we pass in where we are at in the reduction process where k

denotes which column the algorithm is working on. Then using making repetitive use of this step we can

define the following important algorithm:

Page 27: Senior_Thesis_Evan_Oman

4. Computational Homology 25

Algorithm 4.4: Smith Algorithm

1: function smithForm(matrix B)2: m := numberOfRows(B);3: n := numberOfColumns(B);4: Q := Q := identityMatrix(m);

5: R := R := identityMatrix(n);

6: s := t := 0;

7: while B[t + 1 : m, t + 1 : n] 6= 0 do8: t := t + 1;

9: (B, Q, Q, R, R) := partialSmithForm(B, Q, Q, R, R, t);

10: if B[t, t] < 0 then11: (B, Q, Q) := rowMultiplyOperation(B, Q, Q, t);

12: end if13: if B[t, t] = 1 then14: s := s + 1

15: end if16: end while17: return (B, Q, Q, R, R, s, t);

18: end function

Algorithm 4.3 returns a matrix B which is the Smith normal form of the input matrix A, a matrix Q and

its inverse Q which represents the row operations on A, matrix R which represents the column operations

on A, R’s inverse matrix R, and then 2 integers s and t. These two integers tell us about the structure of

our Smith normal form matrix by giving the number of 1’s along the diagonal s and then the total number

of nonzero diagonal entries and therefore the rank of the matrix A.

The authors of [10] then go and define an application of Smith normal form: solving systems of linear

equations over the integers. Most solving techniques employed in Linear Algebra solve over the field of the

reals and therefore do not pay attention to whether or not a solution set is integer valued or not. As an

example consider the simple diagonal matrix

A =

2 0 0

0 3 0

0 0 4

We can see that detA = 24 6= 0 which would typically indicate linear independence and tell us that we

can find solutions for equations of the form Ax = b. However by letting b =

1

1

1

we can see that standard

row reduction returns fractions. To combat this we may scale the solutions set by multiples of 12, the least

common multiple of these values. Approaching this problem from the direction of divisibility introduces how

the Smith normal form is useful: the tth diagonal returned by Algorithm 4.4 is exactly the least common

multiple of the diagonal values. With this in mind, we introduce Algorithm 4.5 which returns the integer

solutions of a linear system if they exist and reuturns “Failure” if they do not.

Page 28: Senior_Thesis_Evan_Oman

4. Computational Homology 26

Algorithm 4.5: Linear Equation Solver

1: function Solve(matrix A, vector b)2: m := numberOfRows(B);3: (B, Q, Q, R, R, s, t) := smithForm(A);

4: c := Q ∗ b;

5: vector u;

6: for i := 1 to t do7: if B[i, i] divides c[i] then8: u[i] := c[i]/B[i,i];

9: else10: return "Failure";

11: end if12: end for13: for i := t + 1 to m do14: if c[i] 6= 0 then15: return "Failure";

16: else17: [i] := 0;18: end if19: end for20: return R ∗ u;

21: end function

This algorithm then returns R ∗ u which is solution of Ax = b and makes use of the fact that the Q,B,

and R values returned by Algorithm 4.4 in order to satisfy the equation B = QAR. Using this and the

equation that we are trying to solve we can see that

BRx = Qb

Then we let c = Qb and u := Rx. We can see that the above equation has an integer solution if and only

if

Bu = c

has an integer solution. However since B is in Smith normal form, the latter equation has an integer solution

if and inly if B[i, i]|ci for i = 1, 2, . . . , t and ci = o for i = t + 1, t + 2, . . . ,m. We can see the check for the

former part of this requirement in lines 7 and 8 of Algorithm 4.5 and then the check for the latter requirement

in line 14.

Kaczynski, Mischaikow, and Mrozek then apply the algorithms defined above to create the following

algorithm with finds the quotient group H/G where H is generated by the set V and G is generated by the

set W .

Page 29: Senior_Thesis_Evan_Oman

Algorithm 4.6: Quotient Group Finder

1: function quotientGroup(matrix W, V)2: n := numberOfColumns(V);3: matrix A;

4: for i := 1 to numberOfColumns(V) do5: A[i] := Solve(W, V[i]);

6: end for7: (B, Q, Q, R, R, s, t) := smithForm(A);

8: U := W ∗ Q;

9: return (U, B, s);

10: end function

What this algorithm returns is not only the quotient group G/H but it is in terms of the product of

groups as defined by the Fundamental Theorem of Finitely Generated Abelian groups. Namely, the output

U = [u1u2u3 . . . um] where

[u1] = [u2] = [u3] = · · · = [us] = 0

and where [ui] is equal to B[i, i](where B is the Smith Normal Form of the solution matrix for W and V )

for s < i < m and of infinite order for n < i < m. Thus we have the quotient group:

G/H =

n⊕i=s+1

〈[u1]〉 ⊕m⊕

i=n+1

Z [ui]

We can see that the first half of this summation corresponds to the free abelian group portion of our

free abelian group theorem. Thus in this case we have that the Betti number would be n. Then the second

portion would be the sets of cyclic groups. For a complete proof of the correctness of this algorithm see [10]

4.3 The Homology Algorithm

Now that we have identified the key tools needed to compute the Homology of a given cubical set we

will state the general homology algorithm. The function follows a very similar process to the one we used

in sections 2.4 and 3.4: create chain groups from the data set by creating products of Z-modules generated

by the basis elements4, create the boundary operator matrices from the boundary operator like we did in

section 3.4, and then find the homology groups from these matrices using the ideas of Algorithm 4.6. This

algorithm even goes as far as to return the generators of homology which can be useful for other applications

which require more specific information about the space. The algorithms and processes used by Algorithm

4.7 are non-trivial problems which take quite a bit of motivation in order to undertand and operate. For a

full description of the gritty details, again, consult [10]. We then introduce Algorithm 4.7 which takes in a

cubical set such as Figures 3.3 and 3.1 and then returns the homology group and generators.

We can see that this algorithm then is most certainly not efficient, especially considering some of the

functions called have higher order complexity because they have been written to express ideas rather than

4 The elementary chains in Kk

Page 30: Senior_Thesis_Evan_Oman

5. Tools and Applications 28

Algorithm 4.7: Homology group of a cubical set

1: function homologyGroupOfChainComplex(Cubical Set K)2: E := cubicalChainGroups(k);

3: D := boundaryOperatorMatrix(E);

4: H := homologyGroupofChain(D);

5: H := generatorsofHomology(H,E);

6: return H;

7: end function

provide a solution with minimal cost. This is especially true for smithForm because it takes a dedicated

inquiry into efficiency methods in order to create an algorithm that will terminate within a lifetime[3].

5. TOOLS AND APPLICATIONS

Now that we have developed the fundamental ideas of computing homology and provided a viable algo-

rithm to compute the homology of an arbitrary set of cubes in Rn, we will turn to a working implementation

of these ideas. We will begin by discussing an existing project employing the algorithms given in Chapter 4

and then we will use this implementation to provide an application to the game of Minecraft.

5.1 CHomP

ChomP, short for the Computational Homology Project, is a series of Computational Homology tools

hosted by Rutgers University and was written primarily by M. Allili, Z. Arai, M. Gameiro, T. Kaczynski,

W. Kalies, K. Mischaikow, M. Mrozek, P. Pilarczyk, and T. Wanner. The project consists of C++ libraries

which implement extremely optimized versions of the functions discussed in Chapter 4. In fact the algorithms

used to compute homology in CHomP may look entirely different than the algorithms we defined because

the authors of CHomP exploit short cuts and reductions in order to minimize run time. One of the more

significant short cuts these functions take is the reduction of a given space into a topologically equivalent

one with the same homology. For an illustration of the benefit of this process, see Figure 5.1.

Page 31: Senior_Thesis_Evan_Oman

5. Tools and Applications 29

Fig. 5.1: An example of how the reduction of a cubical set greatly simplifies the computation process[12]

We can see in this figure that the lower route analyzes the entire set of cubes without reduction and then

computes the smith normal form of the boundary matrix which is a very large and very sparse matrix which

is clearly inefficient. Alternatively, if we were to take the upper route and first reduce the the cubical set into

a much smaller, topologically equivalent one, we save our selves the costly computation of the Smith normal

form. So we can see that Algorithm 4.7 has considerable room for improvement which is logical because

throughout its development we focused on finding clear and transparent solutions, not efficient ones.

We will now discuss how CHomP can be used for Computational Homology on most computer systems.

CHomP consists of a series of command line utilities which each perform important tasks on a specified

input file. The most significant program is chomp.exe because it uses the most efficient algorithm in order

to quickly solve for the Betti numbers of a given input set. In fact CHomP has the choice of several different

homology algorithms and it chooses the optimal algorithm based on the properties of the input[1]. To make

the program even more useful, the authors of CHomP have designed chomp.exe so that it accept several

different file formats including multidimensional bitmaps, text bitcodes, text lists of cubes, text lists of

cubical cells, and Windows bitmaps[1]. The text list of cubes format is denoted with the .cub file extension

and simply lists the minimal coordinate of each cube in the set in a similar manner to the idea mentioned

in section 3.1.

So as an example we will use CHomP to compute the homology of the Windows bitmap depicted in

Figure 5.2. First we note that this image is identical to the square example given in section 3.4 so we should

arrive at the same Betti numbers. Then all we would have to do is run chomp.exe on the given bitmap

image:

./chomp.exe ./circle.bmp

which then returns the following values:

1 1 0

Page 32: Senior_Thesis_Evan_Oman

5. Tools and Applications 30

Fig. 5.2: A bitmap image of a square with file name circle.bmp

which are exactly our Betti numbers for k < 3. So we can see that β0 = 1, β1 = 1, and βk = 0 ∀k > 1. This

result then agrees exactly with our findings in Section 3.4.

5.2 An Application to Minecraft

Now that we have identified an existing implementation of the ideas of computational homology, we can

consider a great example of how useful homological analysis can be. We will then be applying the ideas of

computational homology to the open world video game Minecraft. Minecraft is a building/survival/mining

game that immerses its players into a world consisting of cubes which can be mined/harvested and then

rearranged to create useful structures. While the original goal of the game is to build structures strong

enough to survive the nightly attacks by “creepers,” most players use the game to make amazing, accurate,

and sometimes scale models of places, monuments, vehicles, and other interesting objects.

Since the Minecraft world is composed completely out of cubes(elementary 3-cubes), I thought it would

be both interesting and natural to consider the homology of a given Minecraft spaces as an example of

the usefulness of results of computational homology. The first step towards this application is somehow

reading out the cubes of a given Minecraft level. Fortunately there is a project made by MIT students called

Minecraft.print() which outputs a defined section of a Minecraft level for printing by a 3D printer. I was able

to rework the code of this program so that rather than returning a .stl file which is used by a 3D printer,

the program would return a .cub file which can then be used to compute the homology of a given Minecraft

object. The process of making a chomp friendly file was to find all the non-air cubes within the marked space

and then store the minimal coordinate of each cube as (xmin, ymin, zmin) as per the .cub requirements.

We therefore have a method to export items from the Minecraft world in order to compute their homology

using comp.exe. We will begin with the examples as shown in Figure 5.3. We can see that both figures were

created in Minecraft and then exported through the process outlined above. Note that the visualization of

Page 33: Senior_Thesis_Evan_Oman

5. Tools and Applications 31

these elements is created by the showcubes.exe CHomP program which reads a .cub file and renders it

using OpenGL in wxWidgets[1].

(a) 1 0 1 0 (b) 1 1 0 0

Fig. 5.3: Two OpenGL visualizations of shapes created in Minecraft with their chomp.exe computed Betti numbers.

The Betti number of each shape is listed below the shape in Figure 5.3. From these numbers we can tell

that cube (a) actually has an empty center since it has β2 = 1 which tells us there must be one cavity. We

also see that cube (b) has a single 2-D hole and a single connected component as we would expect.

A final simple shape that we will analyze is shown in Figure 5.4

Fig. 5.4: A cube with open faces

This shape demonstrates interesting topological properties that become transparent after computing the

Page 34: Senior_Thesis_Evan_Oman

5. Tools and Applications 32

homology using chomp.exe. Running CHomP returns the values 1 5 0 0. The first number is logical

because there is a single connected component but why are there 5 2-D holes instead of 6? If you look closely

you can see that all six faces are indeed open, there is no trick here. Instead this shape demonstrates some

of the ideas of homotopy which states that the above shape can be projected down into R2 to the equivalent

shape shown in Figure 5.5.

Fig. 5.5: The projection of Figure 5.4 down to Z

It is clear then that this shape has 5 2D holes as the Betti numbers indicate. This is an example of how

computing the homology of a space can give very precise topological information that is not apparent upon

visual analysis.

However the real application to Minecraft comes from a different route than the contrived examples given

above. One of the main goals of Minecraft as mentioned earlier, is mining. The goal of this mining process

is to collect valuable resources which can be used to beautify a creation or trade online for other resources.

The most valuable of these resources is the diamond ore which can be used to trade, embellish, or make

tools and weapons which are tougher than any other material game. Therefore we have a system similar to

the real world where valuable resources are hidden in maze of rock, gravel, and other undesirable material.

One step to finding these resources is determining how “porous” the space we are working with is.

For an example of this hypothetical situation consider the section of a Minecraft level shown in Figure

5.6

Running chomp.exe on this data set, which ended up consisting of almost 7 million cubes and weighing

about 80 Mb, quickly1 gives us the Betti number summary: 28 2509 917 0. The first number is larger

because we can see in Figure 5.6 that some tree cubes were cut off adding to the # of connected components.

The second number gives us that the number of 2-D holes is a staggering 2509. Then finally we see that the

1 In about 25 seconds on my machine

Page 35: Senior_Thesis_Evan_Oman

5. Tools and Applications 33

Fig. 5.6: A large section of a Minecraft level

number of cavities is an impressive 917. With this information and continued testing to find the number of

diamond ore cavities a dedicated miner could begin to develop new strategies based off of these analyses.

For example further testing could be done to determine the number of clumps of diamond ore exposed to

air compared to the clumps surrounded by rock. This ratio could then tell a miner whether it would be

opportune to mine the section or to explore the caves of that section. The applications that CHomP then

allows are endless.

Computing the homology of this space serves as an interesting example of how much important infor-

mation computational homology can infer from a data set. Counting holes in a 2-D image does not seem

like too much of an accomplishment but the enumeration of cavities in a 3-D space is a much less trivial

problem. However homology can solve the problems using these same methods. This is the beauty of this

subject and mathematics in general: the same ideas of computational homology that can be applied to 2-D

images just as easily as 3-D object can also be applied to Nonlinear Dynamics, Data Aggregation problems,

Higher Dimensional Data Analysis, and so much more. The amazing image results given above are merely

the tip of the iceberg of the young and rapidly growing science of computational homology.

Page 36: Senior_Thesis_Evan_Oman

BIBLIOGRAPHY

[1] CHomP software. http://chomp.rutgers.edu/software/, May 2013.

[2] Gunnar Carlsson. Topology and Data. Bulletin of the American Mathematical Society, 46(2):255–307, April

2009.

[3] Jean-Guillaume Dumas, Frank Heckenbach, David Saunders, and Volkmar Welker. Computing simplicial ho-

mology based on efficient smith normal form algorithms. In Algebra, Geometry and Software Systems, pages

177–206. Springer Berlin Heidelberg, 2003.

[4] Dummit and Foote. Abstract Algebra. Wiley, 2004.

[5] Daniel Freedman and Chao Chen. Algebraic Topology for Computer Vision. HP Labs, December 2009.

[6] Friedberg, Insel, and Spence. Linear Algebra. Pearson Prentice Hall, 4th edition, 2003.

[7] Marcio Gameiro and Pawel Pilarczyk. Automatic Homology Computation with Application to Pattern Classifi-

cation. RIMS Kokyuroku Bessatsu, B3:1–10, 2007.

[8] Robert Ghrist. Three Examples of Applied and Computational Homology. Nieuw Archief voor Wiskunde, 2008.

[9] Allen Hatcher. Algebraic Topology. Cambridge University Press, 2002.

[10] Kaczynski, Mischaikow, and Mrozek. Computational Homology. Springer, New York, 2004.

[11] K. R. Matthews. Smith Normal Form. MP274: Linear Algebra, Lecture Notes, University of Queensland, 1991.

[12] Marian Mrozek, editor. Computational Homology in Topological Dynamics, Krakow, Poland, May 2007. Jagiel-

lonian University.

[13] M. Niethammer, A. N. Stein, W. D. Kalies, P. Pilarczyk, K. Mischaikow, and A. Tannenbaum. Analysis of

Blood Vessel Topology by Cubical Homology. In International Conference on Image Processing, 2002.

[14] Pawel Pilarczyk, editor. Computational Homology Project, Kyoto, Japan, 2007. Kyoto University, Department

of Mathematics.

[15] Vanessa Robins. Computational Topology at Multiple Resolutions. PhD thesis, University of Colorado, Boulder,

2000.

[16] Afra Zomorodian and Gunnar Carlsson. Computing Persistent Homology. Discrete & Computational Geometry,

33(2):249–274, 2005.