How to prove for all $r \in \mathbb{R}$, $\{x \in F \colon f(x) \leq r\}$ is a closed set in $\mathbb{R}$? Let $F$ be a closed real set and let $f$ be a continuous function $f \colon F \rightarrow \mathbb{R}$.
How can I prove that, for all real number $r$, the set $D = \{x \in F \colon f(x) \leq r\}$ is a closed set?
Thank you.
 A: Assuming that you are essentially supposed to be proving one direction of the equivalence between the metric and topological concepts of "closed", rather than just using the latter:
We wish to show that $\mathbb{R}\setminus D$ is open. That is, given any $x \in \mathbb{R}\setminus D$, we wish to show that there is some $\delta > 0$ such that $(x - \delta, x + \delta) \cap D = \emptyset$.
So, suppose not. Then there is some $x \in \mathbb{R}\setminus D$ such that for any $\delta > 0$, there is some $y_\delta \in (x - \delta, x + \delta) \cap D$. In particular, for every natural $n$, there is some $y_n \in (x - \frac{1}{n}, x + \frac{1}{n})\cap D$.
Now, $|y_n - x| < \frac{1}{n}$ for all $n$, so $(y_n) \to x$.
Since $f$ is continuous, then, $\lim\limits_{n \to \infty}f(y_n) = f\left(\lim\limits_{n \to \infty}y_n\right) = f(x)$.
But also, $y_n \in D$ for all $n$, so $f(y_n) \leq r$ for all $n$. Thus, $\lim\limits_{n\to\infty}f(y_n) \leq \lim\limits_{n\to\infty}r = r$.
Combining these gives $f(x) \leq r$, so $x \in D$, a contradiction.
Thus, we conclude that indeed, $\mathbb{R}\setminus D$ is open, and hence $D$ is closed.
