Let, $i=\sqrt{-1}$ and $\omega = e^{\frac{2\pi i}{3}}$.

I know that we can represent the ring of integers $\mathbb{Z}[i]$ and $\mathbb{Z}[\omega]$ as square and triangular lattice on complex plane respectively.

Motivated by this and this question I wish to know:

  1. Is there a way to plot such lattice diagrams for each and every ring of algebraic integer? If yes, then how?
  2. Is there a way to determine the shape of lattice units (rectangular, triangular,...) without actually plotting them?

By "how" I am asking for an example of code for a software (preferably open-source) which can be used to plot all such lattices.

  • 1
    $\begingroup$ It's definitely possible for every $\mathcal{O}_{\mathbb{Q}(\sqrt{d})}$ where $d$ is a squarefree negative integer. For $d$ positive, you have to make some compromises. $\endgroup$ Jul 10, 2016 at 17:52
  • 2
    $\begingroup$ Mostly the set will be dense in the complex plane. $\endgroup$
    – quid
    Jul 10, 2016 at 19:07
  • $\begingroup$ @RobertSoupe What kind of compromises you are suggesting for $d>0$? $\endgroup$ Jul 10, 2016 at 19:48
  • $\begingroup$ Maybe only numbers of small norm, e.g., $|N| < 50$. As the norm gets larger, use lighter or darker colors depending on the background color, so that numbers of large norm can be said to be indistinguishable from the background. $\endgroup$ Jul 10, 2016 at 20:39

2 Answers 2


Someone else will deliver a more complete answer in due time, but for now, I'd like to answer your questions limited to imaginary quadratic integer rings. That is, if $d$ is a negative, squarefree integer, we're looking at the algebraic integers of $\mathbb{Q}(\sqrt{d})$, which we can notate as $\mathcal{O}_{\mathbb{Q}(\sqrt{d})}$, and $\mathbb{Z}[\sqrt{d}]$ if $d \not\equiv 1 \pmod 4$ (remember that $\omega = -\frac{1}{2} + \frac{\sqrt{-3}}{2}$; some people like to define $\theta = -\frac{1}{2} + \frac{\sqrt{d}}{2}$ and then use the $\mathbb{Z}[\theta]$ notation).

And really that congruence is what determines if the lattice is rectangular or triangular. If $d \not\equiv 1 \pmod 4$, then only numbers of the form $a + b \sqrt{d}$, with $a, b \in \mathbb{Z}$, are in $\mathbb{Z}[\sqrt{d}]$, and therefore the lattice will be rectangular. For example, in $\mathbb{Z}[\sqrt{-2}]$, we see that 1 lines up vertically with $1 + \sqrt{-2}$ and $1 - \sqrt{-2}$, $1 + 2 \sqrt{-2}$ and $1 - 2 \sqrt{-2}$, etc. And it lines up horizontally with all purely real integers of this domain.

Now let's look at $\mathcal{O}_{\mathbb{Q}(\sqrt{-7})}$. Since $-7 \equiv 1 \pmod 4$ (remember that $-7 = -2 \times 4 + 1$), the domain includes the so-called half-integers, such as $$\frac{5}{2} + \frac{\sqrt{-7}}{2}, -\frac{3}{2} + \frac{9 \sqrt{-7}}{2}, \frac{13}{2} - \frac{11 \sqrt{-7}}{2}, \ldots$$ Notice that in each case, in $$\frac{a}{2} + \frac{b \sqrt{-7}}{2},$$ both $a$ and $b$ are odd. If they're both even, we can simplify the fractions to integers.

But if one is odd and the other is even, then it's not an algebraic integer in this domain. Consider for example $$N\left(5 + \frac{\sqrt{-7}}{2}\right) = 5^2 + 7\left(\frac{1}{2}\right)^2 = 25 + \frac{7}{4},$$ which is not an integer. Furthermore, the minimal polynomial of this number is $4x^2 - 40x + 107$, which you can verify by hand calculations, or by asking Wolfram Alpha is 5 + sqrt(-7)/2 an algebraic integer? Change your WA query to is (5/2 + sqrt(-7)/2) an algebraic integer? (it seems to get confused without the parentheses, oh well) and it tells you that this number has a minimal polynomial of $x^2 - 5x + 8$.

