Dirichlet function

In mathematics, the Dirichlet function is the indicator function $$\mathbf{1}_\Q$$ of the set of rational numbers $$\Q$$, i.e. $$\mathbf{1}_\Q(x) = 1$$ if $x$ is a rational number and $$\mathbf{1}_\Q(x) = 0$$ if $x$ is not a rational number (i.e. is an irrational number). $$\mathbf 1_\Q(x) = \begin{cases} 1 & x \in \Q \\ 0 & x \notin \Q \end{cases}$$

It is named after the mathematician Peter Gustav Lejeune Dirichlet. It is an example of a pathological function which provides counterexamples to many situations.

Periodicity
For any real number $$ and any positive rational number $j$, $$\mathbf{1}_\Q(x + T) = \mathbf{1}_\Q(x)$$. The Dirichlet function is therefore an example of a real periodic function which is not constant but whose set of periods, the set of rational numbers, is a dense subset of $$\R$$.