Let XX be a topological space. A CW complex structure on XX consists of a filtration by subspaces

=X1X0X1,X=n0Xn,\varnothing=X^{-1}\subseteq X^0\subseteq X^1\subseteq\cdots,\qquad X=\bigcup_{n\ge 0}X^n,

and, for each n0n\ge 0, a set InI_n and continuous attaching maps

φα:Sn1Xn1(αIn),\varphi_\alpha:S^{n-1}\longrightarrow X^{n-1}\qquad(\alpha\in I_n),

such that XnX^n is obtained from Xn1X^{n-1} by attaching nn-disks:

Xn(Xn1αInDαn)/ ⁣(zφα(z) for zDαn=Sn1),X^n\cong \left(X^{n-1}\sqcup\coprod_{\alpha\in I_n}D^n_\alpha\right)\Big/\! \left(z\sim\varphi_\alpha(z)\ \text{for }z\in\partial D^n_\alpha=S^{n-1}\right),

with the quotient topology, where the disjoint union has the topology in which a set is open exactly when its intersection with each summand is open. Here DnD^n is the closed nn-disk, Sn1=DnS^{n-1}=\partial D^n, and for n=0n=0 one uses S1=S^{-1}=\varnothing and D0={}D^0=\{\ast\}, so X0X^0 is a discrete set of points attached to X1=X^{-1}=\varnothing.

The image of the interior of DαnD^n_\alpha is an open nn-cell, denoted eαne^n_\alpha, and its characteristic map DαnXnD^n_\alpha\to X^n restricts to a homeomorphism from int(Dαn)\operatorname{int}(D^n_\alpha) onto eαne^n_\alpha. The cells are pairwise disjoint and XnX^n is the union of the cells of dimensions at most nn.

The structure satisfies two conditions:

  1. Closure-finite: the closure of every cell meets only finitely many cells.
  2. Weak topology: a subset UXU\subseteq X is open if and only if UXnU\cap X^n is open in XnX^n for every n0n\ge0.

The space XX, together with this cell decomposition, is called a CW complex. Its nn-skeleton is XnX^n, and the dimension of a cell eαne^n_\alpha is nn. A finite CW complex has finitely many cells; its dimension is the supremum of its cell dimensions (the empty complex has dimension 1-1).

Examples

The 00-sphere is a CW complex with two 00-cells. Attaching one 11-cell to two 00-cells gives an interval, while attaching its two endpoints to one 00-cell gives a circle. More generally, a sphere SnS^n has a CW structure with one 00-cell and one nn-cell.