Prime numbers are the dwellings of the mystics

In Cayley transform for Easter we used the Cayley transform to create a pattern on the Poincaré disk:

Gaussian fractions on the disk.

Which reminded me of the Ulam spiral

The Ulam spiral or prime spiral (in other languages also called the Ulam cloth) is a graphical depiction of the set of prime numbers, devised by mathematician Stanislaw Ulam in 1963 and popularized in Martin Gardner’s Mathematical Games column in Scientific American a short time later.[1] It is constructed by writing the positive integers in a square spiral and specially marking the prime numbers.

Ulam spiral

The organization of prime numbers is somewhat unpredictable, so it was kind of surprise for Ulam to find patterns in his collecting consecutive prime numbers into a spiral.

So, I used Cayley transform and applied it to fractions (m+in)/(p+iq) where m,n,p,q are prime numbers such that the fraction is in the upper half-plane. I restricted primes to be at most 23, included their negatives, and added 0 and 1 to the table.

Here is the resulting pattern:

Pattern of Cayley transformed fractions made of Gaussian integers. Click on the image to open a 1280×1281 magnification

Our eyes can see all kind of patterns there. I have no explanation for these patterns.

Recreations with Cayley transform

What can we do with Cayley transform? We can produce interesting pictures. Here are two such pictures:

Gaussian integers with Cayley transform
Gaussian integers on the Poincaré disk

In fact in both pictures we have the same pattern of dots, but they are organized differently by coloring.

How are these images produced? They are produced using Gaussian integers and Cayley transform.

Cayley transform we know from the previous post Cayley transform for Easter. It is the same as in Wikipedia , where it is defined as

(1)   \begin{equation*}z'=f(z)=\frac{z-i}{z+i}.\end{equation*}

It maps complex upper half-plane \mathbb{H}, the set of all complex numbers with positive imaginary part, onto the interior D of the unit disk. The real axis is mapped onto the unit circle, minus the point z'=1. The inverse Cayley transform maps 1 to infinity.

Gaussian integers are also explained in Wikipedia: \url{}

In number theory, a Gaussian integer is a complex number whose real and imaginary parts are both integers. ….

We want our Gaussian integers to be in \mathbb{H}, or on the real line, so we take the integer defining the imaginary part to be nonnegative. To produce images above I took Gaussian integers of the form Z=m+in with m varying from -100 to 100, and n varying from 0 to 100. To each such z I apply the Cayley transform and plot the point f(z).

At the end I rotate the images 90 degrees clockwise, so that the neighborhood of z'=1 is at the bottom. It looks for me more interesting this way.

The colors of the points are constant, either along increasing m or along the increasing n.

Notice that the line with the same color in the first picture look like hyperbolic straight lines – they are circle segments perpendicular to the boundary.

We will need to understand why is it so?

Cayley transform for Easter

It is Easter Sunday when I writing this note. In Getting real we met the Cayley transform and its inverse.

Namely we have defined the unitary matrix \mathcal{C}

(1)   \begin{equation*}\mathcal{C}=\frac{1}{1+i}\begin{bmatrix}i&1\\-i&1\end{bmatrix}.\end{equation*}

Its inverse \mathcal{C}^{-1}=\mathcal{C}^* being given by

(2)   \begin{equation*}\mathcal{C}^{-1}=\frac{1}{1-i}\begin{bmatrix}-i&i\\1&1\end{bmatrix}.\end{equation*}

We will use the matrix \mathcal{C} in two ways: either for implementing a similarity transformation A\mapsto A'=\mathcal{C}^{-1}A\mathcal{C} resp. A'\mapsto \mathcal{C}A'\mathcal{C}^{-1}, or for implementing fractional linear transformation of the type

(3)   \begin{equation*}z\mapsto A\cdot{z}=\begin{bmatrix}\lambda&\mu\\ \nu&\rho\end{bmatrix}\cdot z= \frac{\rho z+\nu}{\mu z+\lambda}.\end{equation*}

In each case a factor, such as \frac{1}{1+i}, in front of the matrix is not important. It will cancel out. Two proportional matrices implement the same similarity transformation and the same fractional linear transformation. We have chosen the factor so as to have \mathcal{C} unitary of determinant 1, but that fact will play no role. What is important is the internal structure of \mathcal{C}.

In Getting real we have found that the similarity transformation

    \[ A\mapsto A'=\mathcal{C}^{-1}A\mathcal{C}\]

transforms complex SU(1,1) matrices into real SL(2,R) matrices. Let us now check the fractional linear transformation implemented by \mathcal{C}^{-1}. For a general case it is convenient to denote the fractional linear transformation (3) as A\cdot z. From Eq. (3) it can be easily verified that, whenever the results are finite, we have

(4)   \begin{equation*} B\cdot(A\cdot z) =(BA)\cdot z.\end{equation*}

One could extend the domain and the range of the transformation by replacing the complex plane by its one-point compactification, the Riemann sphere, but we will not need such an extension.

For us the crucial observation is that the transformation z\mapsto \mathcal{C}^{-1}\cdot z maps the unit disk D onto the upper half-plane \mathbb{H}, that is onto the set of complex numbers with positive imaginary part. To see this let us examine the properties of z' defined by

(5)   \begin{equation*}z'=\mathcal{C}^{-1}\cdot z=\frac{z+1}{iz-i}=\frac{(z+1)(-i\bar{z}+i)}{|z-1|^2}=\frac{i(1-|z|^2)+i(z-\bar{z})}{|z-1|^2}.\end{equation*}

The imaginary part of z' is evidently positive when |z|^2<1. It becomes zero when |z|^2=1. Conversely, the transformation z'\mapsto z=\mathcal{C}\cdot z'=\frac{z'-i}{z'+i} maps the upper half-plane \mathbb{H} in D. To see that this is indeed the case let us calculate |z|^2:

(6)   \begin{equation*}|z|^2=\frac{|z'-i|^2}{|z'+i|^2}=\frac{(z'-i)(\bar{z'}+i)}{(z'+i)(\bar{z'}-i)}=\frac{|z'|^2+1+i(z'-\bar{z'})}{|z'|^2+1-i(z'-\bar{z'})}.\end{equation*}

Now z'-\bar{z}'=2i\mathrm{Im}(z'), therefore if \mathrm{Im}(z')>0, then

(7)   \begin{equation*}|z|^2=\frac{|z'|^2+1-2\mathrm{Im}(z')}{|z'|^2+1+2\mathrm{Im}(z')}<1.\end{equation*}

Moreover, if \mathrm{Im}(z')=0, that is if z' is on the real axis, then its image z is on the unit circle.

We finish this Eater post with an ornament. Consider complex numbers z' of the form z'=(m+in)/(p+iq) where m,n,p,q are real integers with \mathrm{Im}(z')>0 and pq\neq0. Apply the Cayley transform to each such number and plot the number \matcal{C}\cdot z' as a point in the disk. Of course we have to restrict the size of m,n,p,q, say to \leq 9. The result is the following Easter Ornament:

Gaussian fractions on the disk.