the most difficult easy question

logistic_guy

Full Member
Joined
Apr 17, 2024
Messages
624
here is the question

How can we map an integer in Z\displaystyle \bold{Z} to an integer in Zn\displaystyle \bold{Z}_n?

my attemp
i don't what is Z\displaystyle \bold{Z} so i do some research and i discovered it's just mean integers😱

i'm not totally sure but i think the question wants ZZn\displaystyle \bold{Z} \to \bold{Z}_n

i think this is the correct notation because i did a lot of mapping in differential geometry
 
We can write for any given integer z z and any positive integer n n z=an+rzr(modn) z=a\cdot n +r \Longleftrightarrow z\equiv r\pmod{n} with some unique integer r r such that rZn={0,1,2,,n1}. r\in \mathbb{Z}_n=\{0,1,2,\ldots ,n-1\}.
The mapping you are asking for is now φn:zr.\varphi_n \, : \, z\longmapsto r. You can show that φn(x+y)=φn(x)+φn(y) \varphi_n (x+y)=\varphi_n (x)+\varphi_n (y) and φn(xy)=φn(x)φn(y). \varphi_n (x\cdot y)=\varphi_n (x)\cdot \varphi_n (y).

φn \varphi_n is also called "modulo n. n ." Everyday occurrences are e.g. a light switch or computer (n=2) (n=2) , or the hour hand on a classical clock (n=12), (n=12), or the degrees in a circle (n=360), (n=360), or the days of a week (n=7). (n=7).
 
We can write for any given integer z z and any positive integer n n z=an+rzr(modn) z=a\cdot n +r \Longleftrightarrow z\equiv r\pmod{n} with some unique integer r r such that rZn={0,1,2,,n1}. r\in \mathbb{Z}_n=\{0,1,2,\ldots ,n-1\}.
The mapping you are asking for is now φn:zr.\varphi_n \, : \, z\longmapsto r. You can show that φn(x+y)=φn(x)+φn(y) \varphi_n (x+y)=\varphi_n (x)+\varphi_n (y) and φn(xy)=φn(x)φn(y). \varphi_n (x\cdot y)=\varphi_n (x)\cdot \varphi_n (y).

φn \varphi_n is also called "modulo n. n ." Everyday occurrences are e.g. a light switch or computer (n=2) (n=2) , or the hour hand on a classical clock (n=12), (n=12), or the degrees in a circle (n=360), (n=360), or the days of a week (n=7). (n=7).
thank

you say rZn\displaystyle r \in \bold{Z}_n

if r=12\displaystyle r = 12 and n=10\displaystyle n = 10

Zn={0,1,2,3,4,5,6,7,8,9}\displaystyle \bold{Z}_n = \{0,1,2,3,4,5,6,7,8,9\} i don't see 12\displaystyle 12 there
 
thank

you say rZn\displaystyle r \in \bold{Z}_n

if r=12\displaystyle r = 12 and n=10\displaystyle n = 10

Zn={0,1,2,3,4,5,6,7,8,9}\displaystyle \bold{Z}_n = \{0,1,2,3,4,5,6,7,8,9\} i don't see 12\displaystyle 12 there
z z and n n are input, r r is the output: division of z z by n n with remainder r. r. Such a division can be performed such that the remainder is between 0 0 and n. n. This set of remainders is thus {0,1,,n1} \{0,1,\ldots,n-1\} and usually denoted by Zn. \mathbb{Z}_n. The whole theoretical situation is a bit more complicated but I don't want to create confusion. It has to do with the fact, that we could as well use for example 1,2,,n 1,2,\ldots,n as possible remainders, but starting with zero instead of ending with n n makes things easier.

Anyway, we do not choose r, r, we compute it. For z=12 z=12 and n=10, n=10, we get 12=110+2 12=1\cdot 10 +2 so r=2{0,1,2,3,4,5,6,7,8,9}=Z10. r=2 \in \{0,1,2,3,4,5,6,7,8,9\}=\mathbb{Z}_{10}.
 
z z and n n are input, r r is the output: division of z z by n n with remainder r. r. Such a division can be performed such that the remainder is between 0 0 and n. n. This set of remainders is thus {0,1,,n1} \{0,1,\ldots,n-1\} and usually denoted by Zn. \mathbb{Z}_n. The whole theoretical situation is a bit more complicated but I don't want to create confusion. It has to do with the fact, that we could as well use for example 1,2,,n 1,2,\ldots,n as possible remainders, but starting with zero instead of ending with n n makes things easier.

