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

Open and Closed Sets: 20 Practice Problems with Step-by-Step Solutions

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

The exercises in this section deal with the open sets and closed sets of the real line. We shall put the fundamental definitions and the main properties developed in the theory directly into practice.

The problems are arranged in order of increasing difficulty. In the first few we apply the definitions directly; later on we examine more intricate sets, sequences of points, infinite families of sets, and sets defined by equations or inequalities.


Exercise 1 — level ★☆☆☆☆

Determine whether the set

\[ A=(2,5) \]

is open in \(\mathbb R\).

Answer

The set \(A=(2,5)\) is open in \(\mathbb R\).

Solution

To show that \(A\) is open, we must check that every point of \(A\) has a neighborhood entirely contained in \(A\).

Let \(x_0\in(2,5)\). Then

\[ 2<x_0<5. \]

The two quantities

\[ x_0-2 \qquad\text{and}\qquad 5-x_0 \]

are both positive. We may therefore choose

\[ r=\frac12\min\{x_0-2,\;5-x_0\}. \]

With this choice we have \(r>0\), and the neighborhood \((x_0-r,x_0+r)\) stays entirely between \(2\) and \(5\). Indeed, the radius we have picked is smaller than the distance from \(x_0\) to either endpoint.

Hence

\[ (x_0-r,x_0+r)\subseteq(2,5). \]

Since \(x_0\) was arbitrary, every point of \(A\) has a neighborhood contained in \(A\). Therefore \(A\) is open.


Exercise 2 — level ★☆☆☆☆

Determine whether the set

\[ A=[2,5] \]

is open in \(\mathbb R\).

Answer

The set \(A=[2,5]\) is not open in \(\mathbb R\).

Solution

For \(A\) to be open, every one of its points would have to have a neighborhood entirely contained in \(A\). Consider the point \(2\), which belongs to \(A\).

If \(r>0\), the neighborhood centered at \(2\) of radius \(r\) is

\[ (2-r,2+r). \]

Such a neighborhood contains points smaller than \(2\). For instance,

\[ 2-\frac r2\in(2-r,2+r), \]

yet

\[ 2-\frac r2\notin[2,5]. \]

Thus no neighborhood of \(2\) is contained in \([2,5]\). Consequently \(A\) is not open.


Exercise 3 — level ★☆☆☆☆

Determine whether the set

\[ A=[-1,3] \]

is closed in \(\mathbb R\).

Answer

The set \(A=[-1,3]\) is closed in \(\mathbb R\).

Solution

A set \(A\subseteq\mathbb R\) is closed if and only if its complement \(\mathbb R\setminus A\) is open.

Let us compute the complement:

\[ \mathbb R\setminus[-1,3]=(-\infty,-1)\cup(3,+\infty). \]

The rays \((-\infty,-1)\) and \((3,+\infty)\) are open in \(\mathbb R\), and a union of open sets is open. Hence

\[ \mathbb R\setminus[-1,3] \]

is open.

Since the complement of \(A\) is open, \(A\) is closed.


Exercise 4 — level ★☆☆☆☆

Determine whether the set

\[ A=(0,1] \]

is open, closed, both, or neither.

Answer

The set \(A=(0,1]\) is neither open nor closed.

Solution

The set \(A\) is not open. Indeed \(1\in A\), but no neighborhood of \(1\) is contained in \(A\).

For every \(r>0\), the neighborhood

\[ (1-r,1+r) \]

contains points greater than \(1\), and these do not belong to \((0,1]\). Hence \(A\) is not open.

Let us now examine whether \(A\) is closed. Its complement is

\[ \mathbb R\setminus(0,1]=(-\infty,0]\cup(1,+\infty). \]

This complement is not open, because the point \(0\) belongs to it, yet every neighborhood of \(0\) contains positive points lying in \((0,1]\).

So the complement of \(A\) is not open, and consequently \(A\) is not closed.

Therefore \(A=(0,1]\) is neither open nor closed.


Exercise 5 — level ★☆☆☆☆

