The history of what today is called the Heine–Borel theorem starts in the 19th century, with the search for solid foundations of real analysis. Central to the theory was the concept of uniform continuity and the theorem stating that every continuous function on a closed interval is uniformly continuous. Peter Gustav Lejeune Dirichlet was the first to prove this and implicitly he used the existence of a finite subcover of a given open cover of a closed interval in his proof. He used this proof in his 1852 lectures, which were published only in 1904. Later Eduard Heine, Karl Weierstrass and Salvatore Pincherle used similar techniques. Émile Borel in 1895 was the first to state and prove a form of what is now called the Heine–Borel theorem. His formulation was restricted to countable covers. Pierre Cousin (1895), Lebesgue (1898) and Schoenflies (1900) generalized it to arbitrary covers.
Let S be a subset of Rn. Observe first the following: if a is a limit point of S, then any finite collection C of open sets, such that each open set U ∈ C is disjoint from some neighborhood VU of a, fails to be a cover of S. Indeed, the intersection of the finite family of sets VU is a neighborhood W of a in Rn. Since a is a limit point of S, W must contain a point x in S. This x ∈ S is not covered by the family C, because every U in C is disjoint from VU and hence disjoint from W, which contains x.
If S is compact but not closed, then it has a limit point a not in S. Consider a collection C ′ consisting of an open neighborhood N(x) for each x ∈ S, chosen small enough to not intersect some neighborhood Vx of a. Then C ′ is an open cover of S, but any finite subcollection of C ′ has the form of C discussed previously, and thus cannot be an open subcover of S. This contradicts the compactness of S. Hence, every limit point of S is in S, so S is closed.
The proof above applies with almost no change to showing that any compact subset S of a Hausdorff topological space X is closed in X.
Let K be a closed subset of a compact set T in Rn and let CK be an open cover of K. Then U = Rn \ K is an open set and
where a > 0. By the property above, it is enough to show that T0 is compact.
Assume, by way of contradiction, that T0 is not compact. Then there exists an infinite open cover C of T0 that does not admit any finite subcover. Through bisection of each of the sides of T0, the box T0 can be broken up into 2n sub n-boxes, each of which has diameter equal to half the diameter of T0. Then at least one of the 2n sections of T0 must require an infinite subcover of C, otherwise C itself would have a finite subcover, by uniting together the finite covers of the sections. Call this section T1.
Likewise, the sides of T1 can be bisected, yielding 2n sections of T1, at least one of which must require an infinite subcover of C. Continuing in like manner yields a decreasing sequence of nested n-boxes:
where the side length of Tk is (2 a) / 2k, which tends to 0 as k tends to infinity. Let us define a sequence (xk) such that each xk is in Tk. This sequence is Cauchy, so it must converge to some limit L. Since each Tk is closed, and for each k the sequence (xk) is eventually always inside Tk, we see that L ∈ Tk for each k.
Since C covers T0, then it has some member U ∈ C such that L ∈ U. Since U is open, there is an n-ball B(L) ⊆ U. For large enough k, one has Tk ⊆ B(L) ⊆ U, but then the infinite number of members of C needed to cover Tk can be replaced by just one: U, a contradiction.
Thus, T0 is compact. Since S is closed and a subset of the compact set T0, then S is also compact (see above).
The Heine–Borel theorem does not hold as stated for general metric and topological vector spaces, and this gives rise to the necessity to consider special classes of spaces where this proposition is true. They are called the spaces with the Heine–Borel property.
Many metric spaces fail to have the Heine–Borel property, such as the metric space of rational numbers (or indeed any incomplete metric space). Complete metric spaces may also fail to have the property; for instance, no infinite-dimensional Banach spaces have the Heine–Borel property (as metric spaces). Even more trivially, if the real line is not endowed with the usual metric, it may fail to have the Heine–Borel property.