Anyway, we do not choose r, r, we compute it. For z=12 z=12 and n=10, n=10, we get 12=110+2 12=1\cdot 10 +2 so r=2{0,1,2,3,4,5,6,7,8,9}=Z10. r=2 \in \{0,1,2,3,4,5,6,7,8,9\}=\mathbb{Z}_{10}.
i think i'm understanding. why not write it like rz mod n\displaystyle r \equiv z \ \text{mod} \ n instead of zr mod n\displaystyle z \equiv r \ \text{mod} \ n?
 
i think i'm understanding. why not write it like rz mod n\displaystyle r \equiv z \ \text{mod} \ n instead of zr mod n\displaystyle z \equiv r \ \text{mod} \ n?
\equiv is an equivalence relation, which means it is reflexive zz, z\equiv z, symmetric xyyx, x\equiv y \Longrightarrow y\equiv x, and transitive ab and bcac. a\equiv b \text{ and } b\equiv c \Longrightarrow a\equiv c .

So symmetry says that it makes no difference what you write first.
 
\equiv is an equivalence relation, which means it is reflexive zz, z\equiv z, symmetric xyyx, x\equiv y \Longrightarrow y\equiv x, and transitive ab and bcac. a\equiv b \text{ and } b\equiv c \Longrightarrow a\equiv c .

So symmetry says that it makes no difference what you write first.
r mod n\displaystyle r \ \text{mod} \ n mean the remainder of rn\displaystyle \frac{r}{n}, isn't it?

zr mod n\displaystyle z \equiv r \ \text{mod} \ n , it's like z\displaystyle z is the remainder

if gh mod n\displaystyle g \equiv h \ \text{mod} \ n is the same as hg mod n\displaystyle h \equiv g \ \text{mod} \ n , we won't know which one is the remainder:(
 
Note: The notation ab(modn) a\equiv b\pmod{n} does not require that either of them is within the set of minimal remainders {0,1,,n1}. \{0,1,\ldots ,n-1\}. 5022(mod7) 50 \equiv 22\pmod{7} is perfectly fine. The minimality only kicks in if we want to end up in Zn \mathbb{Z}_n and want to represent the elements of Zn \mathbb{Z}_n by the numbers {0,1,,n1}. \{0,1,\ldots ,n-1\}. The notation ab(modn) a\equiv b\pmod{n} only says that a a and b b have the same remainder by division by n, n, not which one: 50=77+1=47+22. 50=7\cdot 7+1= 4\cdot 7 +22 . This is where a rigorous treatment becomes a bit more complicated.
 
We actually sort the set of integers into equivalent classes, namely
Z=({0}+nZ)({1}+nZ)({2}+nZ)({n1}+nZ)={,2n,n,0,n,2n,}{,12n,1n,1,1+n,1+2n,}{,12n,1n,1,n1,2n1,}\begin{array}{lll} \mathbb{Z}&=(\{0\}+n\cdot\mathbb{Z}) \cup (\{1\}+n\cdot\mathbb{Z}) \cup (\{2\}+n\cdot\mathbb{Z}) \cup \ldots (\{n-1\}+n\cdot\mathbb{Z})\\[6pt] &=\{\ldots,-2n,-n,0,n,2n,\ldots\}\cup \{\ldots,1-2n,1-n,1,1+n,1+2n,\ldots\}\cup \ldots \cup \{\ldots,-1-2n,-1-n,-1,n-1,2n-1,\ldots\} \end{array}The first set contains all multiples of n n that correspond to the minimal remainder 0. 0.
The second set contains all multiples of n n plus 1 1 that correspond to the minimal remainder 1. 1.
etc.
The last set contains all multiples of n n plus n1 n-1 that correspond to the minimal remainder n1. n-1.

