Skip to main content
Home
Pimath

Menu EN

  • Home
  • 🌐 EN
    • 🇮🇹 IT
    • 🇪🇸 ES
    • 🇵🇹 PT
    • 🇫🇷 FR
    • 🇷🇴 RO
  • 👨‍🎓 About Me
  • 🚧 Theory & Exercises
User account menu
  • Log in

Breadcrumb

  1. Home

Compact Sets: Definition, Meaning, Examples and Properties

Profile picture for user Pimath
By Pimath, 6 June, 2026

Compact sets are one of the central notions of mathematical analysis. They describe sets which, although they may contain infinitely many points, retain some of the properties typical of finite sets.

The importance of compactness lies in the fact that, on compact sets, many fundamental properties become guaranteed: every sequence of points of the set has a subsequence converging to a point of the set, continuous functions attain a maximum and a minimum, and open covers can be reduced to finitely many open sets.

In this treatment we shall introduce the definition of a compact set by means of open covers, clarify its intuitive meaning, and examine the first fundamental examples. The link between compactness, closedness and boundedness will then be made precise by the Heine–Borel theorem.


Contents

  • The intuitive idea of a compact set
  • Definition of an open cover
  • Definition of a compact set
  • The meaning of the definition
  • First examples of compact sets
  • First examples of non-compact sets
  • Compactness and sequences
  • Compactness and continuous functions
  • Why closed and bounded is not the definition of compact
  • Final summary

The intuitive idea of a compact set

The intuitive idea of compactness is that of a set which displays neither escapes to infinity nor missing points where the set tends to accumulate.

For instance, the interval

\[ [0,1] \]

is a set that looks, intuitively, well under control: it is bounded, because all of its points lie between \(0\) and \(1\), and it is closed, because it also contains its endpoints.

By contrast, the interval

\[ (0,1) \]

does not contain the endpoints \(0\) and \(1\). Even though all of its points still lie between \(0\) and \(1\), the set has two accumulation points that are missing. Indeed, one can get arbitrarily close to \(0\) or to \(1\) while staying inside \((0,1)\), yet neither \(0\) nor \(1\) belongs to the set.

The interval

\[ [0,+\infty) \]

is not compact either. Here the trouble is not a missing endpoint, but the possibility of moving off indefinitely towards \(+\infty\).

Compactness makes precisely this idea precise: a compact set has no escape to infinity and no missing accumulation points. From the standpoint of analysis, it is a set that can be kept under control by means of finitely many pieces of data.


Definition of an open cover

Before defining compact sets, we must introduce the notion of an open cover.

Throughout this treatment, whenever we speak of open subsets of \(\mathbb R\), we shall always mean open sets in the usual sense: for example open intervals \((a,b)\) and unions of open intervals.

Let \(A\subseteq \mathbb R\). A family of open sets

\[ \{U_i\}_{i\in I} \]

is called an open cover of \(A\) if every point of \(A\) belongs to at least one of the open sets in the family.

In symbols, the family \(\{U_i\}_{i\in I}\) is an open cover of \(A\) if

\[ A\subseteq \bigcup_{i\in I} U_i. \]

The set \(I\) is called the index set and may be either finite or infinite.

To say that \(\{U_i\}_{i\in I}\) covers \(A\) therefore means that no point of \(A\) is left outside the union of the open sets \(U_i\).

An example of an open cover

Consider the set

\[ A=[0,1]. \]

The family of open intervals

\[ U_n=\left(-\frac{1}{n},1+\frac{1}{n}\right), \qquad n\in\mathbb N,\ n\geq 1, \]

is an open cover of \(A\). Indeed, for every \(n\geq 1\) we have

\[ [0,1]\subseteq \left(-\frac{1}{n},1+\frac{1}{n}\right). \]

In particular,

\[ [0,1]\subseteq \bigcup_{n=1}^{+\infty} \left(-\frac{1}{n},1+\frac{1}{n}\right). \]

Hence every point of the interval \([0,1]\) belongs to at least one of the open sets in the family.

Subcover

If \(\{U_i\}_{i\in I}\) is an open cover of \(A\), a subcover is a subfamily of open sets that still covers \(A\).

More precisely, if \(J\subseteq I\), the family

\[ \{U_j\}_{j\in J} \]

is a subcover of \(A\) if

\[ A\subseteq \bigcup_{j\in J} U_j. \]

