Exercise Let $X$ be an infinite uncountable set. Let $M$ be $\sigma$-algebra on $X$, that contains all subsets $E\subset X$ with the property that one of $E$ or $E^c$ is countable or finite.
Let $f :X \rightarrow \mathbb{R}$ be a function such that there exist a countable or finite $F\subset X$ such that f is constant on $F^c$. Prove that $f$ is measurable with respect to $M.$
What I know: So to show that f is measurable with respect to $M$ we have to show that if we take an open set in $\mathbb{R}$ say $U$ then $f^{-1}(U) \in M$.
So open sets in $R$ are intervals $(a,b)$. Take such interval then $f^{-1}$ will be mapped to some subset $E \subset X$. We need that for this subset will holds that one of $E$ or $E^c$ is finite or countable. But since we know that there exist a countable or finite $F\subset X$ such that f is constant on $F^c$ then f is constant on $E^c$.
Could anyone please give some hints about how to proceed next?
Suppose that $f(x)=c$ on $F^c$. Suppose the interval $c\notin (a,b)$. Then $f^{-1}(a,b)\subset F$ whence $f^{-1}(a,b)$ is countable or finite and thus measurable.
If $c\in (a,b)$, then $F^{c}\subset f^{-1}(a,b)$, whence $(f^{-1}(a,b))^{c}\subset F$, so that $(f^{-1}(a,b))^{c}$ is countable or finite as desired.