An n-simplex is the convex hull of n + 1 points v_0, \ldots, v_n in some \mathbb{R}^N that are affinely independent, that is, not contained in an affine subspace of dimension less than n. A point, a segment, a triangle and a tetrahedron are the simplices of dimensions 0 to 3. The faces of a simplex are the simplices spanned by nonempty subsets of its vertices [2].
A simplicial complex is a finite collection K of simplices such that every face of a simplex of K is again in K, and the intersection of any two simplices of K is either empty or a face of each [2]. Its underlying space |K| is the union of the simplices. The three edges of a triangle form a complex whose space is a circle, adding the triangle gives a disk, and the four triangles of a tetrahedron with their edges and vertices give a sphere.
The second condition is what keeps the combinatorics reliable. In the figure, the triangles T_1 = [P, Q, R] and T_2 = [P, M, S] meet along [P, M], half of the edge [P, Q], which is not a face of T_1. Adding M as a vertex and splitting T_1 into [P, M, R] and [M, Q, R] repairs this, and subdividing in this way does not change the underlying space.
An orientation of a simplex is an ordering of its vertices up to even permutations, written [v_0, \ldots, v_n], and the opposite orientation is its negative. Hatcher computes simplicial homology for the more flexible \Delta-complexes, in which a simplex may be glued to itself along faces. The torus then needs only two triangles, while as a simplicial complex it needs at least fourteen [1].
The group C_n(K) of n-chains is the free abelian group with one generator for each n-simplex, oriented once and for all, so an n-chain is a finite sum \sum_i m_i \sigma_i with integer coefficients. The boundary operator \partial_n \colon C_n(K) \to C_{n-1}(K) sends an oriented simplex to \sum_{i=0}^n (-1)^i [v_0, \ldots, \hat{v}_i, \ldots, v_n], where \hat{v}_i means that v_i is left out [1,2].
For a segment, \partial [v_0, v_1] = v_1 - v_0, and for a triangle, \partial [v_0, v_1, v_2] = [v_1, v_2] - [v_0, v_2] + [v_0, v_1], the loop around the triangle. In \partial\partial\sigma every face of dimension two less appears twice with opposite signs, so \partial_{n-1} \circ \partial_n = 0 [1].
The n-cycles Z_n = \ker \partial_n are the chains without boundary, and the n-boundaries B_n = \operatorname{im} \partial_{n+1} are the chains that bound something. Since \partial\partial = 0, every boundary is a cycle, and the homology group H_n(K) = Z_n/B_n measures the cycles that bound nothing. In degree 0, two vertices are homologous exactly when a path of edges joins them, so H_0(K) is free with one generator for each connected component.
The figure divides a hexagon into six triangles \sigma_0, \ldots, \sigma_5 around a center O, all oriented counterclockwise, and adds them one at a time while drawing the boundary of their sum. Each edge from O is shared by two consecutive triangles with opposite orientations and cancels, so \partial(\sigma_0 + \cdots + \sigma_5) is the loop z around the hexagon, and z is a boundary.
Removing the six triangles leaves the hexagon as a complex with six vertices and six edges. The loop z is still a cycle, but no 2-chains remain, so it is no longer a boundary and generates H_1 \cong \mathbb{Z}. The hollow triangle behaves the same way, and filling it in kills its one-dimensional hole: H_1 of the disk is 0.
For a finite complex, every chain group is finitely generated and each \partial_n is an integer matrix. With rational coefficients, \dim H_n = \dim C_n - \operatorname{rank} \partial_n - \operatorname{rank} \partial_{n+1}, because \dim Z_n = \dim C_n - \operatorname{rank} \partial_n and \dim B_n = \operatorname{rank} \partial_{n+1}. Over the integers, the Smith normal form of \partial_{n+1} also gives the torsion of H_n, as in H_1(\mathbb{RP}^2) \cong \mathbb{Z}/2\mathbb{Z}.
The boundary of the tetrahedron has 4 vertices, 6 edges and 4 triangles. Its edges form a connected graph, so \operatorname{rank} \partial_1 = 3, and the boundaries of the four triangles span a space of dimension 3, so \operatorname{rank} \partial_2 = 3. The formula gives \dim H_0 = 4 - 3 = 1, \dim H_1 = 6 - 3 - 3 = 0 and \dim H_2 = 4 - 3 = 1, the homology of the sphere [2].
The figure folds a net of four triangles into the tetrahedron. All four triangles carry the counterclockwise orientation of the plane of the net, and when the net is folded up, its six outer edges are glued in pairs. On each glued edge the two triangles induce opposite directions, so their contributions cancel, and the sum c of the four triangles has \partial c = 0.
The tetrahedron itself, the 3-simplex, is not part of the complex, so c is not a boundary, and it generates H_2 \cong \mathbb{Z}. Adding the 3-simplex makes c the boundary \partial [v_0, v_1, v_2, v_3], up to sign, and kills H_2, just as filling in the triangle killed H_1.
The alternating sum \sum_n (-1)^n \dim C_n equals \sum_n (-1)^n \dim H_n, so the Euler characteristic 4 - 6 + 4 = 2 of the tetrahedron depends only on its homology. Finally, the simplicial homology of K is isomorphic to the singular homology of |K|, so it does not depend on the choice of triangulation [1].