TITLE: How to find the inverse of a piecewise function
QUESTION [5 upvotes]: How would I go about finding the inverse of a piecewise function?
In this case the function is

$$
   f(x) = \left\{
     \begin{array}{lr}
       x, & \text{if } 0\leq x \leq 1,\\
      x-1, & \text{if } 2 < x \leq 3.
     \end{array}
   \right.
$$

REPLY [7 votes]: You have $y=x$ when $0 \le x \le 1$ and $y=x-1$ when $2 < x \le 3,$ which is to say when $1<y\le 2$ since $y=x-1$. And the inverse function is obtained by switching $x$ and $y$. So when $0 \le y \le 1$ the inverse value is $y$, while when $1<y\le 2$ the inverse value is $y+1$.