Let the Dirichlet function be given by
$$f(x):=\begin{cases} 1 &\text{if } x\in \mathbb{Q}, \\{}\\ 0 &\text{if } x\in \mathbb{R} \setminus \mathbb{Q},.\end{cases}$$
Then $f$ is measurable on [a,b].
My professor said me to try this: $f$ is measurable since $$ \{ x \in \mathbb{R}| \ \ f(x)>\alpha \} = \begin{cases} \emptyset &\text{if } \alpha \geq 1, \\{}\\ \mathbb{Q} &\text{if } 0\leq \alpha < 1 \\{}\\ \mathbb{R} &\text{if } \alpha < 0\end{cases}$$
And then since $\emptyset$, $\mathbb{Q}$ and $\mathbb{R}$ are measurable sets, we have that $f$ is measurable.
But I don't understand why if $\alpha \geq1$, $0\leq \alpha < 1$ and $\alpha < 0$ we have the last sets, and why this implies the measurability on all [a,b]? Could someone can explain me, please?...
Thanks for your help and time.