A subcover is said to be finite if it consists of only finitely many open sets.


Definition of a compact set

We can now give the fundamental definition.

A set \(K\subseteq \mathbb R\) is said to be compact if from every open cover of \(K\) one can extract a finite subcover.

In other words, \(K\) is compact if, whenever a family of open sets covers \(K\), there exist finitely many open sets of the family that still suffice to cover all of \(K\).

In symbols, \(K\subseteq \mathbb R\) is compact if, for every family of open sets \(\{U_i\}_{i\in I}\) such that

\[ K\subseteq \bigcup_{i\in I} U_i, \]

there exist indices \(i_1,i_2,\ldots,i_m\in I\), with \(m\in\mathbb N\), such that

\[ K\subseteq U_{i_1}\cup U_{i_2}\cup \cdots \cup U_{i_m}. \]

This is the definition of compactness by means of open covers.

An important remark

The definition does not say that \(K\) can be covered by finitely many open sets chosen at will. It says something more subtle: no matter which open cover is given, even one made up of infinitely many open sets, it is always possible to select finitely many of them that still cover all of \(K\).

Compactness is therefore a global property of the set \(K\), because it concerns all the possible open covers of \(K\).


The meaning of the definition

At first sight, the definition of compactness may seem abstract. Its deeper meaning, however, is very concrete: a compact set is a set that never requires infinitely many essential pieces of information in order to be kept under control by means of open sets.

Suppose we wish to cover a set \(K\) with a family of open sets. If \(K\) is compact, then even when the cover contains infinitely many open sets, only finitely many of them are actually needed to cover all of \(K\).

This behaviour is similar to that of finite sets. Indeed, if

\[ A=\{x_1,x_2,\ldots,x_m\}, \]

then every open cover of \(A\) always admits a finite subcover. It suffices to choose, for each point \(x_j\), an open set of the cover that contains it.

Compactness extends this property to infinite sets. A compact set may contain infinitely many points, yet it continues to behave like a finite set with respect to open covers.

Why does the definition use open sets?

Open sets are the sets that describe the neighbourhoods of points. For this reason open covers allow us to study a set through local information.

To say that a set is compact then means that, whenever it is controlled locally by means of open sets, this control can be reduced to a finite one.

This idea underlies many fundamental theorems of analysis. For example, the fact that a continuous function on a compact set attains a maximum and a minimum rests precisely on the possibility of passing from local information to finitely many global pieces of information.


First examples of compact sets

Let us look at some fundamental examples. At this stage we shall rely mainly on the geometric intuition of compactness; the complete characterization of the compact subsets of \(\mathbb R\) will be made precise by the Heine–Borel theorem.

Closed and bounded intervals

Intervals of the form

\[ [a,b], \qquad a,b\in\mathbb R,\ a\leq b, \]

are the first fundamental examples of compact sets in \(\mathbb R\).

They are bounded, because all of their points lie between \(a\) and \(b\), and they are closed, because they also contain the endpoints \(a\) and \(b\).

The fact that every closed and bounded interval is compact is a deep result of real analysis. In this treatment we shall use it as a fundamental example; the general characterization of the compact subsets of \(\mathbb R\), on the other hand, will be made precise by the Heine–Borel theorem.

Finite sets

Every finite set of real numbers is compact.

Indeed, let

\[ A=\{x_1,x_2,\ldots,x_m\}. \]

Consider any open cover of \(A\):

\[ A\subseteq \bigcup_{i\in I} U_i. \]

Since the cover covers \(A\), for each point \(x_j\in A\) there exists at least one index \(i_j\in I\) such that

\[ x_j\in U_{i_j}. \]

Hence the open sets

\[ U_{i_1},U_{i_2},\ldots,U_{i_m} \]

cover all the points of \(A\). Therefore

\[ A\subseteq U_{i_1}\cup U_{i_2}\cup\cdots\cup U_{i_m}. \]

We have thus extracted a finite subcover. By definition, \(A\) is compact.

The set formed by a convergent sequence together with its limit

Another important example is the set

\[ K=\left\{0\right\}\cup\left\{\frac{1}{n}:n\in\mathbb N,\ n\geq 1\right\}. \]

This set is infinite, yet it is compact.

Intuitively, the points

\[ 1,\frac12,\frac13,\frac14,\ldots \]

accumulate only at \(0\), and the point \(0\) belongs to the set. There are therefore no missing accumulation points.

