Suppose that $m>2$, and let $P$ be the product of the positive integers less than $m$ that are relatively prime to $m$. Show that $P \equiv -1 \pmod{m}$ if $m=4$, $p^n$, or $2p^{n}$, where $p$ is an odd prime, and $P \equiv 1 \pmod{m}$ otherwise.
Problem
Source:
Tags: modular arithmetic, floor function, abstract algebra, number theory, relatively prime, group theory, Congruences
25.05.2007 03:24
We first observe that this is true for $m=1,2$. Let now $m\geq 3$. If some $x$ with $(x,m)=1$ has an multiplicative inverse $x^{-1}$ with $x\not\equiv x^{-1}\pmod m$, they drop out of $P$, so we have \[P=\prod_{\substack{1\leq x \leq m\\ (x,m)=1}}x\equiv \prod_{\substack{1\leq x\leq m\\ x^{2}\equiv 1 \bmod m}}x \equiv \prod_{\substack{1\leq x \leq \lfloor \frac{m}{2}\rfloor\\ x^{2}\equiv 1 \bmod m}}-x^{2}\equiv \prod_{\substack{1\leq x \leq \lfloor \frac{m}2 \rfloor\\ x^{2}\equiv 1 \bmod m}}-1 \equiv (-1)^{\frac{a(m)}{2}}\pmod m\] where $a(n)$ denotes the number of $1\leq x \leq m$ so that $x^{2}\equiv 1 \pmod m$. Lemma 1: $a(1)=1, a(2)=1, a(4)=2$. Proof: Inspection. $\Box$ Lemma 2: $a(2^{k})=4$ for $k\geq 3$. Proof: We have \[x^{2}\equiv 1 \pmod{2^{k}}\\ \Leftrightarrow (x-1)(x+1)\equiv 0 \pmod{2^{k}}\\ \Leftrightarrow x\equiv-1,+1 \pmod{2^{k-1}}\\ \Leftrightarrow x\equiv 1, 2^{k-1}-1,2^{k-1}+1, 2^{k}-1 \pmod{2^{k}}\] $\Box$ Lemma 3: $a(p^{k})=2$ for all odd primes $p$. Proof: We have \[x^{2}\equiv 1\pmod{p^{k}}\\ \Leftrightarrow (x-1)(x+1)\equiv 0\pmod{p^{k}}\\ \Leftrightarrow x\equiv-1,+1 \pmod{p^{k}}\] $\Box$ Lemma 4: $a$ is multiplicative, ie $a(mn)=a(m)a(n)$ for all coprime $m,n$. Proof: Since $m$ and $n$ are coprime, we have $x^{2}\equiv 1 \pmod{mn}$ if and only if $x^{2}\equiv 1\pmod m$ and $x^{2}\equiv 1 \pmod n$. Let $y_{1},\ldots,y_{a(m)}$ be those residues modulo $m$ so that $y_{i}^{2}\equiv 1\pmod m$ and let $z_{1},\ldots,z_{a(n)}$ be those residues modulo $n$ so that $z_{i}^{2}\equiv 1 \pmod n$. Then, by the chinese remainder theorem, we have $x^{2}\equiv 1\pmod{mn}$ if and only if $x\equiv y_{i}\pmod m$ and $x\equiv z_{j}\pmod n$ for some $1\leq i\leq a(m)$ and $1\leq j \leq a(n)$. Clearly, we have $a(m)a(n)$ possibilities to choose such $i,j$ and since we get another $x$ modulo $mn$ for each such possibilities, we obtain $a(mn)=a(m)a(n)$. $\Box$ Corollary 1: $a(m)$ is not divisible by $4$ if and only if $m=1,2,4,p^{k}, 2p^{k}$ where $p$ is an odd prime and $k$ is a positive integer. This solves the problem.
28.11.2013 09:58
Any link between this and primitive roots?
27.04.2014 12:04
Yes and no: the correct generalisation is that the product (or if you prefer additive notation: sum) of all elements in an abelian group is the neutral element $e$ if and only if $x^2 = e$ has exactly two solutions. If it would have more than two solutions, then it cannot be cyclic, and if the group has an even number of elements, then it has at least two solutions by Cauchy's theorem. But not every group satisfying this property is cyclic as the additive group $\mathbb Z/2 \times (\mathbb Z/3)^2$ shows.