The function $f$ you suggested doesn't work.
You can split the domain to the following parts: $[0,1] = (0,1)\cup \{0\} \cup \{1\}$. The interval $(0,1)$ gets sent to the interval $(0,1/4)$ since you are dividing by $4$.
Therefore, the image of your function is $(0,1/4)\cup \{ 1/2\} \cup \{1/3\} \neq (0,1)$ since you are missing almost all numbers greater than $1/4$, so your function is not surjective onto $(0,1)$.
Let me explain the idea that is at play here, but let me look for a bijection $f\colon [0,1) \to (0,1)$ instead.
It's kind of intuitive to think that these two sets differ only because the domain has one extra point so you wouldn't be wrong to think that $f$ could be chosen in such a way that it's almost always identity. The problematic part is that pesky $0$ in the domain, you can't set $f(x) = x$ on $(0,1)$ since you already used all the numbers in the codomain and you didn't send $0$ anywhere yet, so whatever you do would render $f$ non-injective.
What you do instead is to send $0$ somewhere first. Now, $f(0)\neq 0$ is used in the codomain, so you still can't define $f(x) = x$ on $(0,1)$ since both $0$ and $f(0)$ in $[0,1)$ would be sent to $f(0)$. So, you need to send $f(0)$ somewhere else, to $f(f(0)) \neq f(0)$.
Iterating the process, you get a whole sequence of different numbers $a_0 = 0$, $a_1 = f(0)$, $a_2 = f(f(0))$ and in general $a_n = f(a_{n-1})$.
Now comes the beautiful part of the above observation. Let $A = \{a_1,a_2,\ldots\}$ and $A_0 = \{a_0,a_1,a_2,\ldots\}$ defined as above. Note that $f\colon A_0 \to A$ is a bijection by construction. Also, note that $[0,1)\setminus A_0 = (0,1)\setminus A$. Therefore, you can now define $f$ to be identity on $[0,1)\setminus A_0$.
To summarize the process:
- Choose a sequence $\{a_1,a_2,\ldots\}$ in $(0,1)$ such that $a_n\neq a_m,\ n\neq m$.
- Define $a_0 = 0$.
- Define $f\colon [0,1)\to (0,1)$, $f(x) = \begin{cases}
f(x) = a_{n+1},& x = a_n,\, n\in\mathbb N_0\\
f(x) = x,& \text{otherwise}.
\end{cases}$
- Define $g\colon (0,1)\to [0,1)$, $g(x) = \begin{cases}
g(x) = a_{n-1},& x = a_n,\, n\in\mathbb N\\
g(x) = x,& \text{otherwise}.
\end{cases}$
- Verify that $f$ and $g$ are inverse to each other by noting that $[0,1)\setminus \{a_0,a_1,a_2,\ldots \} = (0,1)\setminus \{a_1,a_2,\ldots \}$.
I will let you work out your situation $[0,1] \to (0,1)$ where you have two extra points instead of just one.
There indeed may be an error in the text but not in the function itself. This may be a bijection from $(0, 1)$ to $[0, 1]$. I surmise this because an inverse function is also provided, which is explicitly stated to map $[0,1]$ back to $(0,1)$. Because of this, I suspect that the original function $f(x)$ maps the interval to the segment, and not the segment to the interval, as is stated in the text, which could be a transpositional error.
– l0ner9 Jun 03 '23 at 12:31