Preimage Under a Piecewise Function I have a basic question about calculating the preimage of a piece-wise function; I am trying to understand the logic and procedure involved in finding/calculating the preimage. In an example from my topology book, I am given this function
$f(x) = \begin{cases} x-2 & x < 0 \\ x+2 & x \ge 0 \end{cases}$,
and that $f^{-1}((1,3)) = [0,1)$, which I am trying to prove on my own. I haven't really done much "calculations" of images and preimages, particularly with piece-wise functions, and I am having some logic issues. Here is what I have

Suppose that $x \in [0,1)$. Since $x$ satisfies $x \ge 0$, we know that $f(x)$ will evaluate to $x+2$, and we can ignore how the $f$ maps $x$ according to the other rule. Hence, $0 \le x < 1$ or $2 \le x + 2 < 3$ or $2 \le f(x) < 3$, which says that $f$ maps $x$ to some value in $(1,3)$ and therefore $x \in f^{-1}((1,3))$
Now, suppose $x \in f^{-1}((1,3))$. Then $1 < f(x) < 3$. If $x \ge 0$, then $1 < x+2 < 3$, implying $-1< x < 1$, which doesn't guarantee $x \in [0,1)$...Now, suppose $x < 0$. Then $1 < x-2 < 3$ or $3 < x < 5$, which means that $x \in [0,1)$ is certainly untrue...

This is where I got confused about the logic. It seems that we should have $x \in [0,1)$ in either case, but we don't have this. I was wondering if someone would critique this, especially whether it is correct to say, "Since $x$ satisfies $x \ge 0$, we know that $f(x)$ will evaluate to $x+2$, and we can ignore how the $f$ maps $x$ according to the other rule."
Also, I have a more general question. In this case, I was given the preimage. But suppose that I didn't know the preimage was $[0,1)$, that I had to make my own conjecture. What is the "most logical" way of determining it?
 A: Either $x<0$ and $x-2 \in (1,3)$ [which can't happen],
or else $x \ge 0$ and $x+2 \in (1,3),$ i.e. $x \in (-1,1).$
In the second (and only possible) case, the combination of $x \ge 0$ with $x \in (-1,1)$ gives $x \in [0,1).$
A: To calculate $f^{-1}((1,3))$, you should look at the individual $f$ inverses first. Treat them as separate functions, with different domains, and then combine the domains at the end. I think your answer is not very clear, so I wish to not comment.
In the first case, if $x-2 \in (1,3)$  then $x \in (3,5)$. However, combining with the domain $x<0$, we see that $x$ cannot take any value,because the domain of $x$ and the satisfactory values of $x$ do not coincide. This is ,I think your major doubt, and it is very much possible that this can happen!
If $x +2 \in (1,3)$, then $x \in (-1,1)$, and the domain of $x$ is $x \geq 0$, so combining, we have that $x \in [0,1)$ , by taking the intersection of $(-1,1)$ with $[0,\infty)$.
Hence, the preimage of $(1,3)$ is just $[0,1)$, by combining the preimages of the individual functions. 
There should be no confusion with the answer. A piece wise defined function has everything that a normal function has, except a lack of continuity at some point, in which case we just break it into component functions, and then analyze each component, before putting it all together.This can be done in general with any piecewise function.
