proving a function is Borelmeasurable
Solution 1:
Given a measurable space $(X,\mathscr A)$, $A \in \mathscr A$, and $f,g \colon X \to \mathbb R$ two measurable functions (that is, for any Borel subset of $\mathbb R$, its preimage is an element of $\mathscr A$), then $h \colon X \to \mathbb R$ defined by $$\forall x \in X, \quad h(x) = \begin{cases} f(x) & \textrm{if $x \in A$} \\ g(x) & \textrm{if $x \notin A$} \end{cases}$$ is also measurable. This is true because $A \in \mathscr A$ implies that the characteristic functions $\chi_A$ and $\chi_{X \setminus A}$ are measurable, and because the sum and product of measurable functions is again measurable, it follows that $h = f \chi_A + g\chi_{X \setminus A}$ is measurable.