# A question on square residue.

by MathematicalPhysicist
Tags: residue, square
 P: 3,128 I forgot why the next statement is true and it's bugging me endlessly... If p is prime such that p =1 mod 4 then (-1) = x^2 mod p. Now in Ashe's Algebriac Number theory notes (book?), he says that $$((\frac{p-1}{2})!)^2= -1 mod p$$ I am quite stumped as how to show this, he argues we just need to look at: 1*2*....((p-1)/2)*(-1)*(-2)....*(-(p-1)/2) which on the one hand because p =1 mod 4 it equals $$((\frac{p-1}{2})!)^2$$ on the other hand it also equals (p-1)!, but why does this equal -1? Thanks.
 P: 26 x2modp is not -1 for all x. Examples of exceptions include p=13, x=4; p=13 x=2; p=101, x=5...
 Sci Advisor P: 1,670 cubzar, what he meant was that there is a solution to x^2 = -1 mod p. It's because (p-1)! = -1 mod p for all prime p. I believe this is called wilsons theorem. The reasons why this is true is that 1,2,3,...,p-1 are all residue classes mod p, so for each number in the product, its inverse is also a factor for all numbers which are not their own inverse. These are 1 and -1 = p-1, so we can ignore them and pair up the others. Thus 2*3*...*(p-2) = 1, and so (p-1)! = -1.
P: 3,128

## A question on square residue.

Ok, thanks, now I do get it.
in 2*3*...*(p-2) we have a number and its inverse multiplied together, this is why it equals 1.

I don't understand how I didn't notice this triviality, I guess the age does it trick... :-(
P: 460
 Quote by MathematicalPhysicist Ok, thanks, now I do get it. in 2*3*...*(p-2) we have a number and its inverse multiplied together, this is why it equals 1. I don't understand how I didn't notice this triviality, I guess the age does it trick... :-(
I don't think it is your fault, the author should have explained it instead of showing off. This is the problem with mathematicians, they write books as incomplete instruction manuals and expect the reader to fill in the gaps.

 Related Discussions Calculus & Beyond Homework 2 Calculus 23 Calculus 0 Calculus & Beyond Homework 4 Calculus & Beyond Homework 1