In some home work I have to show if $f:\mathbb{R}\rightarrow\mathbb{R}$ is Borel measurable:
$f(x)= \begin{cases} x^2, x\geq0\\ 1-x^2, x\lt 0 \end{cases} $
I know that continuous functions are Borel but this is discontinuous at x=0.
(1) My idea was to say that $f^{-1}([0,1])=\{x: f(x) \in [0,1] \}$ gives me $[-1,0) \cup [0,1]=[-1,1]$ which is in $\mathcal{B}(\mathbb{R})$
(2) Another approach could be to use same approach as Showing that a discontinuous function is or is not borel measurable.
However I have doubts if (1) is even allowed as an argument? And (2) seems to "easy"
Would appreciate input here
$f(x)=x^{2}I_A+(1-x^{2})I_B$ where $A=[0,\infty)$ and $B=(-\infty,0)$. Products and sums of Borel measurable functions are Borel measurable. Hence $f$ is a Borel measurable function.