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.
My answers and reasoning:
$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.