TITLE: Showing that a discontinuous function is or is not borel measurable.
QUESTION [5 upvotes]: So my question is this. Please let me know if my answer is sufficient. 
Let
$$ 
f(x) = 
     \begin{cases}
      \sin(\frac{1}{x})  &\quad\text{if } x \neq 0,\\
       \text{5} &\quad\text{if } x = 0\\
     \end{cases} 
$$
be defined on the whole real line. Is $f$ Borel measurable. 
My way of thinking is to use the definition of measurable function;
Suppose we have a set X together with a sigma-algebra $\Sigma$. Function $f:X \rightarrow \mathbb{R}$ is measurable or $\Sigma$-measurable if the set $\{x:f(x)>a\}$ belongs to $\Sigma$ for all $a \in \mathbb{R}$. 
Therefore, from the question, I obtained the two following facts;

If $a \geq 5$ then $\{x \in \mathbb{R}: f(x) > a\}=\emptyset$

Surely, this is all that is required to show that it is not Borel measurable as the empty set doesn't generate a sigma algebra.

REPLY [2 votes]: After visiting my tutor I was somewhat enlightened. 
Say we have a function g, which is continuous. Then $\{x:g(x) > a \} =g^{-1}(a, \infty)$ is open, and hence Borel. 
We fix any $a \in \mathbb{R} $, $\{x:f(x) > a  \} ``="\{x:\sin(\frac{1}{x}) > a  \} $. Where we have put the equals in quotation marks because we are disregarding the zero point. 
Since $\sin(\frac{1}{x})$ is continuous on $\mathbb{R} \setminus \{0\}$, we have $ \{x:f(x) > a  \} = f^{-1}(a,\infty)\cap\mathbb{R}\setminus\{0\} \cup \{0\}$, i.e. the union of two borel sets, hence the function is Borel.