Use the fact that a lower semi-continuous function is Borel measurable to conclude every continuous function is Borel measurable I am working on this problem:

Prove that if $f:\mathbb{R}^{n}\longrightarrow [-\infty,\infty]$ is lower semi-continuous, then it is a Borel function. Conclude that continuous functions are Borel measurable. (Hint: firstly show every set of the form $\{x:f(x)\leq a\}$ $(a\in\mathbb{R})$ is closed).

I have proved the hint as followed:
We firstly show the hint. To show the hint, it is equivalent to show that $f^{-1}\Big((a,\infty)\Big)$ is open for all $a\in\mathbb{R}$, since $$f^{-1}\Big((-\infty,a]\Big)=\mathbb{R}^{n}\setminus f^{-1}\Big((a,\infty)\Big),$$ and thus if $f^{-1}\Big((a,\infty)\Big)$ was open, then $f^{-1}\Big((-\infty,a]\Big)$ would be closed. 
So let's assume $f$ is lower semi-continuous and $f(x_{0})>a$. Then, we want to show that $f(x)>a$ for $x$ in some ball $B(r,x_{0})$. 
Suppose not, then there would be a sequence $x_{i}\rightarrow x_{0}$ such that $f(x_{i})\leq a$ for all $i$, but then by semi-continuity, we have $$f(x_{0})\leq\liminf_{\|x_{i}-x_{0}\|\rightarrow 0}f(x_{i})\leq a,$$ which contradicts our hypothesis that $f(x_{0})>a$. 
Therefore, for some $r>0$, we have $$B(r, x_{0})\subset f^{-1}\Big((a,\infty)\Big).$$
This implies that every point of $f^{-1}\Big((a,\infty)\Big)$ is an interior point and thus $f^{-1}\Big((a,\infty)\Big)$ is open.
Thus, $f^{-1}\Big((-\infty,a]\Big)$ is closed. 
However, I have two problems here:
(1) What should I do next? Does the hint conclude the first part of this problem directly?
(2) How could I use the first part to conclude that continuous functions are Borel measurable? It is even easier to directly conclude this without mentioning lower semi-continuous...
Edit 1:
From the discussion between me and Andreas Class, to show $f$ is Borel measurable, it suffices to show $f^{-1}\Big((-\infty,a]\Big)$ is closed. This is pretty well-known, but since I don't know what facts the problem allows me to take as granted, I will show why it is sufficient. 
Proof:
Continued with my proof from above ---  In particular, both $f^{-1}\Big((a,\infty)\Big)$ and $f^{-1}\Big((-\infty,a]\Big)$ are Borel sets, since open set is Borel and closed set is a complement of an open set and thus Borel. 
Now, every open set in $\mathbb{R}$ can be written as $(a,b)$ for $a,b\in\mathbb{R}$, we now show that $f^{-1}\Big((a,b)\Big)$ is Borel to conclude the first part of the problem. 
This follows immediately from the following: $$f^{-1}\Big((a,b)\Big)=f^{-1}\Big((a,\infty)\cap\bigcup_{n=1}^{\infty}(-\infty, b+\dfrac{1}{n}]\Big)=f^{-1}\Big((a,\infty)\Big)\cap\bigcup_{n=1}^{\infty}f^{-1}\Big((-\infty, b+\dfrac{1}{n}]\Big).$$
By what we have showed, $f^{-1}\Big((-\infty, b+\dfrac{1}{n}]\Big)$ is Borel for each $n$, and then the countable union of Borel sets is Borel. Also, $f^{-1}\Big((a,\infty)\Big)$ is Borel, so $f^{-1}\Big((a,b)\Big)$ is the finite intersection of two Borel set, which is Borel (since every $\sigma$-algebra is an algebra). 
Thus, the preimage of any open sets in $\mathbb{R}$ via $f$ is Borel, and thus $f$ is Borel measurable. 
Edit 2:
Again, from the discussion with Andreas Class, the conclusion follows immediately from the fact that every continuous function is lower semi-continuous. However, again, I don't know if the problem allows me to assume this fact. Thus, I will provide the proof below.
Proof:
To finish this problem, now we show that every continuous function is lower semi-continuous. 
To prove this, we show that a function $f$ is lower semi-continuous if and only if $f^{-1}\Big((-\infty,a]\Big)$ is closed. 
By our argument in the first part of this problem, we have showed the direction $(\Rightarrow)$. 
Conversely, assume $f^{-1}\Big((a,\infty)\Big)$ is open for each $a\in\mathbb{R}$. Let $\epsilon>0$, choose $\delta>0$ such that $$B(x,\delta)\subset\{y: f(x)-f(y)<\epsilon\}.$$
Then, we have $$f(x)-\epsilon\leq \liminf_{\|y-x\|\rightarrow 0}f(y).$$
Since $\epsilon>0$ is arbitrary, letting $\epsilon\rightarrow 0$ will prove that $f$ is lower semi-continuous. 
Now, since $f$ is continuous and $(-\infty, a]$ is closed, $f^{-1}\Big((-\infty,a]\Big)$ must be closed by definition. This happens if and only if $f$ is semi-continuous. 
Thus $f$ is continuous $\implies$ $f$ is semi-continuous. 
By the first part, every semi-continuous function is Borel measurable, so in particular, every continuous function is Borel measurable. 
Please feel free to point out any mistakes or to begin a discussion. I will wait for days and will post the answer by myself to close this post if the discussion ends.
 A: Since the discussion seems coming to an end, I now post the whole proof here. The proof is actually the combination of my original post and my edits. 
