Casey Chu

- The Dirichlet function in closed form
- My calculus teacher gave an example of a function that was discontinuous everywhere, the Dirichlet function. It indicates whether a number is rational or irrational: $D(x) = \begin{cases} 1 & \text{ if } x \in \mathbb{Q} \\ 0 & \text{ otherwise.} \end{cases}$
- That’s cool, but what’s even cooler is that there exists this expression for the Dirichlet function: $D(x) = \lim_{m \to \infty} \lim_{n \to \infty} [\cos(m!\, \pi x)]^{2n}.$
- Unfortunately, neither Wikipedia nor Wolfram’s web site explains why this is equivalent to the Dirichlet function, so I spent a long time thinking about it. Here’s what I’ve come up with.
- Let’s consider a simplified version first. Consider the function $f(x) = \cos^2\pi x$. It equals $1$ so long as $x$ is an integer, and a positive decimal less than $1$ otherwise. This is simple to see by graphing the function.
- Now, if you exponentiate the result an infinite number of times — i.e., $\lim_{n \to \infty} f(x)^n$ — you end up with two outcomes. If $x$ is an integer, then $f(x) = 1$, and $f(x)$ exponentiated infinitely will still equal $1$. If $x$ is not an integer, then $f(x) < 1$ and will therefore get smaller after every exponentiation, eventually hitting $0$. That is to say, the limit will equal $0$ for non-integers.
- We’ve basically created an indicator function for integers:$\mathrm{isInteger}(x) = \lim_{n \to \infty} (\cos\pi x)^{2n} = \begin{cases}1 & \text{ if } x \in \mathbb{Z} \\ 0 & \text{ otherwise.}\end{cases}$
- Now we can rewrite the Dirichlet function in terms of this $\mathrm{isInteger}$ function: $D(x) = \lim_{m \to \infty} \mathrm{isInteger}(m!\, x).$
- This is the especially cool part: we can show that if $x$ is rational, then $\lim_{m \to \infty} m!\, x$ is an integer. If we let $m$ approach $\infty$, then we have a product of all positive integers multiplied by the input $x$. If $x$ is rational, then $x$ can be written as a fraction of integers $\frac{p}{q}$ where $p$ and $q$ are integers. The $q$ will then cancel with one of the integers in the factorial, thus making the whole product $m!\, x$ an integer. In the other case — where $x$ is irrational — this won’t happen, and $m!\,x$ will not be an integer.
- Visually, for $m$ big enough, we have that $m!\, x = \frac{p}{\cancel{q}} \cdot (1 \cdots \cancel{q} \cdots m).$
- Now if we plug the either-integer-or-non-integer result into our $\mathrm{isInteger}$ function, what results is an indicator function for rationality — the Dirichlet function.