# One-One function check with piecewise function

I am little unclear on this problem. I need to prove that this is a one-one function. I know that I need to show $f(x) = f(y) \Rightarrow x = y$. But I don't know how this applies to piecewise functions.

$$f:x \rightarrow \begin {cases} |x| - 1 & x \leq -1 \\ -x^2 & x \geq 0 \end {cases}$$

Edit: The answer by @Joe seems to make sense to me. But can you guys clarify this. Piecewise functions generally graph out as fragments. Does the one-one function property $f(x) = f(y) \Rightarrow x = y$ differ in that case?

-
Hey, thanks for fixing that. I couldn't figure out how to get a piecewise function in latex. Good to know! – mathguy80 Jun 27 '11 at 15:38
In answer to the edit, the one-to-one property doesn't differ in definition. A better way to think might be if $x$ and $y$ are two different numbers, then $f(x)$ and $f(y)$ are two different numbers. In terms of graphs, you shouldn't be able to draw a horizontal line that intersects the graph in more than one place. – Joe Johnson 126 Jun 27 '11 at 16:09

This function is not one-to-one, since $f(0)=f(-1)=0$.

-
how is $f(0)=0$. By the way the domain is $(-\infty, -1]$ and $0 \notin (-\infty, -1]$ – user9413 Jun 27 '11 at 12:04
It's a piecewise function, my notation isn't very clear. But 0 can't be used for the first rule, and -1 can't be used for the second rule. – mathguy80 Jun 27 '11 at 12:06
@Chandru: The domain of the function is $(-\infty,-1]\cup[0,\infty)$. It's piecewise, thus defined as different things on different parts of the domain. To evaluate $f$ at $x=0$, use the rule $f(0)=-0^2=0$. To evaluate $f$ at $x=-1$, use the rule $f(-1)=|-1|-1=0$. – Joe Johnson 126 Jun 27 '11 at 12:35
@mathguy80: If those are two different functions and you need to show that each separately is one-to-one, then my answer does not apply. But, you seem to be implying that they are two pieces of the same function. – Joe Johnson 126 Jun 27 '11 at 12:37
@Chandru: How can the domain be $(-\infty,-1]$ and $f$ is defined as $-x^2$ for nonnegative $x$? The domain is $(-\infty,-1]\cup [0,\infty)$. – Asaf Karagila Jun 27 '11 at 12:42

The definition of a one-to-one function (also called injective sometimes) is that two different inputs are mapped to two different outputs.

That is, if $f(x)=f(y)$ then $x=y$. Whether or not the function is defined by a formula, piecewise, not continuous, or polynomial... it does not matter.

-