I'm having problems understanding part of a proof for determining when 2 is a quadratic residue. It's a corollary of Guass's lemma. Define a the P:={1,2,3,...,(p-1)/2} and N:={-1,-2,-3,...,-(p-1)/2} where p is an odd prime. Then 2P={2,4,6,...,(p-1)}. (*)Now if p=4q+1, then 2P={2,4,6,...(p-1)/2,(p+3)/2...(p-1)} and the first (p-1)/4 elements: 2,4,...(p-1)/2 are in P and the remaining (p-1)/4 elements: (p+3)/2,...,(p-1) are in N. (**)If p=4q+3, then 2P={2,4,6,...(p-3)/2,(p+1)/2,...(p-1)} and the first (p-3)/4 elements: 2,4,...,(p-3)/2 are in P and the remaining (p+1)/4 elements: (p+1)/2,...,(p-1) are in N. I'm having trouble with lines (*) and (**). I don't see how you can determine which elements are in P and which elements are in N. Any help would be appreciated.