Consider the quadratic form $x^2 + 2y^2$ over the ring $\mathbb{Z}[i]$. It is irreducible, so I wanted to know which primes could be represented by this quadratic form.

$$ \mathfrak{p} = x^2 + 2y^2 $$

There's two slightly different questions here. One about the integer $\mathfrak{p} \in \mathbb{Z}[i]$ and one about the ideals $(\mathfrak{p}) \subseteq \mathbb{Z}[i]$. This is still a PID so I can write just one element.

This hopefully in analogy to Fermat's theorem on primes as the sum of two squares, where it is solved by a congruence condition. The analogous question for $x^2 + y^2 = (x+iy)(x-iy)$ is degenerate.

  • Do you want primes which do not split over $\mathbb{Z}[i]$, that is, the rational primes $p \equiv 3 \pmod{4}$? – Stanley Yao Xiao Jul 6 at 15:27
  • @StanleyYaoXiao $\mathfrak{p}=1+2i$ is prime, and now I can attempt to solve $\mathfrak{p} = a^2 + b^2 $ with $a,b \in \mathbb{Z}[i]$. – john mangual Jul 6 at 15:38
  • 9
    The relevant number field ${\bf Q}(i,\sqrt{-2})$ is isomorphic with the 8th cyclotomic field, which has trivial class group <>;. So there should be a necessary and sufficient congruence condition here too, maybe as simple as $\mathfrak p$ having norm $1 \bmod 8$. – Noam D. Elkies Jul 6 at 23:57

Here is a partial answer. Hope someone out there would fill in the remaining details. In summary, using the OP's notations (in particular $x,y\in {\mathbb Z}[i]$), the case for $p=2$ is not possible, i.e. $\pm (1+i)$ is not of the form $x^2+2y^2$. If $p\equiv 1~({\rm mod~}4)$, then necessarily $p:=\frak{ p}\overline {\frak {p}}$ must satisfy $$p\equiv 1~({\rm mod~}8).$$ For $p\equiv 3~({\rm mod~}4),$ it is always possible to write $p=x^2+2y^2$.

For example, in the situation $p\equiv 1~({\rm mod~}8)$, the first few cases of $\frak{p}$ are as follows (one takes complex conjugate to get the representation for $\overline{\frak p}$): $$p=17=\frak{p}\overline{\frak{p}}~{\rm with~}{\frak{p}}=1+4i=1^2+2(1+i)^2$$ $$p=41=\frak{p}\overline{\frak{p}}~{\rm with~}{\frak{p}}=5+4i=(2+i)^2+2\cdot 1^2$$ $$p=73=\frak{p}\overline{\frak{p}}~{\rm with~}{\frak{p}}=-3+8i=(1+2i)^2+2(1+i)^2$$ $$p=89=\frak{p}\overline{\frak{p}}~{\rm with~}{\frak{p}}=5+8i=(3+2i)^2+2(1-i)^2$$ $$p=97=\frak{p}\overline{\frak{p}}~{\rm with~}{\frak{p}}=9+4i=3^2+2(1+i)^2.$$ The reasoning (incomplete when $p\equiv 1~({\rm mod~}8)$) is as follows: Consider first the case when $p\equiv 1~({\rm mod~}4)$. Denoting $x=a+bi,y=c+di,a,b,c,d\in {\mathbb Z}$ with $p={\frak{p}}\overline{\frak{p}}=(x^2+2y^2)(\overline{x}^2+2\overline{y}^2).$ It follows that $$p=(a^2+b^2)^2+4(c^2+d^2)^2+4[(ac+bd)^2-(bc-ad)^2],$$ from which by some parity checking, it is easy to see that necessarily $p\equiv 1~({\rm mod~}8).$

Now it remains to check the cases $p=2$ and $p\equiv 3~({\rm mod~}4).$ For $p=2$, one needs to have $$1\pm i=x+2y^2=(a+bi)^2+2(c+di)^2=[a^2-b^2+2(c^2-d^2)]+2i[ab+2cd],$$ which is absurd.

For $p\equiv 3~({\rm mod~}4)$, $p$ is prime, so we need to solve the condition $$p=[a^2-b^2+2(c^2-d^2)]+2i[ab+2cd],$$ hence $$p=a^2-b^2+2(c^2-d^2)~{\rm and~}ab=-2cd.$$ Two subcases arise.

