# Show that $\lim_{k\to\infty}\lim_{j\to\infty}\cos^{2j}k!\pi x=0$ [duplicate]

This question already has an answer here:

The Dirichlet function is defined as the indicator function of rational numbers. I have also seen this function described by: $$f(x)=\lim_{k\to\infty}\lim_{j\to\infty}\cos^{2j}k!\pi x$$ How does this limit act as the indicator, and how does it yield an answer if cosine is limited to Infinity?

## marked as duplicate by Paul Frost, Brian Borchers, Cesareo, Xander Henderson, Don ThousandOct 28 '18 at 23:42

Suppose $$x$$ is rational and $$x=\frac pq$$ for $$\gcd(p,q)=1$$. If $$k\ge q$$, $$k!x$$ will be an integer, so $$\cos k!\pi x=\pm1$$ and $$\cos^{2j}k!\pi x=1$$. Thus the function is 1 for sufficiently large $$k,j$$, so it evaluates to 1.
Suppose $$x$$ is irrational, then $$k!x$$ will never be an integer, so $$|\cos k!\pi x|<1$$ for all $$k$$. As $$j\to\infty$$, this variable being in the exponent yields $$\cos^{2j}k!\pi x\to0$$, so the function evaluates to 0.
• @mtung If it were $k$, then $kx$ would not be an integer for sufficiently large $q$, and we would not be able to derive the result for rational $x$. – Parcly Taxel Oct 28 '18 at 12:25
• +1. Actually, for $k$ large enough, $k!x$ is an even integer, so we could say that $\cos(k!\pi x)=1$. But this, of course, does not add much to the proof. – Taladris Oct 28 '18 at 13:21