If $A_q$ is open for all $q \in \mathbb Q$ prove $A_r$ is open for all $r \in \mathbb R$

28 Views Asked by At

The problem is as follows. Let $X$ be a metric space and $f: X \to \mathbb R$ be a function such that $A_q = \{x \in X: f(x) < q\}$ is open for all $q \in \mathbb Q$. Prove $A_r = \{x \in X: f(x) < r\}$ is open for all $r \in \mathbb R$.

My idea is to define $\{q_n\}$ to be a sequence of rational numbers such that $$\lim_{n\to\infty}q_n \to r$$ Now $$A_r = \bigcup_{n \in \mathbb Z_+}A_{q_n}$$ Does this construction work? If this is correct, I would be glad to see an alternative proof that doesn't rely on convergent sequences.