Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Consider the product $b_1, b_2,..., b_{\phi(m)}$ where $\phi(m)$ is the number of coprimes that are less than or equal to $m$. When is this product congruent to $-1$ (mod $m$) and when is this congruent to $1$ (mod $m$)?

Let $b_1, b_2, \cdots, b_{\phi(m)}$ be the integers between $1$ and $m$ that are relatively prime to $m$. $B$ is the product of these integers. When is $B$ congruent to $1$ (mod $m$) and when is B congruent to -1 (mod $m$). Prove your conclusion.

This is a first semester number theory class, so please limit answers to stuff in that semester. No group theory or similar topics.

So far I have managed to prove the first part. By pairing up the numbers in the set {\phi(m)} I am able to extrapolate the residues and figure out that it must be congruent to 1 or -1 (mod $m$). But this part seems much harder and I'm not quite sure where to start. I even made a list of the first 20 or so $B$ and I couldn't find a pattern.

share|cite|improve this question
I really suck at markup – user7435 Mar 25 '11 at 1:22
I can't figure out the markup. Could somebody please fix that block quote up there? I don't know why it keeps italicizing itself. – user7435 Mar 25 '11 at 1:30
Oops, why is this a duplicate by the same poster?… – lhf Mar 25 '11 at 2:13
@lhf: not a duplicate. First one I am proving that it must be either 1 or -1. This question I am asking when it is 1 and when it is -1. But if you think the questions are too close I apologize. – user7435 Mar 25 '11 at 2:49
up vote 0 down vote accepted

Reduction of the problem to the self inverse elements

Divide the elements into two classes: Those $b_j$ for which $b_j \equiv b_j^{-1} \pmod n$ and those $b_k$ for which $b_j \not\equiv b_j^{-1} \pmod n$. The product of all the $b_k$ is $1$ so it suffices to compute the product of the $b_j$ elements: which are exactly the solutions of $x^2 \equiv 1 \pmod n$.

Solution modulo prime powers

Let $n = 2^r p_1^{r_1} p_2^{r_2} \cdots p_k^{r_k}$.

The solutions of $x^2 \equiv 1 \pmod {2^r}$ are

  • $r=1$: $x\equiv 1$ product $1$.
  • $r=2$: $x\equiv 1,-1$ product $-1$.
  • $r=3,4,...$: $x\equiv 1,2^{r-1}-1,r^{r+1}+1,-1$ product $1$.

The solutions of $x^2 \equiv 1 \pmod {p_i^{r_i}}$ (i.e. for odd primes) is

  • $x\equiv 1,-1$: product $-1$.

Combining the information from prime power congruences

The key thing here is that there are always an even number of square roots of unity. That means that when you combine them each of them will occur an even number of times, so their product will be $1$.

Illustration in concrete terms

For a concrete example of that phenomenon consider $n = 3^7 \cdot 5^4$. The square roots of unity are:

  • $1,-1 \pmod {3^7}$
  • $1,-1 \pmod {5^4}$

and combining these to find all square roots of unity $\pmod n$ by Sun Zi's theorem:

  • $(1,1),(1,-1),(-1,1),(-1,-1) \pmod n$.

(N.B. the bracket $(a,b)$ means the unique number $\equiv a \pmod {3^7}$ and $\equiv b \pmod {5^4}$).

The product of which is obviously 1.

Thus if $n$ contains more than two odd primes the product is 1. Now it only remains to consider the form $n = 2^r p^{r'}$, unless $r=1$ we have the same phenomena of before.

The result

So to write out this result:

$$\prod_{i} b_i \equiv \pm 1 \pmod n$$

with negative sign occurring when $n$ is 4, an odd prime power or twice a prime power.

share|cite|improve this answer

The answer is given by Gauss's generalization of Wilson's theorem: it's $-1$ exactly when $m$ has a primitive root. The idea is essentially the same as in Wilson's theorem: to pair elements with their inverses. Some elements won't have a pair; these must be the solutions to $x^2=1$, in which case they are paired with $-x$ and so generate a $-1$. There are several details to fill, of course. Ore's Number Theory and its History covers this.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.