Moreover the set is bounded, since all of its elements belong to the interval \([0,1]\).

Let us see directly why this set is compact, using the definition with open covers.

Let \(\{U_i\}_{i\in I}\) be an open cover of \(K\). Since \(0\in K\), there exists an open set \(U_{i_0}\) of the cover such that

\[ 0\in U_{i_0}. \]

Since \(U_{i_0}\) is open, there exists \(r>0\) such that

\[ (-r,r)\subseteq U_{i_0}. \]

Because

\[ \frac1n\to 0, \]

there exists \(N\in\mathbb N\) such that, for every \(n\geq N\),

\[ \frac1n\in (-r,r)\subseteq U_{i_0}. \]

Thus the open set \(U_{i_0}\) covers \(0\) together with all the points \(\displaystyle \frac1n\) from a certain index onwards.

Only finitely many points remain:

\[ 1,\frac12,\ldots,\frac{1}{N-1}. \]

For each of these points we choose an open set of the cover that contains it. In this way we obtain finitely many open sets which, together with \(U_{i_0}\), cover all of \(K\).

Hence every open cover of \(K\) admits a finite subcover. Therefore \(K\) is compact.


First examples of non-compact sets

To truly understand compactness, it is important to examine examples of sets that are not compact as well. In general, a set may fail to be compact either because it is too large, or because it has accumulation points that do not belong to the set.

The open interval \((0,1)\)

The interval

\[ (0,1) \]

is not compact.

The intuitive reason is that the set approaches the endpoints \(0\) and \(1\) without containing them. In particular, \(0\) and \(1\) are accumulation points of the set, but they do not belong to \((0,1)\).

Let us see how this defect shows up in the definition through open covers.

Consider the family of open sets

\[ U_n=\left(\frac1n,1-\frac1n\right), \qquad n\in\mathbb N,\ n\geq 3. \]

The family \(\{U_n\}_{n\geq 3}\) is an open cover of \((0,1)\). Indeed, if \(x\in(0,1)\), then

\[ x>0 \qquad \text{and} \qquad 1-x>0. \]

We may therefore choose \(n\) large enough so that

\[ \frac1n<x \qquad \text{and} \qquad \frac1n<1-x. \]

From these inequalities it follows that

\[ \frac1n<x<1-\frac1n, \]

that is,

\[ x\in U_n. \]

Hence

\[ (0,1)\subseteq \bigcup_{n=3}^{+\infty} \left(\frac1n,1-\frac1n\right). \]

This cover, however, admits no finite subcover.

Indeed, if we choose finitely many open sets of the family, there is a largest index \(N\) among those chosen. Since the intervals \(U_n\) grow as \(n\) increases, the finite union of the chosen open sets is contained in

\[ \left(\frac{1}{N},1-\frac{1}{N}\right). \]

But the point

\[ \frac{1}{2N} \]

belongs to \((0,1)\) and does not belong to \(\left(\displaystyle \frac{1}{N},1-\displaystyle \frac{1}{N}\right)\). Hence the finite union of the chosen open sets does not cover all of \((0,1)\).

We have thus found an open cover of \((0,1)\) that admits no finite subcover. By definition, \((0,1)\) is not compact.

The half-line \([0,+\infty)\)

The half-line

\[ [0,+\infty) \]

is not compact either.

Here the trouble is not a missing left endpoint, since \(0\) belongs to the set. The trouble is the lack of boundedness: the points of the set can move off indefinitely towards \(+\infty\).

Consider the family of open sets

\[ U_n=(-1,n), \qquad n\in\mathbb N,\ n\geq 1. \]

It is an open cover of \([0,+\infty)\). Indeed, if \(x\in[0,+\infty)\), it suffices to choose an integer \(n>x\), and then

\[ x\in (-1,n)=U_n. \]

Hence

\[ [0,+\infty)\subseteq \bigcup_{n=1}^{+\infty} (-1,n). \]

There is, however, no finite subcover. If we choose only finitely many of these open sets, there is a largest index \(N\), and the finite union is contained in

\[ (-1,N). \]

But the point \(N+1\) belongs to \([0,+\infty)\) and does not belong to \((-1,N)\).

Hence the family \(\{(-1,n)\}_{n\geq 1}\) is an open cover of \([0,+\infty)\) with no finite subcover. Therefore \([0,+\infty)\) is not compact.

