This question stems from this one, where if $f$ is continuous and $f(x) = f(x+1) = f(x+\pi)$, then $f$ must be constant. The above is shown using the density of $\mathbb{Z}+\pi\mathbb{Z}$ in $\mathbb{R}$ and the continuity of $f$. However, what jumps out at me from the question is the (seeming) incongruity of a period that is both rational and irrational.
Specifically, if $f$ is non-constant and has a least positive period, $T$, then it cannot be that $f(x)=f(x+1)=f(x+\pi)$, since that would imply that $\pi$ is rational. But, as was pointed out to me, this cannot be used to prove the above because not every periodic function has a least positive period.
So my question is, what determines if a function has a least positive period? Are there certain classes of functions that, if periodic, must have a least positive period? For instance, continuous periodic functions?
Also, what other examples are there of non-constant periodic functions that do not have a least positive period? The example given to me (and the only one given on the Wikipedia page) is the indicator function of rational numbers.
Best Answer
For a given function $f$, consider the set $P = \{ p \in \mathbb{R} \mid \forall x \in \mathbb{R} : f(x+p) = f(x) \}$. Clearly $0 \in P$, and if $p, q \in P$ also $p - q \in P$. That means $P$ is a subgroup of the additive group of the real numbers. Several cases can arise
No other subgroups exist. To construct an arbitrary periodic function, you can take any nontrivial subgroup $P$ and define an arbitrary function on the quotient $\mathbb{R}/P$. This fixes the whole function, since it must be constant on every coset of $P$. In case 2 the quotient can be represented as the interval $[0, p)$; for case 4 this tends to be trickier, but a slightly more interesting example would be $$ f(x) = \begin{cases} p & \text{for}\, x = q + \sqrt{p},\; q \in \mathbb{Q}, p \,\text{prime}, \\ 0 & \text{otherwise}. \end{cases} $$