# Set measurability from function measurability Borel-wise

Let $a,b\in \mathbb R$ and $A,B\subset \mathbb R$. If $aI_A+bI_B$ is a Borel measurable function, are $A$ and $B$ necessarily Borel measurable sets?

-
Are you allowed to take $a = b = 0$ (with $A$ and $B$ are unrestricted)? :) – Srivatsan Nov 15 '11 at 22:31
"Let $a,b\in \mathbb R$ and $A,B\subset \mathbb R$" clearly implies that all four are chosen by the adversary. – Henning Makholm Nov 15 '11 at 22:48

As it was pointed out, if $a = 0$ then $A$ can be any, $b=0$ implies that $B$ is any, so that not necessarily Borel measurable.
Let now assume that both $a$ and $b$ are different from $0$ and $a\neq b$, $a\neq -b$. Then $$f(x) = a\cdot 1_A(x)+b\cdot 1_B(x)$$ can take four distinct values: $0,a,b,a+b$. Each of this singleton sets is Borel hence pre-image of it has to be a Borel set. We have: $$\begin{cases} f^{-1}(a+b) &= A\cap B, \\ f^{-1}(a) &= A\setminus B, \\ f^{-1}(b) &= B\setminus A, \\ f^{-1}(0) &= (A\cup B)^c. \end{cases}$$ Each of these sets is Borel since $f$ is Borel, so the set $A = f^{-1}(a+b)\cup f^{-1}(a)$ is a Borel set as well as the set $B = f^{-1}(a+b)\cup f^{-1}(b)$.
For the case when $a$ and $b$ are non-zero but $a=b$ we know only that $A\cup B$ and $A\cap B$ are measurable. Let $A$ be some non-measurable set, then you can take $B=A^c$ so $f(x) = a$ and is Borel measurable though both sets $A$ and $B$ are not.
Edited: Thanks to Him-Who-Must-Not-Be-Named, the case when $a = -b$ one can take $A$ non-measurable and another set $B = A^c$ non-measurable as well to have $f(x) = 0$, i.e. measurable.