Q:

Writing the Dirichlet function analytically

The Dirichlet function is usually defined as being $1$ when $x  \in \mathbb{Q}$ and $0$ elsewhere. In my textbook there is another characterization of the Dirichlet function which is 
$$\operatorname{dir}(x)= \lim_{m\to\infty}(\lim_{n\to\infty} (\cos(m!\pi x)^{2n})).$$
My question is, how do we get this? It seems so weird for something that seems special, can anyone give me a hint?

A:

Suppose that $x\not\in\mathbb Q$ and that $m\in\mathbb N$. Then $m!x\notin\mathbb Q$ and therefore $\cos(m!\pi x)\in(-1,1)$. So, $\lim_{n\to\infty}\cos(m!\pi x)^{2n}=0$. Can you take it from here?

