Real Analysis, Folland Problem 2.1.5 Measurable Functions 
Problem 2.1.5 - If $X = A\cup B$ where $A,B\in M$, a function $f$ on $X$ is measurable if and only if $f$ is measurable on $A$ and on $B$.

Proof - Suppose, $X = A\cup B$ where $A,B\in M$ and we have a function $f$ on $X$ that is measurable. Then we have for all Borel sets $\mathcal{B}\subset\mathbb{R}$, we have \begin{align*} 
f^{-1}(\mathcal{B}\cap X \in M &= f^{-1}(\mathcal{B})\cap(A\cup B)\\
&= (f^{-1}(\mathcal{B}\cap A)\cup (\f^{-1}(\mathcal{B}\cap B)\in M
\end{align*}
thus $f$ is measurable on $A$ and on $B$.
Conversely, suppose $f$ is measurable on $A$ and on $B$, and suppose we have a measurable set $E$ from the codomain of $f$. Then, $$f^{-1}(E)\cap A\in M \ \ \ \text{and} \ \ \ f^{-1}(E)\cap B\in M$$ So, $$f^{-1}(E) = (f^{-1}(E)\cap A)\cup(f^{-1}(E)\cap B)\in M$$ and so $f$ is measurable. 
I am not sure if this is correct any suggestions is greatly appreciated. 
 A: 
Problem 2.1.5 - If $X = A\cup B$ where $A,B\in M$, a function $f$ on $X$ is measurable if and only if $f$ is measurable on $A$ and on $B$.

Before the proof, let us precise what means " $f$ is measurable on $A$" (and " $f$ is measurable on $B$").  Since $A \in M$, we have that $M_A=\{ C\in M : C\subset A\}$ is a $\sigma$-algebra. It is the "restriction" of $M$ to $A$. To say that " $f$ is measurable on $A$" means that $f|_A$ is $M_A$-measurable. Similar considerations apply to $B$.
Proof - Suppose, $X = A\cup B$ where $A,B\in M$ and we have a function $f$ on $X$ that is measurable. Then, for all Borel set $E\subset\mathbb{R}$, we have $f^{-1}(E) \in M$. Since $A \in M$, we have
$$(f|_A)^{-1}(E)= f^{-1}(E) \cap A \in M$$
Since $f^{-1}(E) \cap A \subset A$, we have 
$$(f|_A)^{-1}(E)= f^{-1}(E) \cap A \in M_A$$
So $f|_A$ is $M_A$-measurable. 
In a similar way, we prove that $f|_B$ is $M_B$-measurable.
Conversely, suppose $f$ is measurable on $A$ and on $B$. That is to say  $f|_A$ is $M_A$-measurable and $f|_B$ is $M_B$-measurable. Then, for all Borel set $E\subset\mathbb{R}$, we have $(f|_A)^{-1}(E) \in M_A \subset M$ and $(f|_B)^{-1}(E) \in M_B \subset M$ and so we have
$$f^{-1}(E)= (f^{-1}(E)\cap A) \cup (f^{-1}(E)\cap B)=(f|_A)^{-1}(E) \cup (f|_B)^{-1}(E)\in M$$
So $f$ is measurable. 
