[Math] Could someone explain injectivity and surjectivity of functions

functionsmodular arithmetic

So I'm having trouble with this question and understanding functions. I realize that someone has already posted this question but i didnt see any responses that could help me so i'll try to be more specific in what i need help with.

let $f: \mathbb{Z}/12\mathbb{Z} \to \mathbb{Z}/12\mathbb{Z}: x \mapsto 9x + 1$ where arithmetic is done modulo $12$.
Show that f is neither injective, nor surjective.

I was wondering how to determine this and if someone could explain injective and surjective as i'm having trouble understanding it

thank you 🙂

Best Answer

$\mathbb Z / 12 \mathbb Z$ is small enough that you can make a table of all of the values of $f(x) = 9x+1 \pmod{12}$.

\begin{array}{c|c} x & f(x)\\ \hline 0 & 1 \\ 1 & 10 \\ 2 & 7 \\ 3 & 4 \\ 4 & 1 \\ 5 & 10 \\ 6 & 7 \\ 7 & 4 \\ 8 & 1 \\ 9 & 10 \\ 10 & 7 \\ 11 & 4 \\ \hline \end{array}


$f$ is injective if $f(x) = f(y)$ always implies that $x = y$. To show that $f$ is not injective, you need to find $x \ne y \pmod{12}$ such that $f(x) = f(y) \pmod{12}$. For example, $f(0) = f(4) = 1 \pmod{12}$.

You can look at this more closely.

\begin{align} f(x) &\equiv f(y) \pmod{12} \\ 9x + 1 &\equiv 9y + 1 \pmod{12} \\ 9x &\equiv 9y \pmod{12} &\text{Divide by $3 = \gcd(9, 12)$.}\\ 3x &\equiv 3y \pmod 4 &\text{Multiply by $\dfrac 13 \equiv -1 \pmod 4$}. \\ x &\equiv y \pmod 3 \end{align}

You can interpret $x \equiv y \pmod 3$ to mean $y = x+3n$ for some integer $n$. To be particular,

$$f(0) = f(3) = f(6) = f(9)$$

$$f(1) = f(4) = f(7) = f(10)$$

$$f(2) = f(5) = f(8) = f(11)$$


$f$ is surjective if, for every y in the codomain, there is some $x$ in the domain such that $f(x) = y$. Looking at the table, for example, we see that there is no $x$ such that $f(x) = 2$. So $f$ is not surjective.

You can look at this more closely too. Using more or less the same steps that we used above,

\begin{align} f(x) &\equiv y \pmod{12} \\ 9x + 1 &\equiv y \pmod{12} \\ 9x &\equiv y-1 \pmod{12} &\text{Divide by $3 = \gcd(9, 12)$.}\\ 3x &\equiv \dfrac{y-1}{3} \pmod 4 \end{align}

We see that, in order to solve for $x$, we need for $\dfrac{y-1}{3}$ to be an integer. This is precisely what $y \equiv 1 \pmod 3$ means and it suggests that we need to have $y \in \{1,4,7,10\} \pmod{12}$. Looking at the table of $y-$values, we see that is true.

Related Question