Since every set belongs to a certain minimal remainder, we say that these minimal remainders from 0 0 to n1 n-1 represent their equivalence class. We calculate with the minimal remainders in {0,1,2,,n1} \{0,1,2,\ldots,n-1\} instead of with entire sets. However, the notion ab(modn) a\equiv b\pmod{n} (and of course a≢b(modn) a \not\equiv b\pmod{n} ) is allowed for all integers, not only for the minimal remainders. Of course, people would write 501(mod7) 50\equiv 1\pmod{7} instead of 5022(mod7) 50\equiv 22\pmod{7} , but allowed are both since 50,22,1 50,22,1 all belong into the same set of remainders, the second one in the above list: {,114,17,1,1+7,1+14,1+21,}={,20,13,6,1,8,15,22,29,36,43,50,57,}. \{\ldots , 1-14,1-7,1,1+7,1+14,1+21,\ldots\}=\{\ldots, -20,-13,-6,1,8,15,22,29,36,43,50,57,\ldots\}.
 
with this notation 501 mod 7\displaystyle 50 \equiv 1 \ \text{mod} \ 7 it's clear 1\displaystyle 1 is the remainder

with this notation 5022 mod 7\displaystyle 50 \equiv 22 \ \text{mod} \ 7 many will think 22\displaystyle 22 is the remainder i say bad notation

with this notation gh mod n\displaystyle g \equiv h \ \text{mod} \ n people who use the first notation will think h\displaystyle h is the remainder and people like me will think g\displaystyle g is the remainder

is there a notation that emphasize on the remainder something like 1=50 mod 7\displaystyle 1 = 50 \ \text{mod} \ 7 give no doubt 1\displaystyle 1 is the remainder
 
with this notation 501 mod 7\displaystyle 50 \equiv 1 \ \text{mod} \ 7 it's clear 1\displaystyle 1 is the remainder

with this notation 5022 mod 7\displaystyle 50 \equiv 22 \ \text{mod} \ 7 many will think 22\displaystyle 22 is the remainder i say bad notation

with this notation gh mod n\displaystyle g \equiv h \ \text{mod} \ n people who use the first notation will think h\displaystyle h is the remainder and people like me will think g\displaystyle g is the remainder

is there a notation that emphasize on the remainder something like 1=50 mod 7\displaystyle 1 = 50 \ \text{mod} \ 7 give no doubt 1\displaystyle 1 is the remainder
Only the line 50=77+1, 50=7\cdot 7 +1, noted as Euclidean division. If it is written that way, then it is assumed that 0r=16. 0\leq r=1 \leq 6. E.g., we can also divide polynomials like (x3+3x2+4x+5):(x2+2x+2)=x+1 (x^3 +3x^2+4x+5):(x^2+2x+2)=x+1 with remainder 3. 3. We can write it as (x3+3x2+4x+5)=(x+1)(x2+2x+2)+3 (x^3 +3x^2+4x+5)=(x+1)\cdot (x^2+2x+2) +3 in which case we have 0deg(r)=deg3(deg(x2+2x+2))1. 0\leq \deg(r)=\deg 3 \leq (\deg(x^2+2x+2))-1. The degree now measures the magnitude of the remainder that is less then two. Euclidean division requires a minimal remainder. For the \equiv relation on the other hand, equivalence is important. We want to write the integers as the union of these sets I mentioned. We actually calculate with those sets. It's only easier to abbreviate them by one of their elements, and for the sake of clarity, those in {0,1,,n1}. \{0,1,\ldots,n-1\}. But what we really mean are the sets. I told you it's a bit more complicated.

And, 22 22 is also a remainder, namely 50=47+22, 50=4\cdot 7 +22, just not the smallest. Now, 22=37+1, 22=3\cdot 7+1, i.e. 221(mod7). 22\equiv 1\pmod{7}. By transitivity, we get 5022(mod7) and 221(mod7)501(mod7). 50\equiv 22\pmod{7} \text{ and }22\equiv 1\pmod{7}\Longrightarrow 50\equiv 1\pmod{7}.
If you only want to divide, then you can use Euclidean division. The notation \equiv is for number theory.
 
i still don't understand the big deal of using 22\displaystyle 22

507=1437=2367=3297=4227=5157=687=717\displaystyle \frac{50}{7} = 1\frac{43}{7} = 2\frac{36}{7} = 3\frac{29}{7} = 4\frac{22}{7} = 5\frac{15}{7} = 6\frac{8}{7} = 7\frac{1}{7}

anyone who get the fraction 507\displaystyle \frac{50}{7} will say the answer 717\displaystyle 7\frac{1}{7} without all this complication

