# Composition of continuous and nonmeasurable function is measurable.

I'm stuck on part (b) of the question below. This is another question from a practice preliminary exam. Thanks in advance!

Problem

a) Let $$g$$ be a monotone function on $$\mathbb{R}$$. Prove that for every measurable function $$f$$ on a measurable set $$E$$ the composition $$g \circ f$$ is measurable.

b) Show that for every continuous not strictly monotone function $$g$$ on $$\mathbb{R}$$ there exists a non-measurable function $$f$$ such that $$g \circ f$$ is measurable.

My question relates to part (b). I've solved part (a). I'm not sure if they're trying to say, "every continuous [qualifiers removed] function," or if "not strictly monotone" is trying to state that $$g$$ is monotone but perhaps not strictly so. Just wondering if anyone can solve and/or provide comment or corrections to the second part of the problem above.

Edited part (b)

Show that for every continuous function $$g$$ on $$\mathbb{R}$$ which is not strictly monotone there exists a nonmeasurable function $$f$$ such that $$g \circ f$$ is measurable.

(b) If $$g$$ is not strictly monotone, then there are $$a,b\in \mathbb R,$$ $$a\ne b,$$ such that $$g(a)=g(b).$$ Let $$E\subset\mathbb R$$ be nonmeasurable. Set $$f = a \chi_E +b\chi_{\mathbb R \setminus E}.$$ Then $$f$$ is not measurable. However, on $$E,$$ $$g\circ f = g(a),$$ and on $$\mathbb R\setminus E,$$ $$g\circ f = g(b).$$ Since $$g(a)=g(b),$$ $$g\circ f$$ is constant and hence measurable.
It means $$g$$ is monotone but not one-to-one. The condition is needed because otherwise the statement is never true: If $$g$$ is one-to-one then $$g^{-1}$$ exists and it's also monotone, so by part (a), $$f$$ would be measurable because $$f = g^{-1}\circ g \circ f$$