Let $a_n$ be a sequence of nonnegative real numbers. Define the function $ f $ on $E=[1,∞)$ by setting $f(x)=a_n$ if $n$$\leq$ $x$$<$ $n+1$. Show that is Lebesgue measurable.
I thought that if we show $f$ is increasing then $f$ is measurable but I am not sure. Any help will be appreciated.
From Rudin: the function $f$ is measurable if for every $a \in \mathbb{R}$, the set $\{x \: | \: f(x) > a\}$ is measurable. We'll consider two cases. Since $f(x) = a_n$ for $n \leq x < n+1$ and $a_n$ is nonnegative, for $a < 0$, we have: $$ \{x \: | \: f(x) > a\} = [1,\infty), $$ which is Lebesgue measurable. On the other hand, let $a \geq 0$. Consider the (possibly empty) set: $$ S = \{a_n \: | \: a_n > a\}. $$ Then: $$ \{ x \: | \: f(x) > a\} = \bigcup_{a_n \in S} [n,n+1). $$ Each $[n,n+1)$ is Lebesgue measurable, and $S$ is at most countably infinite, so the RHS is also measurable.