# Making a function out of several measurable functions

This is something I've been curious about. Suppose $(X,\mathcal{R})$ is some measurable space, and $X=\bigcup_n A_n$ where the $A_n$ are measurable, but not necessarily disjoint. On each of these $A_i$ I have some measurable function $f_i$ into $\mathbb{R}$. Luckily, if $x\in A_i\cap A_j$, then $f_i(x)=f_j(x)$, so at least these functions agree on places where their domains intersect.

If I define $f\colon X\to\mathbb{R}$ by $f(x)=f_i(x)$ when $x\in A_i$, then $f$ is at least well-defined. Is $f$ measurable also? Cheers.

-
Is the $E_i$ in the last line meant to be $A_i$? – Arturo Magidin Nov 22 '11 at 22:46
If we only have countable many of these things, then it seems like the answer is yes. – Dylan Moreland Nov 22 '11 at 22:47

Yes (I'm assuming the use of $n$ for the index means that the index set is countable). For each $a\in\mathbb{R}$, $$f^{-1}(a,\infty) = \bigcup_{i=1}^{\infty} f_i^{-1}(a,\infty),$$ which is the countable union of measurable sets, and therefore measurable.
To see this, note that if $x\in\bigcup_{i=1}^{\infty}f_i^{-1}(a,\infty)$, then there exists $i$ such that $x\in A_i$ and $f_i(x) \gt a$; hence $f(x)=f_i(x) \gt a$, so $x\in f^{-1}(a,\infty)$.
Conversely, if $x\in f^{-1}(a,\infty)$, then $x\in A_n$ for some $n$, and $a\lt f(x)=f_n(x)$; hence $x\in f_n^{-1}(a,\infty)$.
If the index set is not countable, then the answer may be "no". Just let $A_r = \{r\}$ for each $r\in\mathbb{R}$, let $V$ be a nonmeasurable set, and define $f_{r}(r) = \chi_V(r)$. Then $f=\chi_V$, which is not measurable.