18

For a prime number $p \neq 3$, do we have that$$p = x^2 + xy + y^2$$for some $x$, $y \in \mathbb{Z}$ if and only if$$p \equiv 1 \text{ mod }3?$$I suspect this is true from looking at the example$$7 = 2^2 + 2 \times 1 + 1^2.$$Here is a thought I have so far that might be helpful towards solving this: I know that $$\mathbb{Z}[(1 + \sqrt{-3})/2]$$is a PID. But I am not sure what do from here. Could anybody help?

  • 1
    You should show more examples approving the conjecture. – Peter Mar 31 '16 at 20:44
  • "only if", at least, is simple: If $p \equiv 2 \mod 3$, then $p = x^2 + xy + y^2$ is impossible (indeed, $x^2 + xy + y^2 \equiv 2 \mod 3$ has only the solution $x = y = 0$). – darij grinberg Mar 31 '16 at 20:45
  • 1
    "if": See http://www.artofproblemsolving.com/community/c2927h1057808_a_trick_related_to_thues_lemma . (Disregard the first sentence, which makes the post look like a joke -- nope, that's not what he is proving :) ) – darij grinberg Mar 31 '16 at 20:46
  • 2
    If we have $x=y=0$, how can $x^2+xy+y^2\equiv 2\ (\ mod\ 3\ )$ hold ? – Peter Mar 31 '16 at 20:48
  • 1
    The steps are roughly this. (i) If $p\equiv 1 \pmod{3}$ then the congruence $s^2+3\equiv 0\pmod{p}$ has a solution. (ii) So $(s+\sqrt{-3})(s+\sqrt{-3})$ is divisible by $p$. But neither term is, so $p$ cannot be prime. (iii) It follows that $p$ has a non-trivial factor $u+v\sqrt{-3}$. Its norm must be $p$, which gives us our representation theorem as $u^2+3v^2$. (iii) Now translate back to $x^2+xy+y^2$ via completing the square. There is some messiness because the domain you mentioned has non-trivial units. – André Nicolas Mar 31 '16 at 21:07
  • @Peter: Oops, read it as "no solution" :) – darij grinberg Mar 31 '16 at 21:46
  • Related: https://mathoverflow.net/questions/78361 – Watson Dec 02 '18 at 22:49

10 Answers10

11

Let $K = \mathbb Q(\sqrt{-3})$. Consider the integer ring $\mathcal O_K = \mathbb Z[\alpha]$, where $\alpha = \frac{1+\sqrt{-3}}{2}$. Recall that the field norm of an element $x+y\alpha\in\mathcal O_K$ is $$N_{K/\mathbb Q}(x+y\alpha) =(x+y\alpha)(x+y\overline\alpha) = x^2+xy+y^2.$$

You've correctly remarked that $\mathcal O_K$ is a PID. It follows that

A prime $p$ can be expressed as $p=x^2+xy+y^2$ if and only if $p$ is the norm of some element of $\mathcal O_K$.

If $p\ne 3$ (so that $p$ does not ramify in $\mathcal O_K$) and $p = N_{K/\mathbb Q}(x+y\alpha)$, then the ideal $(x+y\alpha)$ is a prime ideal of $\mathcal O_K$ lying above $p$ with norm $p$. So $p$ splits completely in $\mathcal O_K$.

Conversely, if $p = \mathfrak{p_1p_2}$, then since $\mathcal O_K$ is a PID, $\mathfrak p_1$ is generated by an element of $\mathcal O_K$, which must have norm $p$. Hence,

A prime $p\ne 3$ can be expressed as $p=x^2+xy+y^2$ if and only if $p$ splits completely in $\mathcal O_K$.

To examine when this can happen, we can use the following version of the Kummer-Dedekind Theorem:

