I want to determine if the following function is Borel: $$f(x)=\begin{cases} 1, \, x\in \mathbb Q\\ -1, \, x \notin \mathbb Q \end{cases}$$
My idea is that: $$f^{1}(1)=[Q_1] \bigcup [Q_2] \bigcup ... [Q_n]$$ and $$f^{-1}(-1)=(a,b) \bigcup (b,c) \bigcup ... (d,e)$$ for the irrationals
However I am not sure about the last part because I need to mathematically show that these are only the irrationals
Any hint would be appreciated
That last part is not OK, because no matter what $a,b$ are, there is always some rational in the interval (so long as the interval is not empty)
However, you can more simply write $$f^{-1}(-1) = \left(f^{-1}(1)\right)^c.$$