# Show that if $f$ is right continuous then $f$ is measurable

I'm trying to solve the following problem:

Show that if the function $$f: \mathbb{R} \to \mathbb{R}$$ is right continuous then $$f$$ is measurable.

(A function $$f$$ is measurable if $$f^{-1}(E) \in \mathcal{B}(\mathbb{R})$$ for each $$E \in \mathcal{B}(\mathbb{R})$$ which is equivalent to say that $$f^{-1}(\alpha, \infty) \in \mathcal{B}(\mathbb{R})$$ or $$f^{-1}[-\infty, \alpha] \in \mathcal{B}(\mathbb{R})$$, $$\forall \alpha \in \mathbb{R}$$, where $$\mathcal{B}(\mathbb{R})$$ represents the Borel $$\sigma$$-algebra)

I know that if $$f$$ is continuous then it is measurable since $$(\alpha, \infty)$$ is an open set and hence $$f^{-1} (\alpha, \infty)$$ would be open and therefore measurable with respect the Borel $$\sigma$$-algebra, but I'm not sure how could I construct a similar argument with right continuity.

Consider $$f_n(x):=\sum_{k\in\Bbb Z} f(k/n)\cdot 1_{((k-1)/n,k/n]}$$, $$\in \Bbb R$$. Each $$f_n$$ is Borel measurable, being a step function. And $$\lim_nf_n(x)=f(x)$$ for all $$x\in\Bbb R$$ because $$f$$ is right continuous. (To see this, fix $$x$$. Given $$\epsilon>0$$ choose $$\delta>0$$ so small that $$|f(t)-f(x)|<\epsilon$$ if $$x\le t. Now choose $$n$$ so large that $$1/n<\delta$$. There is a unique integer $$k$$ such that $$(k-1)/n, and for that $$n$$ we have $$|x-k/n|\le 1/n<\delta$$, so $$|f(x)-f(k/n)|<\epsilon$$. It follows that $$|f_n(x)-f(x)|<\epsilon$$.)