If $A \subset R^{n}$ is not closed, show that there is a continuous function $f: A \rightarrow R$ which is unbounded. 
Question:
  1-28. If $A \subset R^{n}$ is not closed, show that there is a continuous function $f: A \rightarrow R$ which is unbounded.

Hint : If $x \in R^{n} - A$ but $x \notin int(R^{n} - A)$, let $f(y) = \frac{1}{ \mid y-x \mid}$. 
What I got so far:
Given $f(y) = \frac{1}{\mid y-x \mid}$, choose $p$ to be the point that's in the not closed set. 
So, for $x \in A$ and $p \notin A$, our function becomes $f(x) = \frac{1}{\mid x-p \mid}$
By the continuous definition, for $ \epsilon > 0$ there exists a $\delta >0$ such that $\mid x-y \mid < \delta$ implies $\mid f(x)-f(y) \mid < \epsilon$.
$\mid \frac{1}{\mid x-p \mid} - \frac{1}{\mid y-p \mid} \mid < \epsilon$  
$\mid \frac{\mid y-p \mid}{\mid y-p \mid} \cdot \frac{1}{\mid x-p \mid} - \frac{1}{\mid y-p \mid} \cdot \frac{\mid x-p \mid}{\mid x-p \mid} \mid < \epsilon$ 
$\mid \frac{\mid y-p \mid -\mid x-p \mid }{\mid y-p \mid \mid x-p \mid } \mid < \epsilon$ 
$\mid \frac{\mid y-p-x+p \mid }{\mid y-p \mid \mid x-p \mid } \mid < \epsilon$ 
$\mid \frac{\mid y-x \mid }{\mid y-p \mid \mid x-p \mid } \mid < \epsilon$ 
I need to find two Deltas but I'm not sure how to do that.  Does it have something to do with using
$\mid \mid x \mid - \mid y \mid \leq \mid x-y \mid$ ? 
Or maybe I'm doing this backwards because if I take the negative out of the numerator, I'll end up with $-\mid -y+x \mid$. 
 A: Since $X \subseteq \mathbb{R}^n$  is not closed, there exists $a \in \mathbb{R}^n$ and a sequence $\{x_n\}$ in $X$ such that $\lim_{n\to\infty}x_n=a$ but $a \not\in X$. Without loss of generality, you can assume that $x_n$ is never equal to $a$ for any $n \in \mathbb{N}$.
Now consider $f(x) = \frac{1}{\|a-x\|}$. Since $\lim_{n\to\infty}x_n=a$, we know that:
$$\forall K \in \mathbb{N}, \exists M\in\mathbb{N}: n\geq M \implies \|a-x_n\|<\frac{1}{K}$$
This means that $$\forall K\in \mathbb{N}:|f(x_n)|=\frac{1}{\|a-x_n\|}>K$$
Hence, $f$ is not bounded.
To see that $f(x)$ is continuous in a punctured neighborhood of $a$, note that $f(x)$ is a rational function where the denominator is zero only at $x=a$. So, $f(x)$ is indeed continuous over $\mathbb{R}^n - \{a\}$. To follow an $\epsilon-\delta$ approach, you need to review and combine the following two proofs:


*

*$f(x) = \frac{1}{x}$ is continuous over $\mathbb{R}-\{0\}$

*If $g$ and $f$ are continuous at $x=c$, so is $f\circ g$.


Proving the second statement is straightforward and easy. I leave it to you.
In our case, it suffices to show that $f(x) = \frac{1}{x}$ is continuous over $(0,\infty)$. We first observe that for a fixed value $y \in (0,+\infty)$, we have:
$$|f(x)-f(y)| = |\frac{1}{x}-\frac{1}{y}|=|\frac{y-x}{xy}|\leq\frac{|x-y|}{y}\cdot\frac{1}{x}$$
Now, our goal is to select $\delta$ such that it's easy to find an upper bound for $\frac{1}{x}$ when $x \in (y-\delta,y+\delta)$. Equivalently, we want to choose $\delta$ such that $x \in (y-\delta,y+\delta)$ is away from $0$. Choosing $\delta < \frac{y}{2}$ should do the job for us. Indeed, you can easily show that in this case we have $\frac{1}{x} < \frac{2}{y}$. This means that 
$$|f(x)-f(y)| \leq \frac{|x-y|}{y}\cdot\frac{2}{y} \leq \frac{2\delta}{y^2}$$
Now choosing $\delta < \min\{\frac{y}{2},\frac{y^2}{2} \epsilon\}$ finishes the proof. Q.E.D.