Theorem: Let $p$ be a prime, and let $\beta\in \mathcal O_K$ be such that $K=\mathbb Q(\beta)$ and $p\nmid (\mathcal O_K:\mathbb Z[\beta])$. Let $f(X)$ be the minimal polynomial of $\beta$ over $\mathbb Q$. Suppose that $$f(X) \equiv f_1(X)^{e_1}\cdots f_m(X)^{e_m}\pmod p. $$ Then $p$ splits as $p\mathcal O_K = \mathfrak{p_1^{e_1}\cdots p_m^{e_m}}$ in $\mathcal O_K$.

In particular, taking $K$ as above and $\beta = \sqrt{-3}$, since $(\mathcal O_K, \mathbb Z[\sqrt{-3}]) = 2$, the above theorem applies to all primes $p>2$. The case $p=2$ can be checked manually.

So for $p\ge 5$ $$ \begin{align} p \text{ splits completely in }\mathcal O_K&\iff X^2+3\text{ splits into distinct linear factors mod } p\\&\iff X^2+3\text{ is reducible mod } p\\ &\iff\left(\frac{-3}p\right)=1\\ &\iff(-1)^{(p-1)/2}\left(\frac{3}p\right)=1\\ &\iff(-1)^{\frac{p-1}2}(-1)^{\frac{p-1}2\frac{3-1}2}\left(\frac p3\right) = 1\text{ by quadratic reciprocity}\\ &\iff \left(\frac p3\right) = 1\\&\iff p\equiv 1 \pmod 3. \end{align} $$ The result follows.

Mathmo123
  • 23,718
7

$p=x^2+xy+y^2=(x-y)^2+3xy$, so this is about the behaviour of perfect squares. If $z$ is an integer not divisible by $3$, then $z^2\equiv 1\mod 3.$ Since $p\ne 3$ is prime, it is not divisible by $3$. Hence $x-y$ is not divisible by $3$, and it follows that $p\equiv 1\mod 3.$

  • 5
    This shows that if $p=x^2+xy+y^2$ then $p\equiv1\pmod{3}$. It doesn't show the converse, that if $p\equiv1\pmod{3}$ then $p=x^2+xy+y^2$. – Servaes Nov 22 '20 at 10:30
6

Here is an answer, maybe not the most illuminating for you and probably not that different from Mathmo123's answer, but involving Jacobi sums.

Let $p\equiv 1 ($mod $3$), $\lambda$ a generator of the group of characters over $\mathbb{F}_p^{\times}$ and set $\chi=\lambda^{\frac{p-1}{3}}$. So the character $\chi$ takes it values in $V=\{0,1,\alpha,\alpha^2\}$ where $\alpha=\frac{-1+\sqrt(-3)}{2}$. Given that the set $V$ is stable under multiplication, the Jacobi sum associated to $\chi$, $J(\chi,\chi)=\sum_{a+b=1} \chi(a)\chi(b)$ is in $\mathbb{Z}+\alpha\mathbb{Z}+\alpha^2\mathbb{Z}=\mathbb{Z}+\alpha\mathbb{Z}$. So we can write $J(\chi,\chi)=x+y\alpha$ with $x$ and $y$ in $\mathbb{Z}$. But we know $p=|J(\chi,\chi)|^2$; so $p=x^2-xy+y^2$.

Of course the same strategy works for $p\equiv 1$ mod $4$ $\Longleftrightarrow p=x^2+y^2$.

A.B.
  • 253
  • That should say $p\equiv 1\pmod 3$, right? – Mathmo123 Apr 01 '16 at 20:22
  • Oups!! It seems I read the question too fast. Sorry! So here what I proved: if $p\equiv 3$ mod $4$, then we can write $p=x^2-xy+y^2$. @Mathmo123, yes. – A.B. Apr 01 '16 at 21:49
  • No I think this works but you just have a typo. For example, when you write $\lambda^{(p-1)/3}$ you assume that $p\equiv 1 \pmod 3$ – Mathmo123 Apr 01 '16 at 22:35
  • Oups! again. You are right. This probably means it's time to go get some sleep. – A.B. Apr 02 '16 at 01:31
4

Since a lot of the answers are only answering the "only if" part, I'll add a generalization of that part.

If $p> 3$ is prime, $x,y\in\mathbb Z$, $\gcd(p,y)=1$ and $p\mid x^2+xy+y^2$, then $p\equiv 1\pmod{3}$.

