How can we better understand multiplicative inverse modulo something

inversemodular arithmetic

How can we intuitively understand modulo multiplicative inverse?

Suppose we have an ring $\mathbb{Z}_{13}= \{0, 1, 2, 3, \ldots, 12\}$.

Each element except zero has corresponding multiplicative inverse.

Below is the mapping of inverse.

1 $\rightarrow$ 1

2 $\rightarrow$ 7

3 $\rightarrow$ 9

4 $\rightarrow$ 10

5 $\rightarrow$ 8

6 $\rightarrow$ 11

7 $\rightarrow$ 2

8 $\rightarrow$ 5

9 $\rightarrow$ 3

10 $\rightarrow$ 4

11 $\rightarrow$ 6

12 $\rightarrow$ 12

Now, I want to consider division by 2, which here means that multiplication by 7.
However, some integer multiplied 7 becomes acutally the same result as division by 2 over real number field.
For example, the following holds.

4 * 7 = 28 = 2 mod 13;
6 * 7 = 42 = 3 mod 13;
etc.

On the other hand, other values do not produce the same result over real number fields.

For example,
5 * 7 = 35 = 9 mod 13 (I want this value to be 2 or 3 since 5/2 = 2.5)

7 * 7 = 49 = 10 mod 13 (I want this value to be 3 or 4 since 7/2 = 3.5).

Why some values produce the same result as over the real number field, and the others do not??

Best Answer

Operations mod $n$ aren't guaranteed to preserve the order inherited from the reals.

So the fact that in $\mathbb{R}$, we have $$2 < {\small{\frac{5}{2}}} < 3$$ doesn't imply $$2 < ({\small{\frac{5}{2}}}\;\text{mod}\;13) < 3$$ However what is true is that, working mod $13$, we have $$ {\small{\frac{5}{2}}} = 2+{\small{\frac{1}{2}}} = 2+7 = 9 \qquad\;\;\; $$ and also $${\small{\frac{5}{2}}} = 3-{\small{\frac{1}{2}}} = 3-7 = -4 = 9$$