Checking if a function is injective and surjective

I am doing past paper question and came across the following question:

For each of the following functions, decide whether it is injective and surjective. Justify your answer.

$f:$ {$-1, 0, 1$} $\to$ {$-1, 0, 1$}

$f(x) = x^3$

$g:$ {$0, 1$} $\to$ {$0, 1, 2, 3, 4, 5$}

$g(x) = 3x + 1$

I have only recently started studying functions, so hoped to check my answers here, because I do not have access to a marking scheme.

$f$ is not injective, because $\pm x \neq \pm x$

$f$ is surjective because the co-domain {$-1, 0 ,1$} $=$ the range {$-1, 0 ,1$}

$g$ is injective, because $x = x$

$g$ is not surjective, because the co-domain {$0, 1, 2, 3, 4, 5$} $\neq$ the range {$1, 4$}

Please let me know if I have made any errors in my answers or reasoning. Thank you.

• @LinkingPark but because we must $\sqrt[3]{x^3}$ does that not mean that $x$ can be either positive or negative, and therefore $\pm x$ does not imply one another? Commented Jan 5, 2018 at 13:37
• You can easily see that $f(-1)=-1 ,f(1)=1,f(0)=0$ and then you can see that this is bijective mapping (surjective and injective).I dont understand you way of thinking.
– user508685
Commented Jan 5, 2018 at 13:41
• I can see that, but I am confused because I followed this youtu.be/bZred_Ksz2k?t=220 Commented Jan 5, 2018 at 13:46
• If you use that you must know that $({x^{3}})^{1/3}=x$
– user508685
Commented Jan 5, 2018 at 13:56

Another way to think about it.

If $f:X\to Y$ is a function then for every $y\in Y$ we have the set $f^{-1}(\{y\}):=\{x\in X\mid f(x)=y\}$.

(non-empty subsets of this form are the so-called fibers of $f$ and form a partition of $X$)

Based on that you can say:

• $f$ is injective iff $f^{-1}(\{y\})$ has at most one element for every $y\in Y$.
• $f$ is surjective iff $f^{-1}(\{y\})$ has at least one element for every $y\in Y$.

So checking a function on injectivity and/or surjectivity boils down to checking how the sets $f^{-1}(\{y\})$ behave.

I think you understood the concept of surjection but not injection.

A function $h$ is injective if $h(a)=h(b)$ implies that $a=b$. Equivalently, if $a \neq b$ then $h(a) \neq h(b)$.

$f$ is injective because $f(-1)=-1, f(0)=0, f(1)=1$, we can see that the images are distinct. Hence it is injective.

$g(0)=1$ and $g(1)=4$, again, it is injective.

• So to check if it is injective, I should put every value from the domain into the function, and then check that all the outputs are both unique from one-another, and, that all the outputs match up to a value in the co-domain? Commented Jan 5, 2018 at 14:09
• I prefer using $h(a)=h(b)$ implies $a=b$ actually. Also, for this question, $f$ and $g$ are increasing function, hence they are injective. Commented Jan 5, 2018 at 14:12
• But lets say from the example "$g(0) = 1$ and $g(1) = 4$", but instead imagine it was $g(0) = 1$ and $g(1) = 6$, then would it still be injective even though $6$ isn't in the co-domain? Commented Jan 5, 2018 at 14:55
• then we have an even bigger issue... the function wasn't defined properly. First, we define the function properly, state the domain, the codomain, and the rule. After the function is well defined, then we can talk about whether it is injective or surjective. Commented Jan 5, 2018 at 15:17
• I understand that if $g(1) = 6$ then the function would not be properly formatted. I am just asking, hypothetically, would the function still be injective if $g(1) = 6$, but $6$ is outside of the codomain (i.e. the codomain is specified as being {$1,2,3,4,5$}? Commented Jan 5, 2018 at 21:20