Proof: $$p\mid x^2+xy+y^2\implies p\mid 4\left(x^2+xy+y^2\right)=(2x+y)^2+3y^2$$

$$\implies \left((2x+y)y^{-1}\right)^2\equiv -3\pmod{p}\implies p\equiv 1\pmod{3}$$

The last step used Quadratic Reciprocity.

user236182
  • 13,489
3

In Mathmo's answer, I think we could use a local-global argument to characterize the complete splitting of p>5 in the ring $O_K$. By completion at the primes P of $O_K$ above p, it is straightforward that p splits iff the p-adic field $Q_p$ coincides with the completed fields $K_P$, iff $Q_p$ contains a primitive cubic root of $1$. Since p is not 3, this is equivalent to say that the polynomial $X^3$ - $1$ splits (has 3 distinct roots) in $Q_p$. The roots being actually p-adic integers, we can reduce modulo p and deduce that 3 must divide p-$1$. For the converse, use Hensel's lemma.

  • Why does "the p-adic field $Q_p$ coincides with the completed fields $K_P$, iff $Q_p$ contains a primitive cubic root of $1$" hold, where $K = \Bbb Q(\sqrt{-3})$? – Watson Dec 03 '18 at 09:49
  • 1
    Since $K=Q(j)$, where j is a primitive 3-rd root of 1, $K_P=Q_p(j)$ , hence $p$ splits iff $j \in Q_p$. Do I miss something ? – nguyen quang do Dec 03 '18 at 10:40
  • No, sorry, you are completely right! – Watson Dec 03 '18 at 10:42
2

Partial answer :

We have the following implications (every congruence is mod 3) :

$$x\equiv 0\ ,\ y\equiv 0\implies x^2+xy+y^2\equiv 0$$

$$x\equiv 0\ ,\ y\ne 0\implies x^2+xy+y^2\equiv y^2\ne 2$$

The case $y\equiv 0\ ,\ x\ne 0$ works analogue.

Finally , $$x\ne 0\ ,\ y\ne 0\implies x^2+xy+y^2=1+1+xy=2+xy\ne 2$$

So, we never have $x^2+xy+y^2\equiv 2$. This shows one of the directions.

Peter
  • 86,576
2

If $p \equiv 1 \pmod 3,$ then the Legendre symbol $(-3|p) = 1.$ We can solve $\beta^2 \equiv -3 \pmod p.$ By choosing either $\beta$ or $p - \beta,$ because this time we need $\beta$ odd, we can solve $\beta^2 \equiv -3 \pmod {4p}.$ That is, $\beta^2 = -3 + 4pt$ for some integer $t.$

So far, we have the binary quadratic form $\langle p, \beta, t \rangle,$ or $$ f(x,y) = px^2 + \beta xy + t y^2, $$ of discriminant $-3.$

We apply Gauss reduction to get a reduced form; inequalies show that the only reduced form of discriminant $-3$ is $\langle 1, 1, 1 \rangle.$ The 2 by 2 integer matrix $P$ of determinant $1$ that took us from $\langle p, \beta, t \rangle$ to $\langle 1, 1, 1 \rangle$ has an inverse of integers, $P^{-1}.$ The left hand column of $P^{-1}$ shows how to represent $p$ as $x^2 + xy + y^2.$

Let's see; we find $P$ one step at a time. In the end, though, we have $$ P^T G P = H, $$ where $$ G = \left( \begin{array}{rr} p & \frac{\beta}{2} \\ \frac{\beta}{2} & t \end{array} \right) $$ and $$ H = \left( \begin{array}{rr} 1 & \frac{1}{2} \\ \frac{1}{2} & 1 \end{array} \right) $$ If we name $Q = P^{-1},$ we have $$ Q^T H Q = P. $$ Which, you see, is a good thing.

Will Jagy
  • 146,052
2

Regarding only if: $x =y (mod 3)$ is not possible since that would imply that $p=0+0+0=0 (mod 3)$ or $1+1+1 =0 (mod 3) $

