Let $f:[a, b] \rightarrow[a, b]$ be continuous. Provide a counterexample for the following statement:
The inverse image $f^{-1}([c, d])$ is connected for any $[c, d] \subset[a, b]$.
One of the ideas that I could think of is to give an example for which inverse image $f^{-1}([c, d])$ would be the union of two closed intervals, concluding the disconnectedness of it. However, after trying a lot of examples, I could not come up with a solid example for this case.
Note: The values $a,b$ are fixed.
Let $f:[-1,1]\to[-1,1]$ be given by $f(x)=x^2$. Now $[1/4,1]\subset[-1,1]$ is a connected subset, and $f^{-1}([1/4,1])=[-1,\frac{-1}{2}]\cup[\frac{1}{2},1]$ which is a disconnected subset of $[-1,1]$.
The same idea here works for any $[a,b]$ by shifting/scaling $f$ as desired (as noted in the comments).