Prove that the set

\[ A=(-\infty,4) \]

is open in \(\mathbb R\).

Answer

The set \(A=(-\infty,4)\) is open in \(\mathbb R\).

Solution

Let \(x_0\in(-\infty,4)\). Then

\[ x_0<4. \]

The quantity \(4-x_0\) is positive. Let us choose

\[ r=\frac{4-x_0}{2}. \]

Then \(r>0\). Moreover,

\[ x_0+r=x_0+\frac{4-x_0}{2}=\frac{x_0+4}{2}<4. \]

Thus every point of the neighborhood \((x_0-r,x_0+r)\) is smaller than \(4\). Hence

\[ (x_0-r,x_0+r)\subseteq(-\infty,4). \]

Since \(x_0\) was arbitrary, every point of \(A\) has a neighborhood contained in \(A\). Therefore \(A\) is open.


Exercise 6 — level ★★☆☆☆

Determine whether the set

\[ A=[3,+\infty) \]

is open, closed, both, or neither.

Answer

The set \(A=[3,+\infty)\) is closed but not open.

Solution

Let us compute the complement of \(A\):

\[ \mathbb R\setminus[3,+\infty)=(-\infty,3). \]

The ray \((-\infty,3)\) is open. Consequently the complement of \(A\) is open, and therefore \(A\) is closed.

Let us now check that \(A\) is not open. The point \(3\) belongs to \(A\), but every neighborhood of \(3\) contains points smaller than \(3\).

Indeed, for every \(r>0\),

\[ 3-\frac r2\in(3-r,3+r), \]

whereas

\[ 3-\frac r2\notin[3,+\infty). \]

No neighborhood of \(3\) is therefore contained in \(A\). Hence \(A\) is not open.


Exercise 7 — level ★★☆☆☆

Determine whether the set

\[ A=\{1,2,5\} \]

is open, closed, both, or neither.

Answer

The set \(A=\{1,2,5\}\) is closed but not open.

Solution

Let us compute the complement:

\[ \mathbb R\setminus A = (-\infty,1)\cup(1,2)\cup(2,5)\cup(5,+\infty). \]

Every interval appearing in this union is open. Since a union of open sets is open, \(\mathbb R\setminus A\) is open as well.

Consequently \(A\) is closed.

The set is not open. Consider the point \(1\in A\). Every neighborhood of \(1\) contains infinitely many real numbers other than \(1\), \(2\), and \(5\).

For example, if \(0<r<1\), then

\[ 1+\frac r2\in(1-r,1+r), \]

but

\[ 1+\frac r2\notin A. \]

Hence no neighborhood of \(1\) is contained in \(A\), so \(A\) is not open.


Exercise 8 — level ★★☆☆☆

Determine whether the sets

\[ \varnothing \qquad\text{and}\qquad \mathbb R \]

are open, closed, both, or neither.

Answer

The sets \(\varnothing\) and \(\mathbb R\) are simultaneously open and closed.

Solution

The set \(\mathbb R\) is open because, given any point \(x_0\in\mathbb R\), every neighborhood

\[ (x_0-r,x_0+r) \]

with \(r>0\) is contained in \(\mathbb R\).

The empty set \(\varnothing\) is open as well. The definition of an open set imposes a condition on all points of the set; since \(\varnothing\) contains no point at all, the condition is satisfied vacuously.

Moreover,

\[ \mathbb R\setminus\mathbb R=\varnothing. \]

Since \(\varnothing\) is open, \(\mathbb R\) is closed.

Likewise,

\[ \mathbb R\setminus\varnothing=\mathbb R, \]

and since \(\mathbb R\) is open, \(\varnothing\) is closed.

Therefore \(\varnothing\) and \(\mathbb R\) are simultaneously open and closed.


Exercise 9 — level ★★☆☆☆

Determine whether the set

\[ A=(-2,1)\cup(3,6) \]

is open in \(\mathbb R\).

Answer

The set \(A=(-2,1)\cup(3,6)\) is open.

Solution

