# How is this called? Rationals and irrationals

I stumbled upon this "relation" (is the name correct?):

$$\lim_{m \to \infty} \lim_{n \to \infty} \cos^{2n}(m! \pi x) = \begin{cases} 1,&x\text{ is rational}\\ 0,&x\text{ is irrational}\end{cases}$$

How is it called and why is it so? I'm really not asking for a proof since I fear it would be too complicated for me to understand, but rather for an "intuition".

Thanks,
rubik

-
This is called Dirichlet function, you can read more about it here: en.wikipedia.org/wiki/… –  Dennis Gulko Dec 25 '12 at 11:36
Dunham: The Calculus Gallery, p.197 –  Martin Sleziak Dec 27 '12 at 9:42

The intuition is already almost the proof.

• The cosine takes values between $-1$ and $1$, inclusive
• Taking an even power ensures that the values are between $0$ and $1$.
• Taking higher and higher powers will not affect those $x$ where the cosine squared is $1$, but all other values will converge to $0$

Thus $f(x):=\lim_{n\to\infty}\cos^{2n}(x)$ is a function that has value $0$ for all $x$, except that $f(x)=1$ if $\cos(x)=\pm1$, i.e. if $x$ is a multiple of $\pi$. After this, we see that multiplying the argument with $\pi$ is done to have the value $1$ at integers instead of multiples of $\pi$. Then the multiplication with $m!$ serves the purpose to obtain $1$ for any integer multiple of $\frac1{m!}$. As $m\to \infty$, this exhausts the rationals (and only them).

-
A totally random question, are the limits interchangeable here? Or does the order matter? –  Fixed Point Dec 25 '12 at 12:21
@PrinceAli $\lim_{m\to\infty}\cos^{2n}(m!\pi x)$ is $1$ for rational $x$, but does not exist for most irrational $x$. –  Hagen von Eitzen Dec 25 '12 at 21:21

First notice that $-1\le\cos m!\pi x\le 1$ for all $m$ and $x$, so $0\le\cos^2m!\pi x\le 1$. Suppose that $0\le y\le 1$; then

$$\lim_{n\to\infty}y^n=\begin{cases} 0,&\text{if }y\ne 1\\ 1,&\text{if }y=1\;. \end{cases}\tag{1}$$

Now $\cos^2 m!\pi x=1$ if and only if $m!x$ is an integer. Say $m!x=a$ for some integer $a$; then $x=\frac{a}{m!}$, a rational number. Thus, $m!x$ is never an integer when $x$ is irrational, and therefore for all $m$ we have $\cos^2m!\pi x\ne 1$. $(1)$ then implies that $$\lim_{n\to\infty}\cos^{2n}m!\pi x=0$$ for all $m$, and of course in that case $$\lim_{m\to\infty}\lim_{n\to\infty}\cos^{2n}m!\pi x=\lim_{m\to\infty}0=0\;.$$

This explains why the limit is $0$ when $x$ is irrational.

If $x$ is rational, on the other hand, we can write $x=\frac{a}b$ for some integers $a,b$ with $b>0$. Then for all $m\ge b$ we can be sure that $m!x$ is an integer and hence that $\cos^2m!\pi x=1$. But then the sequence

$$\left\langle\cos^{2n}m!\pi x:n\in\Bbb N\right\rangle$$

is constantly $1$ for $m\ge b!$, so for $m\ge b!$ we have

$$\lim_{n\to\infty}\cos^{2n}m!\pi x=1\;.$$

But then the sequence $$\left\langle\lim_{n\to\infty}\cos^{2n}m!\pi x:m\in\Bbb N\right\rangle$$

is constantly $1$ for $m\ge b!$, and

$$\lim_{m\to\infty}\lim_{n\to\infty}\cos^{2n}m!\pi x=1\;.$$

-
Why limit for $m$ is before the other one? Shouldn't be the opposite, since the cosine argument is evaluated before the exponentiation? –  rubik Dec 26 '12 at 17:46
@rubik: The order in which the $\cos$ and exponent are evaluated is irrelevant. What matters is that we hold $m$ constant and evaluate the limit as $n\to\infty$; call this $\ell_m$. Then we take the limit of the $\ell_m$ as $m\to\infty$. –  Brian M. Scott Dec 26 '12 at 17:50
ok, got it! Thanks! –  rubik Dec 27 '12 at 19:57
@rubik: You’re welcome. –  Brian M. Scott Dec 27 '12 at 20:27

I'm not sure it has a name, but here's a fairly simple proof:

If $m!x$ is an integer, then $\cos^{2n}(m!\pi x) = 1$.

If $x$ is rational $\frac{p}{q}$, then, eventually, for large enough $m$, $m!$ will be divisible by $q$ (and stay so for all larger m), so that $m!x$ will be an integer, and we have what we want.

If $x$ is irrational, $m!x$ will never be an integer, and $|\cos(m!\pi x)| \lt 1$, so that $\lim_{n \to \infty} \cos^{2n}(m!\pi x) = 0$ for all $m>0$.

(This may need some cleaning up to make rigorous...)

-