For the other alternatives we have:

For $x=0$ and $y=1$ or $2$ gives the result $p=1 (mod 3) $.

Otherwise assume $x=1 (mod 3)$ and $y=2 (mod 3)$. This also gives us $p=1+2+1=1 (mod 3) $

0

This maybe or maybe doesn't help, but for the "if" part, the only prime numbers which could satisfy the condition $p \equiv 1 \ mod\ 3$ are those of the form $(2n)*3+1$, since if it was one more than an odd multiple of three it would be even, hence not prime.

As in your example, 7=(2*1)*3+1, n=1.

I.e. a necessary condition for p is that it equals 1 $\equiv$ mod 6.

Chill2Macht
  • 22,055
  • 10
  • 67
  • 178
0

Here is a proof which is long but, I hope, elementary. Let $f(x, y)=x^2+xy+y^2$ and $g(x, y)=x^2+3y^2$. The question is phrased in terms of $f$ but it's easier to work with $g$, so I first prove that the sets of numbers $f$ and $g$ represent are identical.

$f(a, b)=f(b, a)$. Moreover, if $a+b+c=0$, then at least one of $a, b$ and $c$ is even, and $f(a, b)=f(a, c)$ by simple algebra. Thus by using these substitutions as and when needed, if $n$ has the form $f$, then $n$ has the form $f$ with second parameter even. That is, for some $x$ and $y$, $$n=f(x, 2y)=x^2+2xy+4y^2=g(x+y, y).$$ This last chain of equalities also proves that the implication goes the other way.

A number of the form $f$ or $g$ is termed Loeschian. Further, define a primitive first-form Loeschian number as a number of the form $f(a, b)=a^2+ab+b^2$ where $a$ and $b$ are coprime integers, and a primitive second-form Loeschian number as a number of the form $g(x, y)=x^2+3y^2$ where $x$ and $y$ are coprime integers.

Lemma 1 Every primitive first-form Loeschian number is a primitive second-form Loeschian number.

Proof Suppose not, and let $n$ be a primitive first-form Loeschian number which is not a primitive second-form Loeschian number. $n$ is a second-form Loeschian number $n=g(x, y)$, so there is some $u>1$ where $u\mid x$ and $u\mid y$. $n=g(x, y)=f(a, b)$ where $a=x-y$ and $b=2y$, so $u\mid a$ and $u\mid b$, contradicting the supposition that $n$ is a primitive first-form Loeschian number.

Therefore the result is true.

I now prove a result about the factorisations of primitive Loeschian numbers. My proof adapts a proof of a similar result regarding numbers of the form $x^2+y^2$. I found that, in adapting this proof, I needed the form $g(x, y)=x^2+3y^2$; if the proof could be adapted so as to use the form $f(a, b)=a^2+ab+b^2$, it could be simplified.

Lemma 2 The product of two Loeschian numbers is Loeschian with at least two representations in each form.

Proof Using representations of the first form: \begin{align*} f(a, b)f(c, d) &= (a^2+ab+b^2)(c^2+cd+d^2)\\ &= a^2c^2+a^2cd+a^2d^2+abc^2+abcd+abd^2+b^2c^2+b^2cd+b^2d^2\\ &=[a^2c^2+2abc^2+b^2c^2+2abcd+2b^2cd+b^2d^2]+{}\\ &\qquad +[a^2cd-abc^2+abcd-b^2c^2+abd^2-b^2cd]+{}\\ &\qquad +[a^2d^2-2abcd+b^2c^2]\\ &=(ac+bc+bd)^2+(ac+bc+bd)(ad-bc)+(ad-bc)^2\\ &=f(ac+bc+bd, ad-bc) \end{align*} In addition, \begin{align*} f(a, b)f(c, d) &= (a^2+ab+b^2)(c^2+cd+d^2)\\ &= a^2c^2+a^2cd+a^2d^2+abc^2+abcd+abd^2+b^2c^2+b^2cd+b^2d^2\\ &=[a^2c^2-2abcd+b^2d^2]+{}\\ &\qquad +[a^2cd+abc^2+abcd-abd^2-b^2cd-b^2d^2]+{}\\ &\qquad +[a^2d^2+2abcd+b^2c^2+2abd^2+2b^2cd+b^2d^2]\\ &=(ac-bd)^2+(ac-bd)(ad+bc+bd)+(ad+bc+bd)^2\\ &=f(ac-bd, ad+bc+bd) \end{align*}

