Piecewise Combination of Measurable Mappings is Measurable/Binary Case

Theorem
Let $\left({X, \Sigma}\right)$ and $\left({X', \Sigma'}\right)$ be measurable spaces. Let $f,g: X \to X'$ be $\Sigma \, / \, \Sigma'$-measurable mappings.

Let $E \in \Sigma$ be a measurable set.

Define $h: X \to X'$ by:


 * $\displaystyle \forall x \in X: h \left({x}\right) := \begin{cases}

f \left({x}\right) & \text{if $x \in E$}\\ g \left({x}\right) & \text{if $x \notin E$} \end{cases}$

Then $h$ is also a $\Sigma \, / \, \Sigma'$-measurable mapping.

Proof
Let $E' \in \Sigma'$ be a $\Sigma'$-measurable set.

Then by definition of preimage:


 * $h^{-1} \left({E'}\right) = \left\{{x \in X: h \left({x}\right) \in E'}\right\}$

Expanding the definition of $h$, this translates into:


 * $h^{-1} \left({E'}\right) = \left\{{x \in E: f \left({x}\right) \in E'}\right\} \cup \left\{{x \in \complement_X \left({E}\right): g \left({x}\right) \in E'}\right\}$

where $\complement$ denotes set complement.

That is, we have:


 * $h^{-1} \left({E'}\right) = \left({E \cap f^{-1} \left({E'}\right)}\right) \cup \left({\complement_X \left({E}\right) \cap g^{-1} \left({E'}\right)}\right)$

All sets on the RHS are $\Sigma$-measurable.

By Sigma-Algebra Closed under Intersection and Sigma-Algebra Closed under Union, so is $h^{-1} \left({E'}\right)$.

Since $E' \in \Sigma'$ was arbitrary, $h$ is a $\Sigma \, / \, \Sigma'$-measurable mapping.