Define $f : [0, 1] → \Bbb R$ by $f(x) = 0$ if $x$ is rational,$1/(d^{1/2})$ if $x$ is irrational and $x = 0.0 . . . 0d . . . $, where $d$ is the first nonzero digit in the decimal expansion of $x$. Prove that $f$ is measurable.
My solution:
{$x: f(x)>1$}$=\phi$, which has measure $0,$
{$x: f(x)<0$}$=\phi$, which has measure $0,$
{$x: 0\leq f(x)\leq 1$}$=[0,1]= (-\infty, 1]\cap [0,\infty)$,
$(-\infty, 1]$ and $[0,\infty)$ both are measurable as Borel sets. Hence the intersection is measurable.
This proves that $f$ is measurable.
Is the proof correct?
Let $E$ be the set of irrationals in $[0,1].$ For $k = 1,2,\dots ,9,$ define
$$E_k = E\cap \left [\bigcup_{n=1}^\infty \,(k/10^n,(k+1)/10^n)\right ].$$
The sets $E_k$ are clearly measurable, and $E$ is the pairwise disjoint union of them. Note that $f = 1/\sqrt k$ on $E_k.$ Thus
$$f = \sum_{k=1}^{9}(1/\sqrt k)\chi_{E_k}$$
on $[0,1].$ Measurability of $f$ is now easy to check.