intuition behind the definition of Dirichlet function

83 Views Asked by At

I've seen two definitions of Dirichlet function which are as follows: $$f(x)=\begin{cases} 0 &\text{ if } x\text{ is irrational }\\ 1 &\text{ if } x \text{ is rational.}\end{cases}$$

and the second one :

$$\lim_{k \to \ \infty }(\lim_{j \to \ \infty }cos(k!\pi x)^{2j})$$

for integers $k,j$

why such a simple function can be shown as double limit and why should I expect a simple $0$ or $1$ to be the answers of the given limit? I know some properties of Dirichlet function, for example I know it's not Riemann integrable or it does not have any limit, but I have no idea about the second definiton and up to now could't find any reason for that, what is the motivation behind that and how it can be "fully" derived?