why i need to say 50\displaystyle 50 and 43\displaystyle 43 and 36\displaystyle 36 and 29\displaystyle 29 and 22\displaystyle 22 and 15\displaystyle 15 and 8\displaystyle 8 have a remainder of 1\displaystyle 1

why i need transivity to jump from number to number when i can directly say the remainder is 1\displaystyle 1
 
22 22 was only an example.

The point is, that we calculate with these sets
[0]=0+7Z={,21,14,7,0,7,14,21,}[1]=1+7Z={,20,13,6,1,8,15,22,}[2]=2+7Z={,19,12,5,2,9,16,23,}[3]=3+7Z={,18,11,4,3,10,17,24,}[4]=4+7Z={,17,10,3,4,11,18,25,}[5]=5+7Z={,16,9,2,5,12,19,26,}[6]=6+7Z={,15,8,1,6,13,20,27,}\begin{array}{lll} [0]&=0+7\cdot\mathbb{Z}= \{\ldots,-21,-14,-7,0,7,14,21,\ldots\}\\[6pt] [1]&=1+7\cdot\mathbb{Z}= \{\ldots,-20,-13,-6,1,8,15,22,\ldots\}\\[6pt] [2]&=2+7\cdot\mathbb{Z}= \{\ldots,-19,-12,-5,2,9,16,23,\ldots\}\\[6pt] [3]&=3+7\cdot\mathbb{Z}= \{\ldots,-18,-11,-4,3,10,17,24,\ldots\}\\[6pt] [4]&=4+7\cdot\mathbb{Z}= \{\ldots,-17,-10,-3,4,11,18,25,\ldots\}\\[6pt] [5]&=5+7\cdot\mathbb{Z}= \{\ldots,-16,-9,-2,5,12,19,26,\ldots\}\\[6pt] [6]&=6+7\cdot\mathbb{Z}= \{\ldots,-15,-8,-1,6,13,20,27,\ldots\} \end{array}and any member of each set as representative is as appropriate as any other. The representatives [0],,[6] [0],\ldots,[6] are only the most convenient ones for most purposes. These sets are the elements of Z/7Z. \mathbb{Z}/7\cdot \mathbb{Z}. We can add and multiply them. These arithmetic operations are the same as if we applied them on the remainders 0,1,2,3,4,5,6 0,1,2,3,4,5,6 modulo 7. 7.

These (minimal, non-negative) remainders build the so-called ring Zn \mathbb{Z}_n and "behave the same as" is mathematically written as Z/nZZn. \mathbb{Z}/n\cdot \mathbb{Z} \cong \mathbb{Z}_n. The LHS are the sets, and the RHS the numbers {0,1,2,3,4,5,6}. \{0,1,2,3,4,5,6\}. Your initial map was ZZ/nZZn. \mathbb{Z}\twoheadrightarrow \mathbb{Z}/n\cdot \mathbb{Z} \cong \mathbb{Z}_n. And before you dig even deeper, I better phrase it correctly: ZZn \mathbb{Z} \rightarrow \mathbb{Z}_n is the surjective part of the short exact sequence
{0}nZZZ/nZZn{0} \{0\} \rightarrowtail n\cdot \mathbb{Z} \rightarrowtail \mathbb{Z} \twoheadrightarrow \mathbb{Z}/n\cdot \mathbb{Z} \cong \mathbb{Z}_n \twoheadrightarrow \{0\}of ring homomorphisms.

I told you that the details are a bit more complex. The essential point is that we divided the integers into seven sets and that we can do arithmetic with these sets. However, sets are inconvenient to handle and large to write down. We therefore abbreviate them by [0],[1],[2],[3],[4],[5],[6] [0],[1],[2],[3],[4],[5],[6] and because mathematicians are lazy, we only write 0,1,2,3,4,5,6. 0,1,2,3,4,5,6. These numbers are cyclic: 6+1=0. 6+1=0. To distinguish that from ordinary additions and multiplications we write 6+1=0(mod7) 6+1=0 \pmod{7} and I personally even go a step further and write 6+10(mod7) 6+1\equiv 0\pmod{7} to remind per notation that we actually meant those sets.

But before you lose interest: one can do fancy encryption things with those remainders.
 
Last edited:
thank fresh_42

again you explaint it nicely. i won't say i understand everything but i'll make this post reference. i'll come back here whenever i face similar questions
 
Top