A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.
A CW complex is a topological space built inductively by attaching cells (disks) of increasing dimension via continuous maps on their boundaries. Starting from a discrete set of points (0-skeleton), we attach 1-cells (intervals) along their endpoints, then 2-cells (disks) along their boundary circles, and so on. CW complexes are the natural habitat of algebraic topology: they are general enough to model all reasonable topological spaces (every manifold, every polyhedron, every simplicial complex), yet structured enough that homology, cohomology, and homotopy groups can be computed efficiently via cellular methods.
A CW complex is built by an inductive process of cell attachment. Start with a discrete set X0 of points (the 0-skeleton). The n-skeleton Xn is obtained from Xn-1 by attaching n-cells: for each n-cell e_alphan, take a copy of the closed n-disk Dn and glue it to Xn-1 along a continuous attaching map phi_alpha : Sn-1 = boundary(Dn) -> Xn-1. The resulting space is Xn = Xn-1 union_{phi_alpha} Dn (a quotient of the disjoint union that identifies each point of Sn-1 with its image under phi_alpha). The CW complex X is the union X = union Xn with the weak topology: a set is open in X if and only if its intersection with every Xn is open.
The key feature of CW complexes is the flexibility of the attaching maps. In a simplicial complex, simplices must be glued face-to-face with all vertices distinct. In a CW complex, the attaching map phi : Sn-1 -> Xn-1 can be any continuous map — it can collapse part of the boundary, wrap it around multiple times, or map it to a lower-dimensional skeleton. This flexibility allows extremely economical cell structures. The sphere Sn needs only two cells (one 0-cell and one n-cell), the torus needs one 0-cell, two 1-cells, and one 2-cell, and complex projective space CPn needs just one cell in each even dimension up to 2n.
The cellular chain complex of a CW complex gives the most efficient route to computing homology. The n-th cellular chain group is the free abelian group on the n-cells: C_nCW(X) = Znumber of n-cells. The cellular boundary operator d_n : C_nCW -> C_{n-1}^{CW} is determined by the degrees of the attaching maps: the coefficient of en-1_beta in d_n(en_alpha) is the degree of the composite map Sn-1 -> Xn-1 -> Xn-1/Xn-2 = wedge of (n-1)-spheres -> Sn-1_beta. The resulting homology H_nCW(X) is isomorphic to the singular homology H_n(X). For CPn, the cellular chain complex is 0 -> Z -> 0 -> Z -> 0 -> ... -> Z -> 0, and all boundary maps are zero (since there are no adjacent-dimension cells), immediately giving H_{2k}(CPn) = Z.
Two fundamental theorems in homotopy theory demonstrate the centrality of CW complexes. Whitehead's theorem states that a continuous map between CW complexes that induces isomorphisms on all homotopy groups is a homotopy equivalence. This fails for general spaces but holds for CW complexes because of their inductive cell structure. The CW approximation theorem states that every topological space is weakly homotopy equivalent to a CW complex — meaning there exists a CW complex with the same homotopy groups, homology groups, and cohomology groups. Together, these theorems mean that for the purposes of algebraic topology, CW complexes are the canonical class of spaces: every "algebraic topology question" can be answered within the world of CW complexes.