I am stuck in the following question:
Suppose $f: B \rightarrow \mathbb{R}$ be a Borel measurable function. Let $g(x)=\begin{cases} f(x), & \text{if } x \in B,\\ 0, & \text{if } x \in B^c \end{cases}$.
I would like to first show that $B$ is a Borel set and that the function $g$ is Borel measurable. I know the required definitions, but I can't figure out how to put things together to solve this. Would someone please help?