Find a bijection between $[0,1)\sim(0,1)$.
Well I know that $$[0,1)\sim(0,1)=[0,\frac{1}{2})\cup [\frac{1}{2},1)\sim(0,\frac{1}{2}]\cup [\frac{1}{2},1).$$
So I found this function: \begin{align} f(x)&=-x+\frac{1}{2} &\text{ if } x\in [0,\frac{1}{2})\\ f(x)&=x &\text{ if } x\in [\frac{1}{2},1)\\ \end{align} Which is surjective but not injective because $f^{-1}(\frac{1}{2})=0,\frac{1}{2}$. Is this the correct conclution to make about $f(x)$? What is a function that works/is bijective?
This question is different than the other questions on bijections between simple real intervals because I want feedback on this specific function, $f(x)$, and I find mapping from a half closed set to an open set more confusing than mapping an open set onto a closed set.