The set \(\left\{\displaystyle \frac1n:n\in\mathbb N,\ n\geq 1\right\}\)

Consider now the set

\[ A=\left\{\frac1n:n\in\mathbb N,\ n\geq 1\right\}. \]

This set is not compact.

Indeed, its points accumulate at \(0\), but \(0\notin A\). The set therefore has a missing accumulation point.

We can also see the problem through sequences: the sequence

\[ x_n=\frac1n \]

is entirely contained in \(A\), yet it converges to \(0\), which does not belong to \(A\).

This shows why, in order to obtain a compact set, it is not enough to take the points \(\displaystyle \frac1n\): one must also adjoin their limit \(0\).

Indeed the set

\[ \left\{0\right\}\cup \left\{\frac1n:n\in\mathbb N,\ n\geq 1\right\} \]

is compact, as we saw in the previous section.


Compactness and sequences

Compactness is closely tied to the behaviour of sequences. In \(\mathbb R\), a compact set can also be recognized through a sequential property: every sequence of its points has a convergent subsequence whose limit still belongs to the set.

This property expresses, in sequential form, the idea that inside a compact set one can neither escape to infinity nor converge towards a missing accumulation point.

Sequential characterization of compactness

A set \(K\subseteq\mathbb R\) is compact if and only if every sequence \((x_n)\) of points of \(K\) has a subsequence \((x_{n_k})\) converging to a point \(x\in K\).

In symbols:

\[ K \text{ is compact} \quad \Longleftrightarrow \quad \forall (x_n)\subseteq K,\ \exists (x_{n_k}) \text{ such that } x_{n_k}\to x\in K. \]

This result lets us interpret compactness in a very concrete way: whatever sequence one chooses inside \(K\), it is always possible to extract a subsequence that converges without leaving the set.

Sequences that escape to infinity

Consider the half-line

\[ [0,+\infty). \]

The sequence

\[ x_n=n \]

is entirely contained in \([0,+\infty)\), but it has no convergent subsequence in \(\mathbb R\), since every one of its subsequences tends to \(+\infty\).

This shows, from the sequential point of view, why \([0,+\infty)\) is not compact.

Sequences converging towards a missing point

Consider the open interval

\[ (0,1). \]

The sequence

\[ x_n=\frac1n \]

is contained in \((0,1)\) for every \(n\geq 2\), yet it converges to \(0\), which does not belong to \((0,1)\).

Every subsequence of \(\left(\displaystyle \frac1n\right)\) again converges to \(0\). Hence there is no subsequence converging to a point of \((0,1)\).

This shows that \((0,1)\) is not compact because it has a missing accumulation point.

Sequences in a compact set

Consider instead the set

\[ K=\left\{0\right\}\cup\left\{\frac1n:n\in\mathbb N,\ n\geq 1\right\}. \]

Every sequence of points of \(K\) has a subsequence converging to a point of \(K\).

Indeed, given a sequence \((x_n)\subseteq K\), two cases may occur.

If at least one of the points of \(K\) appears infinitely many times in the sequence, then one can extract a constant subsequence. Every constant subsequence converges to its constant value, which belongs to \(K\).

If, on the other hand, no point of \(K\) appears infinitely many times, then the sequence must take infinitely many distinct values of the set. Since the only distinct points of \(K\), apart from \(0\), are of the form \(\displaystyle \frac1n\), we can extract a subsequence of the form

\[ \frac{1}{n_k}, \qquad n_k\to+\infty. \]

Therefore

\[ \frac{1}{n_k}\to 0. \]

Since \(0\in K\), in this case too the limit of the subsequence belongs to \(K\).

This example highlights the essential role of the point \(0\): adjoining the limit of the sequence \(\displaystyle \frac1n\) turns a non-compact set into a compact one.


Compactness and continuous functions

One of the main reasons why compact sets are so important is their behaviour with respect to continuous functions.

On a compact set, a continuous function cannot oscillate in an uncontrolled way, cannot grow indefinitely, and cannot approach a bound without reaching it.

The continuous image of a compact set

If \(K\subseteq\mathbb R\) is compact and \(f:K\to\mathbb R\) is continuous, then the image

\[ f(K)=\{f(x):x\in K\} \]

is a compact subset of \(\mathbb R\).

This means that compactness is preserved by continuous functions.

