Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Let $A$ and $B$ be two sets of real numbers. Define the distance from $A$ to $B$ by $$\rho (A,B) = \inf \{ |a-b| : a \in A, b \in B\} \;.$$ Give an example to show that the distance between two closed sets can be $0$ even if the two sets are disjoint.

share|cite|improve this question
Exercise for you: show that if this is true, $A$ or $B$ must be non-compact. – Neal May 16 '12 at 16:42
up vote 13 down vote accepted

Let $A = \mathbb N$ and let $B = \left\{n+\frac{1}{2n} :n\in \mathbb N\right\}$. Then A and B are closed and disjoint, but $$\inf \{|a−b|:a \in A,b \in B\} = \inf \left | \frac{1}{2n}\right| = 0$$

share|cite|improve this answer
Hi. You may want to see some of the TeX edits I have made by clicking on the time stamp above my name. – user21436 Mar 29 '12 at 19:16
And you prove that it is closed because it's the complement of an infinite amount of open intervals? – Thomas Ahle Aug 13 '14 at 14:46

Consider the sets $\mathbb N$ and $\mathbb N\pi = \{n\pi : n\in\mathbb N\}$. Then $\mathbb N\cap \mathbb N\pi=\emptyset$ as $\pi$ is irrational, but we have points in $\mathbb N\pi$ which lie arbitrarily close to the integers.

share|cite|improve this answer
This is a nice example, but showing that $\mathbb{N}\pi$ is arbitrarily close to $\mathbb{N}$ is probably harder than the simplest example to original question :). – Theo May 16 '12 at 16:06

Let $A$ be the set of positive integers, and let $B$ be the set of all numbers of the form $n+1/n$, where $n$ ranges over the integers $\gt 1$.

share|cite|improve this answer
For $n=1$ you get $n+1/n=2$ - that's why in another answer $n+\frac1{2n}$ was taken. (Or you cut simply add the condition $n\ge 2$.) – Martin Sleziak May 16 '12 at 14:24
@MartinSleziak: Thanks for spotting this. I had forgotten that $1+1=2$. – André Nicolas May 16 '12 at 14:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.