-2

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.

  • 4
    This does not make sense. A residue class $\pmod p$ can't be reduced $\pmod 2$ (if $p>2$). For the reason you suggest...$3$ is odd but $3\equiv 8\pmod 5$ and $8$ is even. – lulu Nov 07 '20 at 15:24
  • In any field $\mathbb{Z}_p$ with odd prime $p$, every number $x$ is "even", it the sense that it can be written as $x = 2y$ for some $y$. (Let $y = 2^{-1}x$.) – Alex Provost Nov 07 '20 at 15:29
  • @lulu the random question popped into my mind while learning about Zp fields, but didn't know how to reason about it. – Jean Monet Nov 07 '20 at 15:38
  • @AlexProvost thanks, odd/even words that are not appropriate, should be read 1 mod 2 and 0 mod 2 – Jean Monet Nov 07 '20 at 15:39
  • 1
    Sure. But my point stands, If you have a residue class $n \pmod p$ you can't speak of reducing $n\pmod q$ for some other prime $q$. Of course you can come up with something...for instance, you could look at the unique integer between $0$ and $p-1$ which is $\equiv n\pmod p$ and then reduce that $\pmod q$, but that definition wouldn't have a lot of good properties. – lulu Nov 07 '20 at 15:42
  • For instance, with that definition we'd want to say that $3\pmod 5$ was odd and $4\pmod 5$ was even but $3+4=7\equiv 2\pmod 5$ so the sum $3+4\pmod 5$ would be even which doesn't match our understanding of even and odd (the sum of an even number plus an odd number should be odd, not even). – lulu Nov 07 '20 at 15:44
  • @lulu thank you for the clarification – Jean Monet Nov 07 '20 at 15:54
  • I added an answer that actually addresses the heart of the question. – Bill Dubuque Nov 08 '20 at 00:02
  • @lulu Indeed. Otoh, parity arithmetic is consistent $\bmod 2n,,$ or in any ring having $,\Bbb Z_2,$ as a image, as I explain in an answer below. – Bill Dubuque Nov 08 '20 at 00:24

2 Answers2

3

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).

  • Thank you - indeed I was reasoning from a CS perspective. My math knowledge was insufficient – Jean Monet Nov 07 '20 at 16:14
  • @Jean Beware that though some folks attempt to denigrate the operator $!\bmod$ as "computer science" and not "math" this is incorrect. See this answer for the relation between the (normal form) operator vs. congruence relation. – Bill Dubuque Nov 07 '20 at 23:14
1

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.

Bill Dubuque
  • 272,048