If $A \subset \mathbb{R}^{n}$ is not closed, show that there is a continuous function $f: A \to \mathbb{R}$ which is unbounded. If $A \subset \mathbb{R}^{n}$ is not closed, show that there is a continuous function $f: A \to \mathbb{R}$ which is unbounded. Hint: If $x \in \mathbb{R}^{n} \backslash A$, but $x \notin int(\mathbb{R}^{n} \backslash A)$, let $f(y) = \frac{1}{|y - x|}$.
I'm having trouble coming up with a function. The only thing that comes to my mind is that the hint they gave could be a function used to show the claimed result, but that would mean at least in my thought process that $y$ is approaching some value of $x$ but never arrives at it and as such the function will blow up. If this is the idea that should be conveyed then I'm struggling to convey it more formally.
 A: The function is precisely the one given by the hint. 
Suppose $A \subseteq \mathbb{R}^n$ is not closed. Therefore, there are limit points of $A$ which are not elements of $A$. Let $x$ be one such point, and define $f : A \to \mathbb{R}$ by $f(y) = \|x-y\|^{-1}$. Since $x \notin A$, this function is well-defined on $A$. Moreover, since $y \mapsto \|y\|$ is a continuous function on $\mathbb{R}^n$, $f$ is also a continuous function. 
To see that $f$ is unbounded on $A$, fix a sequence $(x_n)_{n=1}^{\infty} \subset A$ such that $x_n \to x$. Then for every $\varepsilon > 0$ there is an $N \in \mathbb{N}$ such that $\|x-x_n\| < \varepsilon$ for each $n \geq N$. Let $M > 0$ be arbitrary. Then there is an $N \in \mathbb{N}$ such that $\|x-x_n\|< M^{-1}$ for each $n \geq N$. That is, $f(x_n) > M$ for each $n \geq N$. Since $M$ was arbitrary, we conclude that $f$ is unbounded on $A$.

To address the question in the comments, suppose that


*

*A set $U \subseteq \mathbb{R}^n$ is defined to be open if for each $x \in U$ there exists $\varepsilon > 0$ such that $y \in U$ for each $y$ satisfying $\|x-y\| < \varepsilon$.

*A set $F$ is defined to be closed if $\mathbb{R}^n \setminus F$ is open.

*The point $x$ is a limit point of the set $A$ if there exists a sequence $(x_n)_{n=1}^{\infty} \subseteq A$ with $x_n \ne x$ for each $n$ such that $x_n \to x$.


How do we know that a closed set contains its limit points?
Suppose $F$ is closed, and suppose $x$ is a limit point of $F$. Fix a sequence $(x_n)_{n=1}^{\infty} \subseteq A$ with $x_n \ne x$ for each $n$ such that $x_n \to x$. Then for every $\varepsilon > 0$, there exists $N \in \mathbb{N}$ such that $\|x-x_n\| < \varepsilon$ for each $n \geq N$. 
Is $x \notin F$? For the sake of contradiction, assume so. Since $\mathbb{R}^n \setminus F$ is open, we can fix $\overline{\varepsilon} > 0$ such that for any $y$ satisfying $\|x - y\| < \overline{\varepsilon}$, we have $y \in \mathbb{R}^n \setminus F$. On the other hand, we can fix $\overline{N} \in \mathbb{N}$ such that $\|x - x_n\| < \overline{\varepsilon}$ for each $n \geq \overline{N}$. But each of these $x_n$ is an element of $F$. This is a contradiction.
