Let $A \subset \Bbb R^n$ and $f:A \to \Bbb R$. Show that if $A = \bigcup_{i} B_i$ and $f\mid_{B_{i}}$ is measurable for any $i$ then $f$ is measurable 
Let $A \subset \Bbb R^n$ and $f:A \to \Bbb R$. Show that if $A = \bigcup_{i} B_i$ for $B_1, B_2, \dots$  and $f\mid_{B_{i}}$ is measruable for all $i$, then $f$ is measurable.

Since $f\mid_{B_{i}}$ is measurable for all $i$ we have that $E=\{x \in A \mid f\mid_{B_{i}}(x) > a \}$ is measurable for any $i$. Now since this holds for any $i$ $$E= \{x \in A \mid f\mid_{B_{i}}(x) > a \} = \{x \in A \mid f\mid_{\bigcup_i B_{i}}(x) > a \} = \{x \in A \mid f(x) > a \}$$ and so $f$ is measurable. Is the solution here correct?

Consider a measurable set $S \subseteq \mathbb{R}$. Then consider that
$\begin{equation}
\begin{split}
f^{-1}(S) &= f^{-1}(S) \cap A \\
&= f^{-1}(S) \cap \bigcup\limits_{i \in \mathbb{N}} B_i \\
&= \bigcup\limits_{i \in \mathbb{N}} f^{-1}(S) \cap B_i \\
&= \bigcup\limits_{i \in \mathbb{N}} f|_{B_i}^{-1}(S)
\end{split}
\end{equation}$
which is a countable union of measurable sets, hence measurable. So $f$ is measurable.
Note that the fact that $A \subseteq \mathbb{R}^n$ is not used here at all, nor is the fact that the codomain of $f$ is $\mathbb{R}$. Any measure spaces could have been used instead.
The key facts which are needed are that intersections distribute over arbitrary unions and that if $X \subseteq Y$, $g : Y \to Z$, $W \subseteq Z$, then $g^{-1}(W) \cap X = g|_X^{-1}(W)$.