The intervals

\[ (-2,1) \qquad\text{and}\qquad (3,6) \]

are both open.

Since a union of open sets is again an open set, it follows at once that

\[ (-2,1)\cup(3,6) \]

is open.

We can also verify this directly. If \(x_0\in A\), then \(x_0\) belongs to one of the two intervals.

As that interval is open, there is a neighborhood of \(x_0\) entirely contained in it, and hence contained in \(A\).

Therefore every point of \(A\) has a neighborhood contained in \(A\), and so \(A\) is open.


Exercise 10 — level ★★☆☆☆

Determine whether the set

\[ A=(-1,4)\cap(2,7) \]

is open in \(\mathbb R\).

Answer

The set is open and coincides with the interval

\[ (2,4). \]

Solution

A real number belongs to the intersection if and only if it belongs to both intervals at once.

It must therefore satisfy the conditions

\[ -1<x<4 \]

and

\[ 2<x<7. \]

Combining the two conditions, we obtain

\[ 2<x<4. \]

Hence

\[ (-1,4)\cap(2,7)=(2,4). \]

The interval \((2,4)\) is open, so the given set is open.


Exercise 11 — level ★★☆☆☆

Determine whether the set

\[ A=\mathbb R\setminus(1,4) \]

is open, closed, both, or neither.

Answer

The set \(A=\mathbb R\setminus(1,4)\) is closed but not open.

Solution

Let us write the set out explicitly:

\[ A=\mathbb R\setminus(1,4)=(-\infty,1]\cup[4,+\infty). \]

Since \(A\) is the complement of the open set \((1,4)\), it follows that \(A\) is closed.

The set is not open. Indeed \(1\in A\), but every neighborhood of \(1\) contains points greater than \(1\) and smaller than \(4\), that is, points that do not belong to \(A\).

Hence no neighborhood of \(1\) is contained in \(A\), so \(A\) is not open.


Exercise 12 — level ★★★☆☆

Determine whether the set

\[ A=(0,2)\setminus\{1\} \]

is open, closed, both, or neither.

Answer

The set \(A=(0,2)\setminus\{1\}\) is open but not closed.

Solution

Let us write the set as a union of intervals:

\[ A=(0,1)\cup(1,2). \]

The intervals \((0,1)\) and \((1,2)\) are open. Since a union of open sets is open, \(A\) is open.

We now show that \(A\) is not closed. The point \(1\) is an accumulation point of \(A\), since every deleted neighborhood of \(1\) contains points of \(A\).

Nevertheless,

\[ 1\notin A. \]

Thus \(A\) does not contain all of its accumulation points, and so \(A\) is not closed.


Exercise 13 — level ★★★☆☆

Determine whether the set

\[ \mathbb Q \]

is open or closed in \(\mathbb R\).

Answer

The set \(\mathbb Q\) is neither open nor closed in \(\mathbb R\).

Solution

The set \(\mathbb Q\) is not open. Indeed every neighborhood of a rational number contains irrational numbers.

Hence, if \(q\in\mathbb Q\), there is no \(r>0\) such that

\[ (q-r,q+r)\subseteq\mathbb Q. \]

Therefore \(\mathbb Q\) is not open.

The set \(\mathbb Q\) is not closed either. Indeed every real number is an accumulation point of \(\mathbb Q\), since every neighborhood of any real number contains rational numbers.

In particular, \(\sqrt2\) is an accumulation point of \(\mathbb Q\), yet

\[ \sqrt2\notin\mathbb Q. \]

Thus \(\mathbb Q\) does not contain all of its accumulation points, and so \(\mathbb Q\) is not closed.


Exercise 14 — level ★★★☆☆

Determine whether the set

\[ \mathbb R\setminus\mathbb Q \]

is open or closed in \(\mathbb R\).

Answer

The set \(\mathbb R\setminus\mathbb Q\) is neither open nor closed in \(\mathbb R\).

Solution

The set of irrational numbers is not open. Indeed every neighborhood of an irrational number contains rational numbers.

