TITLE: Is $ \{x\in E | f(x) \le g(x)\}$ measurable if f and g are measurable?
QUESTION [5 upvotes]: I want to show that the set 
$$X = \{x\in E | f(x) \le g(x)\}$$ 
is measurable. Here $f$ and $g$ are measurable functions over a measurable set $E$.
My solution is, 
$$X = \cup_{q \in Q} \{\ \{x |  f(x) \le q\} \cap \{x| g(x) \ge q\}\}$$ 
is measurable, because RHS is countable union of measurable sets which should be measurable.

But aren't we ignoring the cases where $f(x)\le a$ and $g(x)\ge a$, where $a$ is irrational.

REPLY [8 votes]: Yes, you are ignoring the case where $f(x)=g(x)=a$ for irrational $a$; and in fact, your equality need not hold.
However,   consider the complement of your given set: 
$$X^c=\{\, x \in E\mid g(x)<f(x)\,\}.$$
Your approach will work here: since $g(x)<f(x)$ if and only  and only if there is a rational number $a$ with $g(x)<a<f(x)$, you can write
$$
X^c=\bigcup_{q\in \Bbb Q}\bigr(\, \{\, x \in E \mid g(x)<q\,\} \cap  \{\, x \in E \mid f(x)>q\,\} \,\bigl).
$$
It follows that $X^c$ is measurable; thus, $X=\{\, x \in E \mid f(x)\le g(x)\,\}$ is measurable.