Using representations of the second form: \begin{align*} g(t, u)g(x, y)&=(t^2+3u^2)(x^2+3y^2)\\ &=t^2x^2+3(t^2y^2+u^2x^2)+9u^2y^2\\ &=t^2x^2\pm 6tuxy+9u^2y^2+3(t^2y^2\mp 2tuxy+u^2x^2)\\ &=(tx\pm 3uy)^2+3(ty\mp ux)^2\\ &=g(tx\pm 3uy, ty\mp ux) \end{align*}

Therefore the result is true.

Lemma 3 If $p$ is prime, and $p$ and $pq$ are Loeschian, $q$ is Loeschian.

Proof Let \begin{align} pq &= t^2+3u^2\notag\\ p &= x^2+3y^2\notag\\ \implies p(pq) &= (t^2+3u^2)(x^2+3y^2)\tag{1} \end{align} Then \begin{align*} p &\mid t^2p - x^2(pq)\\ \implies p &\mid t^2(x^2+3y^2) - x^2(t^2+3u^2)\\ \implies p &\mid 3t^2y^2-3u^2x^2\\ \implies p &\mid 3(ty-ux)(ty+ux) \end{align*} $p$ must divide at least one of those three factors.

Suppose $p=3$. Then $3q=t^2+3u^2$, so $3\mid t^2$, so $3\mid t$. Let $t=3s$. Then \begin{align*} 3q&=(3s)^2+3u^2\\ \implies q&=u^2+3s^2 \end{align*} so $q$ is Loeschian. The rest of this proof assumes that $p\ne 3$.

Suppose $p \mid ty-ux$. Then $p^2 \mid (ty-ux)^2$. Then, by Lemma 2 \begin{align*} p(pq)&= g(tx+3uy, ty-ux)\tag{by eqn 1 and lemma 2}\\ \implies p^2q&=(tx+3uy)^2+3(ty-ux)^2\\ \implies p^2 &\mid (tx+3uy)^2\\ \implies p &\mid tx+3uy \end{align*} so $q = [(tx+3uy)/p]^2 + 3[(ty-ux)/p]^2$ is Loeschian. Similarly, but with some sign-changes, if $p \mid ty+ux$.

Therefore the result is true.

Lemma 4 If a Loeschian number is divisible by an integer which is not Loeschian, the quotient has a prime factor which is not Loeschian.

This could also be stated as ``if $mn$ and $n$ are Loeschian, $m$ is Loeschian"; a generalisation of lemma 3.

Proof Suppose $mn$ is Loeschian and the factorisation of $m$ is $p_1\cdot\dots\cdot p_k$. If each of the $p_i$ is Loeschian, we may divide $mn$ successively by $p_1, \dots, p_k$, and, by lemma 3, infer that the quotient is Loeschian. This would prove that $n$ is Loeschian. So therefore if $mn$ is Loeschian but $n$ is not Loeschian, then at least one of the $p_i$ is not Loeschian, that is, $m$ has a prime factor which is not Loeschian.

Therefore the result is true.

Lemma 5 Every factor of a primitive second-form Loeschian number is either 2 or Loeschian.

Proof Proof by infinite descent.

Suppose not. Let $n$ be the smallest positive integer $\ne 2$ which is a factor of a primitive Loeschian number and is not Loeschian.