Hence no neighborhood of an irrational point is entirely contained in \(\mathbb R\setminus\mathbb Q\). Therefore \(\mathbb R\setminus\mathbb Q\) is not open.

The set of irrational numbers is not closed. Indeed every rational number is an accumulation point of \(\mathbb R\setminus\mathbb Q\), since every neighborhood of a rational number contains irrational numbers.

In particular, \(0\) is an accumulation point of \(\mathbb R\setminus\mathbb Q\), yet

\[ 0\notin\mathbb R\setminus\mathbb Q. \]

Thus the set does not contain all of its accumulation points, and so it is not closed.


Exercise 15 — level ★★★☆☆

Determine whether the set

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

is open or closed in \(\mathbb R\).

Answer

The set \(A\) is neither open nor closed.

Solution

The set is

\[ A=\left\{1,\frac12,\frac13,\frac14,\ldots\right\}. \]

It is not open. Indeed no neighborhood of a point of \(A\) is contained in \(A\), since every neighborhood contains infinitely many real numbers that do not belong to \(A\).

Let us now examine whether \(A\) is closed. Observe that

\[ \frac1n\to0. \]

Hence \(0\) is an accumulation point of \(A\). Indeed, for every \(r>0\) there exists \(n\in\mathbb N\) such that

\[ 0<\frac1n<r, \]

and therefore

\[ \frac1n\in(-r,r)\setminus\{0\}. \]

However,

\[ 0\notin A. \]

Thus \(A\) does not contain all of its accumulation points, and so \(A\) is not closed.


Exercise 16 — level ★★★☆☆

Determine whether the set

\[ A=\{0\}\cup\left\{\frac1n:n\in\mathbb N,\ n\ge1\right\} \]

is open or closed in \(\mathbb R\).

Answer

The set \(A\) is closed but not open.

Solution

The set can be written in the form

\[ A=\left\{0,1,\frac12,\frac13,\frac14,\ldots\right\}. \]

It is not open. Indeed no neighborhood of \(0\) is contained in \(A\), since every neighborhood of \(0\) contains infinitely many real numbers that do not belong to \(A\).

Let us now examine whether \(A\) is closed. The sequence

\[ \frac1n \]

converges to \(0\). Hence \(0\) is an accumulation point of \(A\).

Moreover, \(0\in A\).

The points of the form \(\displaystyle \frac1n\), on the other hand, are isolated points of the set. Indeed, for a fixed \(n\), the point \(\displaystyle \frac1n\) can be separated from the remaining elements of \(A\) by a sufficiently small neighborhood.

The points of the form \(\displaystyle \frac1n\) are isolated, and any real number different from \(0\) and from the elements of the sequence has a neighborhood containing no points of \(A\). Thus the only accumulation point of \(A\) is \(0\), and this point belongs to \(A\). Therefore \(A\) contains all of its accumulation points.

Consequently \(A\) is closed.


Exercise 17 — level ★★★★☆

Let

\[ A_n=\left(-\frac1n,\frac1n\right), \qquad n\in\mathbb N,\ n\ge1. \]

Study the set

\[ A=\bigcap_{n=1}^{+\infty}A_n \]

and determine whether it is open.

Answer

We have

\[ A=\{0\}. \]

The set \(A\) is not open.

Solution

Each set

\[ A_n=\left(-\frac1n,\frac1n\right) \]

is open in \(\mathbb R\). We must, however, study their intersection:

\[ A=\bigcap_{n=1}^{+\infty}\left(-\frac1n,\frac1n\right). \]

First observe that \(0\in A_n\) for every \(n\in\mathbb N\). Hence

\[ 0\in A. \]

We now show that no other point belongs to \(A\). Let \(x\neq0\). Then \(|x|>0\). By the Archimedean property, there exists \(n\in\mathbb N\) such that

\[ \frac1n<|x|. \]

From this it follows that

\[ x\notin\left(-\frac1n,\frac1n\right). \]

Hence \(x\notin A\).

