Suppose the function $f : \mathbb Z \to \mathbb Z$ is defined as

$$f(𝑥) = \begin{cases} \displaystyle x+1, & 𝑥 \le 4 \\ x-2, & 𝑥 \ge 5 \\ \end{cases}$$

I started by showing that it's injective for $x \le 4$ and $x \ge 5$ by showing that $𝑓(𝑥)=𝑓(y)$.

Then, I showed that it is surjectve this way:

$$f(x) = x+1 \implies x = n - 1$$

Since $(n-1) \le 4, f(n-1) = (n-1) + 1 = n$

Same logic for the second case...

Am I doing the right thing? I always get confused when it comes to piece-wise functions!


1 Answer 1


Showing injective for each piece is not sufficient.



What can you conclude about whether the function is injective or bijective?

To verify surjectivity, pick any $x \in \mathbb{Z}$, try to find a preimage.

You might want to consider cases such as case $1$: $x \leq 5$ and case $2$: $x > 5$.

  • $\begingroup$ I'm not sure what you mean, I showed its surjectivity by considering the inverse functions. So for case 1, I said x = y-1. Therefore, f(y-1) in case 1 gives the following: (y-1) + 1 = y. $\endgroup$
    – Mohanad
    Oct 31, 2017 at 4:43
  • $\begingroup$ hi, which part is the part that you are not sure what I mean? injective part or surjective part? $\endgroup$ Oct 31, 2017 at 4:47
  • $\begingroup$ For the surjective part, notice that showing each piece of function has an inverse function does not indicate that it is a surjective function. For example, I can change the question to $$f(𝑥) = \begin{cases} \displaystyle x+1, & 𝑥 \le 4 \\ x\color{blue}+2, & 𝑥 \ge 5 \\ \end{cases},$$ and $6$ would not have a preimage. $\endgroup$ Oct 31, 2017 at 5:04
  • $\begingroup$ 1) f:Z→Z, f(x)=x+1, x<=4 For f(x) to be surjective it must be the case that every y∈Z can be written as y=f(x) for some x, x = n -1, so case 1 is surjective $\endgroup$
    – Mohanad
    Oct 31, 2017 at 5:38
  • $\begingroup$ btw, what is the original question, is it to check if a function is a bijection? $\endgroup$ Oct 31, 2017 at 5:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .