n*2 mod p is not always equal to 0 mod 2?

621 Views Asked by At

Edit: as a first-timer here, I sincerely do not understand the downvotes to this legitimate question.

With regular integers in Z, n*2 is always equal to 0 mod 2.

In a finite field Zp of order P, n*2 is equal to 0 mod 2 only if n < (P+1)/2 and 1 mod 2 otherwise.

Is it possible to multiply n by another integer in order to obtain a number equal to 0 mod 2 in Zp for any n in Zp? Would appreciate the proper way to reason about this problem.

2

There are 2 best solutions below

2
On BEST ANSWER

To expand on some comments: there's a distinction between the computer science notion of 'modulo $n$' — which is a function mod(-,n) from integers to integers between $0$ and $n-1$ — and the mathematical notion of 'mod $n$', which is a function from integers to equivalence classes of integers. It happens that these always have a representative between $0$ and $n-1$, so we often label them $\langle0\rangle$, $\langle 1\rangle$, etc. to aid with reasoning, and sometimes we just drop the brackets.

The field $C_p$ of residue classes mod $p$ is a mathematical notion; again, we choose to label the things in this field by $\langle0\rangle, \langle1\rangle, \ldots, \langle p-1\rangle$ or similar because those labels help us make sense of the field, but they shouldn't be confused with the integers $0, 1, \ldots, p-1$. The notion of taking $\langle 1\rangle \bmod 2$ doesn't make sense mathematically because there are many different representatives of that residue class; for instance if $p=5$, then the integers $1$, $6$, $1166$, etc. are all members of the equivalence class $\langle1\rangle$.

Now, it happens that the CS notion of modulo shares some of the properties of the mathematical notion; for instance, mod(n+k,n) = mod(k,n). But it doesn't share all of them; we don't even necessarily have that mod(a,n)+mod(b,n)=mod(a+b,n), for instance. It also doesn't behave well with respect to itself, and this is why trying to look at elements of a field $C_p$ mod some other number doesn't work; we don't have an identity mod(mod(a,m),n)=mod(a,n).

0
On

The accepted answer has very little to do with the question - whether or not the notion of "parity" persists $\!\bmod n.\,$ This is true $\!\iff\! n\,$ is even. Indeed by the linear congruence solvability criterion

$$\,a\,\ \text{is even }\!\bmod n\!\iff\! \exists\:\! x\!:\ 2x \equiv a\!\!\!\pmod{\! n}\! \iff\!\color{#c00}{\gcd(2,n)}\mid a\qquad$$

If $\,n\,$ is odd then $\,\color{#c00}{\gcd(2,n)=1}\,$ divides $\,a\,$ for all $\,a,\,$ so every integer is even (i.e. a multiple of $\:\!2).\,$ Hence there is no useful notion of parity modulo odd $\,n.$

If $\,n\,$ is even then $\,\color{#c00}{\gcd(2,n)=2}\,$ so $\,a\,$ is even $\!\bmod n\!\iff\!\color{#c00}2\mid a\!\iff\! a\,$ is even in $\,\Bbb Z$.

Further, by congruences persist mod factors of the modulus, congruences $\!\bmod 2k$ persist $\!\bmod 2,\,$ which means that parity arithmetic works fine $\!\bmod 2k\,$ (i.e. $\Bbb Z_{\large 2k}\,$ has $\,\Bbb Z_{\large 2}\,$ as a ring image).

More generally, as explained here, we can extend the notion of parity not only to even moduli but further to any ring having image $\,\Bbb Z_{\large 2} = \Bbb Z\bmod 2 =$ integers $\!\bmod 2,\,$ e.g. the Gaussian integers $\,\Bbb Z[i]\,$ where $\,i\,$ is odd, and $\,\Bbb Z[\sqrt 5]\,$ where $\,\sqrt 5\,$ is odd (here where we use parity in this quadratic number ring to give a simple proof that the integer $\,(9+4\sqrt{5})^n + (9-4\sqrt{5})^n\,$ is even), and here we extend parity to a ring with infinite elements. See also here and here for further background.