Subcase 1: $p\equiv 3~({\rm mod~}8)$. Here one just solves from the above condition for $p=a^2+2c^2$ (letting $b=d=0$), which is solvable, since $$p=u^2+2v^2\Leftrightarrow p\equiv 1,3~({\rm mod~}8).$$ (See D. Cox's famous book "Primes of the forms $x^2+ny^2$.")

Subcase 2: $p\equiv -1~({\rm mod}~8)$. This time, use the relation $p=a^2-2d^2$ (letting $b=c=0$). This is possible by the following known result: $$p\equiv \pm 1~({\rm mod~}8)\Leftrightarrow p=u^2-2v^2$$ (See F. Lemmermeyer's notes here. Link to be added.) Now it boils down to solving the remaining details:

Problem. Show that when $p\equiv 1~({\rm mod~}8),$ the equation $${\frak{p}}=x^2+2y^2$$ can be solved, where $p=\frak{p}\overline{\frak{p}}.$ This may require the comments from Noam D. Elkies.

Just elaborating on the very nice comments and answer by Cherng-tiao Perng. As Noam Elkies said, $$ \mathbb{Q}[i,\sqrt{-2}]=\mathbb{Q}[\exp(2\pi i/8)]. $$ As is well known, the Galois group of the $8$-th cyclotomic field over $\mathbb{Q}$ is isomorphic to $(\mathbb{Z}/8\mathbb{Z})^{*}=\{1,3,5,7\}$. Let $\sigma_j$ be the element in $Gal(\mathbb{Q}[\exp(2\pi i/8)]/\mathbb{Q})$ that sends $\exp(2\pi i/8)$ to $\exp(2\pi ij/8)$, $j\in \{1,3,5,7\}$.

As is well known, $\sigma_5$ fixes $i$, sends $\sqrt{2}$ to $-\sqrt{2}$, $\sqrt{-2}$ to $-\sqrt{-2}$. $\sigma_3$ fixes $\sqrt{-2}$, sends $i$ to $-i$, $\sqrt{2}$ to $-\sqrt{2}$. $\sigma_7$ fixes $\sqrt{2}$, sends $i$ to $-i$, $\sqrt{-2}$ to $-\sqrt{-2}$.

Let $x=a+ib$, $y=c-id$. If $\mathfrak{p}\in\mathbb{Z}[i]$ may be written as $$ \mathfrak{p}=x^2+2y^2=(x+y\sqrt{-2})(x-y\sqrt{-2})=(a+ib+\sqrt{-2}c+\sqrt{2}d)(a+ib-\sqrt{-2}c-\sqrt{2}d), $$ then $$\mathfrak{p}=(a+ib+\sqrt{-2}c+\sqrt{2}d)\sigma_5((a+ib+\sqrt{-2}c+\sqrt{2}d)).$$

Since the primes $\mathfrak{p}$ in $\mathbb{Z}[i]$ are rational primes $p=3,7\bmod 8$ or primes with norms that are rational primes $p=1,5\bmod 8$, we consider these cases.

Suppose $p=1,5\bmod 8$ so that $p=\mathfrak{p}\mathfrak{\bar{p}}$. Since $\mathfrak{\bar{p}}=\sigma_3(\mathfrak{p})$, then if $$ \mathfrak{p}=(a+ib+\sqrt{-2}c+\sqrt{2}d)\sigma_5((a+ib+\sqrt{-2}c+\sqrt{2}d)), $$ then $$ \mathfrak{\bar{p}}=\sigma_3((a+ib+\sqrt{-2}c+\sqrt{2}d))\sigma_7((a+ib+\sqrt{-2}c+\sqrt{2}d)) $$ and $$ p=\prod_{j\in\{1,3,5,7\}}\sigma_j((a+ib+\sqrt{-2}c+\sqrt{2}d)). $$ As is well known, for odd primes $p$, this only happens if $p=1\bmod 8$.

As $\{a_0+a_1i+a_2\sqrt{2}+a_3\sqrt{-2}| a_0,a_1,a_2,a_3\in\mathbb{Z}\}$ is a subring of $\mathbb{Z}[\exp(2\pi i/8)]$, i.e., $$ a_0+a_1i+a_2\sqrt{2}+a_3\sqrt{-2}=a_0+a_1i+(a_2+a_3)\exp(2\pi i/8)+(a_3-a_2)\exp(2\pi i3/8), $$ as is pointed out in the other answer, we have to also check, when $p=1\bmod 8$ with $p=\mathfrak{p}\mathfrak{\bar{p}}$, where $\mathfrak{p}$ is an element and not an ideal, which of $\mathfrak{p}^{\prime}\in\mathfrak{p}\{1,-1,i,-i\}$ may be written as $$ \mathfrak{p}^{\prime}=\prod_{j\in\{1,5\}}\sigma_j(a_0+a_1i+a_2\sqrt{2}+a_3\sqrt{-2}), $$ and as the other answer indicates, and we may verify, for example, using PARI/GP


[Mod(Mod(-1, y^2 + 1)*x + Mod(y + 2, y^2 + 1), x^2 - 2), 1]


[Mod(Mod(11/2*y - 3/2, y^2 + 1)*x + Mod(8*y - 2, y^2 + 1), x^2 - 2), 1]

and also prove using congruences, that for such situations it only happens when $\mathfrak{p}^{\prime}$ is of the form $a+ib$, $a,b\in\mathbb{Z}$, $a$ odd, $b=0\bmod 4$.

Suppose that $p=3\bmod 8$. Then there are $x,y\in\mathbb{Z}$ so that $$ p=x^2+2y^2. $$

Suppose that $p=7\bmod 8$. Then there is $x\in\mathbb{Z}$, $y\in i\mathbb{Z}$ so that $$ p=x^2+2y^2. $$

  • Should have adjoined $\sqrt{-2}$ instead of $\sqrt{2}$ in the PARI/GP code. But anyway, same effect. – abc Jul 18 at 4:45

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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