Let $n$ divide the primitive Loeschian number $x^2+3y^2$, where $x$ and $y$ are coprime, and let $x = rn+t$, $y=sn+u$ where $r, s$ are chosen so that $|t|<n/2$ and $|u|<n/2$. (Note that $t, u$ may be of either sign. Note also that $n$ is odd so equality is not possible.) Then \begin{align*} x^2+3y^2 &= (rn+ t)^2 + 3(sn+ u)^2\\ &=r^2n^2+ 2rnt+t^2+3s^2n^2+ 6snu+3u^2\\ &= An + t^2+3u^2 \end{align*} , where $A = (r^2+3s^2)n + 2rt + 6su$. Thus \begin{align} n &\mid t^2+3u^2\notag\\ \implies t^2+3u^2 &= mn\label{cdxy} \end{align} for some integer $m$.

Let $h$ be the HCF (GCD) of $t$ and $u$. Then $h^2 \mid t^2+3u^2$. If $p$ is a prime factor of $h$, then $p\mid t$ and $p\mid u$. If $p\mid n$ too, then $p\mid x$ and $p\mid y$, which is false, as $x$ and $y$ are coprime. Thus $p\nmid n$. Thus $h$ is coprime to $n$, so $h^2 \mid m$, so there are coprime integers $t'=t/h, u'=u/h$ where $t'^2 + 3u'^2 = ln$ for some integer $l=m/h^2$. Now $$ln = t'^2 + 3u'^2 \le t^2+3u^2 < (n/2)^2 + 3(n/2)^2 = n^2,$$ so $l<n$. The inequality is strict because $n$ is odd.

If $t$ and $u$ are coprime, we can use $t$ and $u$ directly rather than $t'$ and $u'$.

By definition of $n$, $n$ is not Loeschian. So, by lemma 4, $l$ must have a factor which is not Loeschian. This factor is a factor of the Loeschian $t'^2 + 3u'^2$, but $<n$, contradicting minimality of $n$.

Therefore the result is true.

Lemma 6 Every factor of a primitive first-form Loeschian number is Loeschian.

Proof Let $n$ be a primitive first-form Loeschian number $n=a^2+ab+b^2$ where $a$ and $b$ are coprime, so at least one of them is odd. If $a$ and $b$ are both odd, $n$ is the sum of three odd terms and so is odd; if $a$ and $b$ have different parities, $n$ is the sum of two even terms and one odd, and so is odd. In each case, $n$ is odd.

By lemma 1, $n$ is a primitive second-form Loeschian number, so, by lemma 5, $n$'s every factor is 2 or Loeschian. But $n$ is odd, and so 2 is not a factor of $n$.

Therefore the result is true.

And finally, to answer the OP:

Theorem Let $p=6k+1$ be prime. Then $p$ is Loeschian.

Proof This proof is based on Euler's proof of Fermat's theorem that every prime of the form $4k+1$ is the sum of two squares.

Suppose not. Let $p=6k+1$ be a prime which is not Loeschian. By Fermat's little theorem, $a^{p-1}=a^{6k}=1\mod p$, for all $0<a<p$. Thus the differences $a^{6k}-b^{6k}$ for $a=2, 3,\dots,6k$ and $b=a-1$, are all divisible by $p$. Each of these differences is $$a^{6k}-b^{6k} = (a^{4k}+a^{2k}b^{2k}+b^{4k})(a^{2k}-b^{2k})$$ $p$ is prime, so, in each case, $p$ divides one of the factors on the right-hand side. Note that the left-hand factor is the Loeschian number $f(a^{2k}, b^{2k})$. If for any $a$, $p$ divides that left-hand factor, then (as $a$ and $b$ are coprime), by lemma 6, $p$ is Loeschian. This contradicts the definition of $p$.

Therefore, for all $a$, $p$ divides the right-hand factor. Then in the sequence 1, $2^{2k},\dots, (6k)^{2k}$, $p$ divides all the first differences, so $p$ divides all the second differences, and so on, and thus $p$ divides the $2k$'th differences. But each of these $2k$'th differences is $(2k)!$, which is not divisible by any prime greater than $2k$, and thus not by $p$, because $p=6k+1>2k$ and is prime. This is also a contradiction.

Therefore there cannot be any such $p$. Therefore the theorem is true.

Rosie F
  • 3,231