I was reading (self study) the book by Thomson Bruckner and Bruckner and ran into one of the exercises that I think I have the proof for by not sure it is right. The statement of the problem goes as follows.
A function $f:\mathbb{R} \mapsto \mathbb{R}$ is said to be bounded at a point $x_o$ provided there are positive number $\epsilon$ and $M$ so that $|f(x)| < M$. for all $x \in (x_o - \epsilon, x_o + \epsilon)$. Show that the set of points at which a function is bounded is open. Let $E$ be an arbitrary closed set. Is it possible to construct a function $f:\mathbb{R} \mapsto \mathbb{R}$ so that the set of points at which f is not bounded is precisely the set E?
My Proof of the first section of the problem was as follows. Let $B_f = \{x : |f(x)| < M, M > 0 \}$ the set of all points where $f$ is bounded (note $M = sup(\{M_x : x \in \mathbb{R}, |f(x)| < M_x\})$ over each $x$, This $sup(\{M_x : x \in \mathbb{R}, |f(x)| < M_x\})$ is bounded and exists, since each $M_x$ is bounded). Then if for every $x \in B_f$ we have by our definition of bounded function at a point, $\forall x \in B_f \ \exists \epsilon > 0 \text{ and } \forall x \in (x - \epsilon, x + \epsilon)$ we have $|f(x)| < M_x$, but this would mean $(x - \epsilon, x + \epsilon) \subset B_f$ which means that $x$ is a interior point of $B_f$. The conclusion follows that $B_f$ is open.
I have no clue how to construct the function for the second half of the question.
I was wondering if my proof is right? If someone can provide an example for the second part of the question I would be extremely thankful.