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 Thousand Oct 28 '18 at 23:42

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


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.

  • $\begingroup$ Why is it k! instead of k? $\endgroup$ – mtung Oct 28 '18 at 12:18
  • $\begingroup$ @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$. $\endgroup$ – Parcly Taxel Oct 28 '18 at 12:25
  • $\begingroup$ +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. $\endgroup$ – Taladris Oct 28 '18 at 13:21

Not the answer you're looking for? Browse other questions tagged or ask your own question.