[Math] Prove that the Dirichlet function is a periodic function with no definite period

calculusfunctional-analysisfunctionsperiodic functions

Prove that the Dirichlet function $f$ below is a periodic function with no definite period.
$$f(x)=\begin{cases}1 ,& x \,\ \text{is rational} \\ 0 ,& x \,\ \text{is irrational}\end{cases}$$

My attempt: A function is periodic with period $T$ if $f(x+T)=f(x)$. But this does not hold in case of this function. Moreover, I can intuitively state that the question statement is true, since the function assumes $1$ at random intervals and also $0$ at random intervals. But I cannot find any rigorous mathematical approach to prove this case.

Can anyone help? By the way, is the question logical, keeping rigorous mathematics in mind?

Best Answer

Hint: show that $f$ is periodic for each rational period $T$, i.e., for $T \in \mathbb{Q}$.