So $$\frac{5}{2} + \frac{\sqrt{-7}}{2}$$ will not line up horizontally or vertically with $2 + \sqrt{-7}$, $3 + \sqrt{-7}$, 3 or 2. But if you draw a diagonal from $2 + \sqrt{-7}$ to 3 and another from 2 to $3 + \sqrt{-7}$, where do the two diagonals meet? Therefore, if $d \equiv 1 \pmod 4$, the lattice is triangular.

The following diagram I originally made because I was interested about the primes in $\mathcal{O}_{\mathbb{Q}(\sqrt{-7})}$.

Illustration of primes in $\mathcal{O}_{\mathbb{Q}(\sqrt{-7})}$

If $a$ and $b$ are odd, only $|a| = |b| = 1$ gives a prime, specifically a prime with a norm of 2. For that reason, I did not bother to draw the diagonal lines, but for your benefit, I copied the $a$ and $b$ both even grid, lined it up to the primes of norm 2 and reduced its opacity. (The eagle-eyed will say that $-7$ and 7 need to be colored light blue or some color other than dark blue, and they're right, but it does not matter for your question).

  • $\begingroup$ Very nice explanation! How did you draw this diagram? Today I drew diagrams for Gaussian and Eisenstein integers using GeoGebra. I think that "equilateral" triangle lattice is only in case of Eisenstein integers (by measuring slopes of lines joining lattice points). Am I correct? $\endgroup$ Jul 10, 2016 at 19:43
  • 1
    $\begingroup$ With Photoshop Elements. It was a laborious process, and it was very dependent on the fact that the diagonal of a unit square measures $\sqrt{2}$. From there I don't remember the exact steps I used to get to $\sqrt{7}$, but it's kind of moot because the number of pixels is just a rational approximation. $\endgroup$ Jul 10, 2016 at 20:36
  • 3
    $\begingroup$ If I may butt in: @rationalbeing, you are correct in that the Eisenstein integers make the only equilateral triangle lattice. Notice that $$N(\omega) = N \left( \frac{-1 + \sqrt{-3}}{2}\right) = \frac{1 + 3}{4} = 1.$$ For the other negative $d$ satisfying the specified requirements, the base of each triangle has a length of $1$, while the other two sides have a length of $$\sqrt{\frac{1 - d}{4}}.$$ $\endgroup$
    – Mr. Brooks
    Jul 11, 2016 at 21:14
  • $\begingroup$ Thank you, @Mr.Brooks. Sorry, rationalbeing, that I skipped over your second question in your comment. $\endgroup$ Jul 12, 2016 at 1:58
  • $\begingroup$ @Mr.Brooks This insight is really helpful :) $\endgroup$ Jul 12, 2016 at 3:11

This is not really an answer, but might be relevant. I record it as CW.

The ring of algebraic integers $R$ of a number field $K$, of degree $n$, is always a free $\mathbb{Z}$-module of rank $n$, that is there are elements $\omega_1, \dots, \omega_n$, called an integral basis, such that every element $r\in R$ has a unique representation of the form $r=\sum_{i=1}^n a_i \omega_i$ with $a_i$ integers.

Various programs are able to compute the integral basis. To then print a selection of the relevant points is not hard, but it will often just yield a colored area as the set is dense.

The way to use the lattice structure effectively is described in a linked to answer.

  • $\begingroup$ Can you please give a list of open source programs available to compute integral basis? I can't afford Mathematica etc. $\endgroup$ Jul 10, 2016 at 19:45
  • 1
    $\begingroup$ For example KANT, PARI, SageMath The first might not be open source (I think) but it is free to use. The last used the second last time I checked, but is in a way more user friendly and complete. I'd recommend you try Sage. $\endgroup$
    – quid
    Jul 10, 2016 at 19:56
  • $\begingroup$ I can compute integral basis using sage, (as given here) then how do I plot points, say points with norm between 0 and 5? I found this article but was not helpful. $\endgroup$ Jul 10, 2016 at 20:22
  • $\begingroup$ This does not exactly answer the question, but I'd just do something else: chose some range of integers and plot all with coefficients in that range. $\endgroup$
    – quid
    Jul 10, 2016 at 20:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .