- $f(x) = 2[x]-x$,
- $[x]$ is the floor function,
- the domain of the function is $[-1,2]$,
- its codomain is $\Bbb R$ $$ f(x) = \begin{cases} -2-x & \text{if } -1 \leq x < 0 \\ -x & \text{if } 0 \leq x < 1 \\ 2-x & \text{if } 1 \leq x < 2 \\ 4-x & \text{if } x = 2 \\ \end{cases} $$ a diagonal line is formed on the graph going downwards from the starting point of the interval to its end where every $y$ has one $x$ only so it invertible that points have the same $y$
how can i do the inverse, with the floor function involved ?
The inverse is $$g(x) = 2\lceil x \rceil - x,$$ where $\lceil x \rceil$ is the ceiling function. To prove this, all we need to do is compose them, i.e. examine $f\circ g$ and $g \circ f$, and verify they are the identity.
Suppose $x \in \Bbb{R}$. We wish to show, first, that $(g \circ f)(x) = x$. We have $$(g \circ f)(x) = 2\lceil 2 \lfloor x \rfloor - x\rceil - 2 \lfloor x \rfloor + x = x \iff \lceil 2 \lfloor x \rfloor - x\rceil = \lfloor x \rfloor.$$ This is indeed the case, since \begin{align*} &0 \le x - \lfloor x \rfloor < 1 \\ \implies \, &-1 < \lfloor x \rfloor - x \le 0 \\ \implies \, &\lfloor x \rfloor - 1 < 2\lfloor x \rfloor - x \le \lfloor x \rfloor \\ \implies \, &\lceil 2\lfloor x \rfloor - x \rceil = \lfloor x \rfloor. \end{align*} Thus, $(g \circ f)(x) = x$, as required.
We now wish to show $(f \circ g)(x) = x$. This can be done by observing that $g(x) = -f(-x)$ for all $x$, and so \begin{align*} (f \circ g)(x) &= f(g(x)) \\ &= f(-f(-x)) \\ &= -(-f(-f(-x))) \\ &= -g(f(-x)) \\ &= -(g \circ f)(-x) \\ &= -(-x) = x. \end{align*} Thus, $f\circ g$ and $g \circ f$ are the identity map. By definition, $g$ is the inverse of $f$.