The idea is the following: if a function is continuous, then local control of the values of \(f\) can be traced back to local control of the points of the domain. Since the compact domain allows every open cover to be reduced to finitely many pieces of information, the image too retains a compactness property.

Existence of a maximum and a minimum

A fundamental consequence is the Weierstrass theorem.

If \(K\subseteq\mathbb R\) is compact and \(f:K\to\mathbb R\) is continuous, then \(f\) attains an absolute maximum and an absolute minimum on \(K\).

That is, there exist \(x_m,x_M\in K\) such that

\[ f(x_m)\leq f(x)\leq f(x_M) \qquad \text{for every } x\in K. \]

In this case \(f(x_m)\) is the absolute minimum of \(f\) on \(K\), while \(f(x_M)\) is the absolute maximum of \(f\) on \(K\).

The compactness of the domain is essential. Without compactness, a continuous function may fail to have a maximum, a minimum, or both.

Why is compactness necessary?

Consider the function

\[ f(x)=x \]

defined on the open interval \((0,1)\).

The function is continuous, but it attains neither a minimum nor a maximum on \((0,1)\). Indeed the values of \(f\) come arbitrarily close to \(0\) and to \(1\), yet neither \(0\) nor \(1\) is a value taken by the function on the domain.

More precisely,

\[ f((0,1))=(0,1). \]

The image contains neither its own infimum \(0\) nor its own supremum \(1\).

Consider instead the same function on the compact interval \([0,1]\). In this case

\[ f([0,1])=[0,1], \]

and the function attains its minimum at \(0\) and its maximum at \(1\).

This example shows that compactness prevents the bounds from remaining mere limiting values that are never attained.


Why closed and bounded is not the definition of compact

In \(\mathbb R\), compact sets are deeply connected with closed and bounded sets. It is important, however, not to confuse a characterization with a definition.

The definition of a compact set is the one based on open covers:

\[ K \text{ is compact} \quad \Longleftrightarrow \quad \text{every open cover of } K \text{ admits a finite subcover.} \]

The fact that, on the real line, the compact sets coincide with the closed and bounded sets is a fundamental result, not a definition.

This result will be studied in the Heine–Borel theorem, which provides one of the most important characterizations of compactness in \(\mathbb R\).

Why does this distinction matter?

The distinction matters because compactness arises as a property of open covers, and so it concerns the way in which a set can be covered by open sets.

Boundedness, on the other hand, depends on the distance and the order of the real line. In other mathematical settings, the relationship between compactness, closedness and boundedness can change.

For this reason it is more accurate to say that, in \(\mathbb R\), compactness can be characterized through closedness and boundedness, but its general definition remains the one in terms of open covers.

In short, compactness is defined by means of open covers, whereas the link with closedness and boundedness is a characterization specific to the real line:

\[ \text{compactness via open covers} \qquad \text{general definition}; \]

\[ \text{compact in } \mathbb R \quad \Longleftrightarrow \quad \text{closed and bounded} \qquad \text{characterization in } \mathbb R. \]

This distinction is essential: the definition introduces the concept, while the Heine–Borel theorem provides a practical criterion for recognizing it on the real line.


Final summary

A compact set is a set which, with respect to open covers, behaves like a finite set: every open cover admits a finite subcover.

Formally, a set \(K\subseteq\mathbb R\) is compact if, for every family of open sets \(\{U_i\}_{i\in I}\) such that

\[ K\subseteq \bigcup_{i\in I} U_i, \]

there exist \(i_1,\ldots,i_m\in I\) such that

\[ K\subseteq U_{i_1}\cup\cdots\cup U_{i_m}. \]

Compact sets rule out two phenomena typical of non-compact sets: escaping to infinity and converging towards missing accumulation points.

From the standpoint of sequences, a compact subset of \(\mathbb R\) is a set in which every sequence has a subsequence converging to a point of the set.

From the standpoint of continuous functions, compactness guarantees fundamental properties: the continuous image of a compact set is compact, and every real continuous function defined on a compact set attains an absolute maximum and an absolute minimum.

The precise link between compactness, closedness and boundedness on the real line will be expressed by the Heine–Borel theorem.


Your feedback is important to us! Leave a comment and help us improve this content. Thank you!

Feedback

Support us by liking the page:
Or, share:

Tags

  • Mathematical Analysis 1

Support us by liking the page:
Or, share:

Copyright © 2026 | Pimath | All Rights Reserved