# Irrational fractional parts - patterns

Some fractional-part list plots are:

$\text{listplot of }|[\pi x]-\pi x|\text{, for }x \in \mathbb{Z} \text{ and } \text{listplot of }|[ex]-ex|\text{, for }x \in \mathbb{Z}$

$\text{listplot of }|[\sqrt{2} \ x]-\sqrt{2} \ x|\text{, for }x \in \mathbb{Z}\text{ and } \text{listplot of }|[x/300]-x/300|\text{, for }x \in \mathbb{Z}$

Any rational multiple of $x$ seems to yield a zigzag pattern as in last plot, whereas irrational multiples yield different patterns. Not only this, but irrational multiples of a square yield fairly chaotic plots as shown below.

$\text{listplot of }|[x^2\sqrt{2}]-x^2\sqrt{2}|\text{, for }x \in \mathbb{Z}$

Is this always the case, or are there exceptions to the rule? What is the explanation for these patterns, and is this a very loose test for irrationality?

NB Mathematica code:

ListPlot[Abs[Round[Table[N[ m Sqrt[2]], {m, 1, 1000}]] -
Table[N[m Sqrt[2]], {m, 1, 1000}]]]


# Update

Crisscross $\pi$ pattern is replicable by rational multiples (eg $12414/238$) - but doesn't stand up to the $x^2$ test.

-
Although those plots look very nice and appealing, I doubt that you will find any general pattern distinguishing rational numbers from irrational numbers. For one thing your computer plotting the above does not have irrational numbers because each number will be represented using finitely many bits. – String Apr 29 '14 at 10:18
Yes, I wondered whether this would have been a consequence of numerical error :/ – martin Apr 29 '14 at 12:19
In fact only the fractional part of the original number matters. Or put differently: define an equivalence relation by $$a\sim b\iff |a-b|\in\mathbb{N}$$ Then equivalent numbers produce identical plots. Thus it suffices to consider numbers in the interval $[0,1)$. Check out my dynamic plot for numbers between 0 and 1: geogebratube.org/student/m112746 – String Apr 29 '14 at 12:55
Your plots are very interesting but can you explain this phenomenon? Or have you come across anywhere that might be able to? – martin Apr 29 '14 at 17:16

I have very little idea about what happens in the $x^2$-plots, but I have a few thoughts on the other plots. For the remainder of this answer we define for each fixed number $t$ the $t$-plot function: $$f_t(x)=|\text{round}(t\cdot x)-t\cdot x|,\quad x\in\mathbb Z$$

## Only fractional parts matter

Like stated in the comments we may define an equivalence relation by $a\sim b\iff a-b\in\mathbb Z$. Suppose now that $a=m+q$ with $m\in\mathbb Z$ and fractional part $q\in[0,1)$. Then for $x\in\mathbb Z$ we get $$x\cdot a =\underbrace{x\cdot m}_{\text{in }\mathbb Z}+x\cdot q\sim x\cdot q$$ showing that $x\cdot a$ has the same fractional part as $x\cdot q$. Since the $t$-plots depend only on the fractional parts of the multiples of $t$, this shows that all numbers equivalent to $q$ will produce the exact same $t$-plot as $q$.

## Irrationals resemble rationals arbitrarily well

Suppose the plot has dimensions $[0,n]\times[0,0.5)$. Each pixel on the screen has a height $h$ corresponding to a rational subsection of the interval $[0,0.5)$. Assuming that $t$ is irrational it is evident that $f_t(x)$ must be so too. Then for each integer $x\in[0,n]$ the value of $f_t(x)$ will be plotted in the $k$-th row from the bottom where $k$ is determined by the property that $$f_t(x)\in(k\cdot h,k\cdot h+h)$$ Now, fixing a particular $x$, we may find an $\varepsilon_x>0$ such that $f_{t-\varepsilon_x}(x)$ and $f_{t+\varepsilon_x}(x)$ are both contained this interval. Thus defining $\varepsilon=\min_x(\varepsilon_x)$ for all the integers $x\in[0,n]$ we have found an $\varepsilon>0$ having this property for all $x$-values in our plot. Thus we may choose a rational number $t'\in(t-\varepsilon,t+\varepsilon)$ which is then bound to have function values $f_{t'}(x)$ in the same $h$-intervals as $f_t(x)$ did thus producing an identical plot to that of $f_t(x)$ on the screen.

The short story is that for a given number of points $n$ and a given resolution given by the pixel height $h$ it is possible to find a rational number $t'$ close enough to the irrational number $t$ so that they produce the exact same plots on the screen.