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

I'd really love your help with showing that for every prime $p>7$, there are integers $x,y$ such that $p=x^2+7y^2$, if and only if, $p \equiv 1,2,4 \pmod7$.

$x^2+7y^2$ is the norm of the Euclidean domain $a+b\sqrt{-7}$ and $p$ is composite in the domain iff it is a norm, i.e $x^2+7y^2=1$ (I'm not sure I need this now).

as well the squares$\pmod7$ (The numbers that left the same residue after squaring) are $0,1$ so I guess $x^2+y^2 \equiv 0,1,2 \pmod7$, Is this correct? How should I go on?

Thanks a lot!

share|cite|improve this question
The squares $\bmod 7$ are $0, 1, 2, 4$. – Qiaochu Yuan Jun 27 '12 at 19:55
There's a book by David Cox called 'primes of the form $x^2 + n y^2$; as I recall, you can classify primes of this form for $n=1,2,3,4,7$ by using the theory of quadratic forms over $\mathbf{Z}$ and quadratic reciprocity (i.e. no need for class field theory), and I think all of those cases are cut up into exercises in his book. Maybe there's an easy tricky way for $n=7$ though, who knows. – vgty6h7uij Jun 27 '12 at 19:59
@Jozef: If your comment was directed at Yuan, I think he meant that $x^2 \equiv 0,1,2, \text{or } 4 \!\!\mod 7$ – Eric Stucky Jun 27 '12 at 20:09
@vgty6h7uij $n=4$ is obvious, since primes $x^2+(2y)^2$ are of the form $1\bmod 4$, which motivates $p \equiv 1,2,4 \pmod7$. Nice question, interesting comment. – draks ... Jun 27 '12 at 21:30
@vgty6h7uij: Dear vgt, Certainly no class-field theory is needed. The quad. integer ring of disc. $-7$ is a PID, and one sees that $p > 7$ splits iff $p$ is a square mod 7. (Quad. reciprocit.) This gives the result. So the "easy tricky way for $n = 7$" is just that we have a PID in this case. Regards, – Matt E Jun 28 '12 at 3:57
up vote 4 down vote accepted

You can refer to this part of Granville's course notes. In particular from Proposition 4.1: An integer $n$ is properly represented by a binary quadratic form of discriminant $-7$ iff $-7$ is a square modulo $4n$. Since $-7\equiv 1\pmod 4$ and $\left(\frac{-7}{p}\right)=\left(\frac{p}{7}\right)$ for all primes $p$, $-7$ is a square mod $4p$ if $p\equiv 1,2,4 \pmod 7$.

There's only one reduced binary form with discriminant $-7$ (an exercise in the notes), so all such primes can be written as $x^2+xy+2y^2$. If $x$ is even or $x$ and $y$ are both odd, then this represents an even number, so we must have $y=2z$ for some integer $z$.

So there are $x,z\in\mathbb{Z}$ with $ p=x^2+2xz+8z^2=(x+z)^2+7z^2 $.

share|cite|improve this answer
This is precisely the method to which I was referring in my comment to OP's question, if anyone's interested; the reason the same strategy works for $n=1,2,4,5,7$ is that for these $n$, you also have a unique reduced form of discriminant equal to that of $X^2+nY^2$; for other $n$, the uniqueness is violated (if I remember well). – vgty6h7uij Jun 28 '12 at 14:50

Here is a standard algebraic number theory approach; I don't know if it is at the right level for the OP.

  • $\mathbb Z[(1 +\sqrt{-7})/2]$ is a PID (well-known, and easily checked e.g. by the Minkowski bound).

  • A prime $p \neq 7$ splits in this ring iff $p$ is a square mod $7$. (Quadratic reciprocity.)

  • This gives the result, except that one gets $p = x^2 + 7 y^2$ where $x$ and $y$ might be half-integers rather than integers. But multiplying both sides by $4$ and looking mod $8$ rules this latter possibility out (as long as $p \neq 2$).

share|cite|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.