We have shown that the only point belonging to all the intervals \(A_n\) is \(0\). Therefore

\[ A=\{0\}. \]

The set \(\{0\}\) is not open, because no neighborhood of \(0\) is contained in \(\{0\}\). Indeed every neighborhood of \(0\) contains real numbers other than \(0\).

Hence \(A\) is not open.


Exercise 18 — level ★★★★☆

Let

\[ A_n=\left[\frac1n,1\right], \qquad n\in\mathbb N,\ n\ge1. \]

Study the set

\[ A=\bigcup_{n=1}^{+\infty}A_n \]

and determine whether it is closed.

Answer

We have

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

The set \(A\) is not closed.

Solution

Each set

\[ A_n=\left[\frac1n,1\right] \]

is closed in \(\mathbb R\). We study, however, their union:

\[ A=\bigcup_{n=1}^{+\infty}\left[\frac1n,1\right]. \]

We claim that

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

If \(x\in A\), then there exists \(n\in\mathbb N\) such that

\[ x\in\left[\frac1n,1\right]. \]

Hence

\[ \frac1n\le x\le1. \]

In particular \(x>0\). Therefore

\[ x\in(0,1]. \]

We have thus shown that \(A\subseteq(0,1]\).

Conversely, let \(x\in(0,1]\). Since \(x>0\), by the Archimedean property there exists \(n\in\mathbb N\) such that

\[ \frac1n\le x. \]

As we also have \(x\le1\), we obtain

\[ x\in\left[\frac1n,1\right]. \]

Hence \(x\in A\). Therefore

\[ (0,1]\subseteq A. \]

From the two inclusions it follows that

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

The set \((0,1]\) is not closed, because \(0\) is an accumulation point of \(A\), yet

\[ 0\notin A. \]

Thus \(A\) does not contain all of its accumulation points, and so \(A\) is not closed.


Exercise 19 — level ★★★★☆

Determine whether the set

\[ A=\{x\in\mathbb R:x^2<4\} \]

is open, closed, both, or neither.

Answer

The set \(A\) is open but not closed.

Solution

Let us solve the inequality defining \(A\):

\[ x^2<4. \]

Since \(4=2^2\), the inequality is equivalent to

\[ -2<x<2. \]

Hence

\[ A=(-2,2). \]

The interval \((-2,2)\) is open in \(\mathbb R\). Therefore \(A\) is open.

The set is not closed. Indeed the points \(-2\) and \(2\) are accumulation points of \(A\), but they do not belong to \(A\).

Precisely,

\[ -2\notin A \qquad\text{and}\qquad 2\notin A. \]

Thus \(A\) does not contain all of its accumulation points, and so \(A\) is not closed.


Exercise 20 — level ★★★★★

Determine whether the set

\[ A=\{x\in\mathbb R:0<|x-2|\le3\} \]

is open, closed, both, or neither.

Answer

The set \(A\) is neither open nor closed.

Solution

The condition

\[ 0<|x-2|\le3 \]

means that the distance from \(x\) to \(2\) is positive and does not exceed \(3\).

Let us first study the condition

\[ |x-2|\le3. \]

It is equivalent to

\[ -3\le x-2\le3. \]

Adding \(2\) to all three members, we obtain

\[ -1\le x\le5. \]

The condition

\[ 0<|x-2| \]

is in turn equivalent to \(x\neq2\). Therefore

\[ A=[-1,5]\setminus\{2\}. \]

We may thus write

\[ A=[-1,2)\cup(2,5]. \]

The set is not open, because \(-1\in A\) but no neighborhood of \(-1\) is contained in \(A\). Indeed every neighborhood of \(-1\) contains points smaller than \(-1\), which do not belong to \(A\).

The set is not closed, because \(2\) is an accumulation point of \(A\), yet

\[ 2\notin A. \]

Indeed every deleted neighborhood of \(2\) contains points of \(A\), both to the left and to the right of \(2\).

Thus \(A\) does not contain all of its accumulation points, and so \(A\) is neither open nor closed.


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