Prove this function is injective $f(x)=x+\mod(x,7)$ Prove this function is injective $f(x)=x+\mod(x,7)$.
Attempt:
I tried separating in two cases: $x \equiv y \pmod 7$ and $x \not \equiv y \pmod 7 $:
First case:
$$f(x)=f(y) \iff x+\mod(x,7)=y+ \mod (y,7)\implies x= y
$$
But I couldn't prove the second case.
 A: Note: $-7<\text{mod}(x,7)-\text{mod}(y,7)<7$ and $x-y\equiv \text{mod}(x,7)-\text{mod}(y,7)\pmod{7}$.
If $f(x)=f(y)$, then $-(x-y)=\text{mod}(x,7)-\text{mod}(y,7)$.  What happens then?
P.S. 
(1) It's "injective," and not "inyective."
(2) We can use any other odd positive integer $m$ in place of $7$ and the claim still holds.
A: Take two different numbers $7a+b$ and $7c+d$ with $0\leq b,d<7$. notice $f(7a+b)=7a+2b$ and $f(7c+d)=7c+2d$. The difference is therefore $7(a-b)+2(d-c)$, if this number was zero then $2(d-c)$ would have to be a multiple of $7$, the only possibility is $0$, of course this means $b=d$, but if $b=d$ then $f(7a+b)=7a+2b$ and $f(7c+d)=7c+2b$, which are different.
A: We have $f:\mathbb Z \to \mathbb Z$ defined by
$f(x) = x + \operatorname{mod}(x,7)$
Define $g:\mathbb Z \to \mathbb Z$ by $g(y) = y - \operatorname{mod}(4y,7)$
Suppose $x = 7a + b$ where $0 \le b \lt 7$. Then $f(x) = 7a + b + b = 7a + 2b$.
\begin{align}
   g(f(x))
   &= g(7a + 2b)\\
   &= 7a + 2b - \operatorname{mod}(4(7a+2b),7)\\
   &= 7a + 2b - \operatorname{mod}(28a+8b,7)\\
   &= 7a + 2b - b\\
   &= x
\end{align}
Now suppose have $f(x_1) = f(x_2)$.
Then $g(f(x_1)) = g(f(x_2))$.
Hence $x_1 = x_2$.
So $f$ is injective.
