This site contains mathematics courses and book drafts and provides image analysis software. Created and run by Peter Saveliev.

# Betti numbers

Betti numbers represent the count of the number of topological features - in digital images, cell complexes, or topological spaces.

For example, in the first image above the number of objects is $6$, so the $0$th Betti number $b_0$ is $6$. The number of holes is $2$, so the $1$st Betti number $b_1$ is $2$ as well.

More generally, the $0$-, $1$-, and $2$-dimensional topological features are:

One might have to go on if we are to study the topology of datasets.

The number of these features in each dimension is captured by the corresponding Betti number: $b_0$, $b_1$, and $b_2$. Examples are in the table below.

$$\begin{array}{} & b_0 ({\rm parts}) & b_1 ({\rm holes}) & b_2 ({\rm voids}) \\ {\rm Letter \hspace{3pt}} O & 1 & 1 & 0 \\ {\rm Two \hspace{3pt} letters \hspace{3pt}} O & 2 & 2 & 0 \\ {\rm Letter \hspace{3pt}} B & 1 & 2 & 0 \\ {\rm Donut} & 1 & 1 & 0 \\ {\rm Tire} & 1 & 2 & 1 \\ {\rm Ball} & 1 & 0 & 1 \end{array}$$

If the geometric figure $X$ has to be specified, we use $b_k(X)$.

In practice, i.e., computer vision and image analysis, you can't count topological features by looking from the "outside". Instead you count "cycles" that capture these features. Counting $0$-cycles and $1$-cycles in 2D is fairly simple. In fact there are many ways to solve this problem without using cycles (see Image analysis examples).

Let's now consider $1$-cycles, i.e., "circular" curves, in 3D. In the torus, there are two main kinds of cycles: the latitudes (one is shown red) and the longitudes (one is shown in blue). The latitudes capture the tunnel inside the tire while the longitudes capture the tunnel through the tire.

Clearly there are many cycles that capture the same topological feature. So, how do you avoid over-counting them? The answer is: if two cycles are "homologous" to each other, they are counted as one. In fact, one way to explain homology is this. Two $1$-cycles are homologous if they together form the boundary of a surface. This is why we understand Homology as an equivalence relation.

Let's analyze:

• Any latitude is homologous to the red cycle because they are the two ends of a tube cut from the tire.
• Any longitude is homologous to the blue cycle because they are the two edges of a strip cut from the tire.

This is why $b_1 = 2$. But what about the "diagonal"?

In the sphere the blue cycle is homologous to a point, a trivial cycle, that's why $b_1 = 0$. Another way to see that the cycle is trivial is to imagine how it can contract to a point like a rubber band. The same thing happens with this kind of cycle on the torus.

To sort this out one needs to turn the set of cycles into a vector space.

An algebraically similar computation is possible via differential forms. It is called cohomology.

Betti numbers are combined together -- as the alternating sum -- to produce the well-known Euler number (aka Euler characteristics). Both are "topological invariants".

See also Topological Features of Images. One can see that many very practical image analysis examples are simply about counting, i.e., Betti numbers.