We firstly show the hint. To show the hint, it is equivalent to show that $f^{-1}\Big((a,\infty)\Big)$ is open for all $a\in\mathbb{R}$, since $$f^{-1}\Big((-\infty,a]\Big)=\mathbb{R}^{n}\setminus f^{-1}\Big((a,\infty)\Big),$$ and thus if $f^{-1}\Big((a,\infty)\Big)$ was open, then $f^{-1}\Big((-\infty,a]\Big)$ would be closed. 
So let's assume $f$ is lower semi-continuous and $f(x_{0})>a$. Then, we want to show that $f(x)>a$ for $x$ in some ball $B(r,x_{0})$. 
Suppose not, then there would be a sequence $x_{i}\rightarrow x_{0}$ such that $f(x_{i})\leq a$ for all $i$, but then by semi-continuity, we have $$f(x_{0})\leq\liminf_{\|x_{i}-x_{0}\|\rightarrow 0}f(x_{i})\leq a,$$ which contradicts our hypothesis that $f(x_{0})>a$. 
Therefore, for some $r>0$, we have $$B(r, x_{0})\subset f^{-1}\Big((a,\infty)\Big).$$
This implies that every point of $f^{-1}\Big((a,\infty)\Big)$ is an interior point and thus $f^{-1}\Big((a,\infty)\Big)$ is open.
Thus, $f^{-1}\Big((-\infty,a]\Big)$ is closed. 
In particular, both $f^{-1}\Big((a,\infty)\Big)$ and $f^{-1}\Big((-\infty,a]\Big)$ are Borel sets, since open set is Borel and closed set is a complement of an open set and thus Borel. 
Now, every open set in $\mathbb{R}$ can be written as $(a,b)$ for $a,b\in\mathbb{R}$, we now show that $f^{-1}\Big((a,b)\Big)$ is Borel to conclude the first part of the problem. 
This follows immediately from the following: $$f^{-1}\Big((a,b)\Big)=f^{-1}\Big((a,\infty)\cap\bigcup_{n=1}^{\infty}(-\infty, b+\dfrac{1}{n}]\Big)=f^{-1}\Big((a,\infty)\Big)\cap\bigcup_{n=1}^{\infty}f^{-1}\Big((-\infty, b+\dfrac{1}{n}]\Big).$$
By what we have showed, $f^{-1}\Big((-\infty, b+\dfrac{1}{n}]\Big)$ is Borel for each $n$, and then the countable union of Borel sets is Borel. Also, $f^{-1}\Big((a,\infty)\Big)$ is Borel, so $f^{-1}\Big((a,b)\Big)$ is the finite intersection of two Borel set, which is Borel (since every $\sigma$-algebra is an algebra). 
Thus, the preimage of any open sets in $\mathbb{R}$ via $f$ is Borel, and thus $f$ is Borel measurable. 
To finish this problem, now we show that every continuous function is lower semi-continuous. 
To prove this, we show that a function $f$ is lower semi-continuous if and only if $f^{-1}\Big((-\infty,a]\Big)$ is closed. 
By our argument in the first part of this problem, we have showed the direction $(\Rightarrow)$. 
Conversely, assume $f^{-1}\Big((a,\infty)\Big)$ is open for each $a\in\mathbb{R}$. Let $\epsilon>0$, choose $\delta>0$ such that $$B(x,\delta)\subset\{y: f(x)-f(y)<\epsilon\}.$$
Then, we have $$f(x)-\epsilon\leq \liminf_{\|y-x\|\rightarrow 0}f(y).$$
Since $\epsilon>0$ is arbitrary, letting $\epsilon\rightarrow 0$ will prove that $f$ is lower semi-continuous. 
Now, since $f$ is continuous and $(-\infty, a]$ is closed, by definition $f^{-1}\Big((-\infty,a]\Big)$ must be closed which happens if and only if $f$ is semi-continuous. 
Thus $f$ is continuous $\implies$ $f$ is semi-continuous. 
By the first part, every semi-continuous function is Borel measurable, so in particular, every continuous function is Borel measurable. 
