prove a function to be constant Let the function $f\colon \mathbb{R} \to\mathbb{R}$ have arbitrarily small positive periods, in the sense that if $\delta>0$ then there exists $T \in (0,\delta)$ such that $f(t + T) = f(t)$ for all $t \in \mathbb{R}$.
(i) Prove that if $f$ is continuous then $f$ is constant.
(ii) What if $f$ is not assumed to be continuous?
 A: (ii) is answered by $f(x)=\mathbf 1_\mathbb Q(x)=\begin{cases}1&x\in\mathbb Q\\0&x\notin\mathbb Q\end{cases}$.
(i) Let $x\in\mathbb R$ be arbitrary.
Let $\epsilon>0$ be given.
There exists a $\delta>0$ such that $|f(y)-f(x)|<\epsilon$ if $|y-x|<\delta$. Let $T\in(0,\delta)$ be a period.
Then $f(nT)=f(0)$ for all $n\in \mathbb Z$ (by induction on $n$).
Let $n=\left\lfloor\frac xT\right\rfloor$. 
Then $nT\le b<(n+1)T$ and hence $|b-nT|<T<\delta$.
We conclude $|f(x)-f(0)|=|f(x)-f(nT)|<\epsilon$.
Since $\epsilon$ was arbitrary, $f(x)=f(0)$.
Since $x$ were arbitrary, $f$ is constant.
A: (i) For each $n$, there is $0<T_n<n^{—1}$ such that $f(x+T_n)=f(x)$ for $x\in \Bbb R$. We can show that $f$ is uniformly continuous on $[0,T_n]$. So fix $\varepsilon>0$, and $n$ such that if  $x\in [0,T_n]$, then $|f(x)-f(0)|<\varepsilon$. Let $x\in \Bbb R$. Write it as $N_nT_n+c_n$, where $N_n$ is an integer and $c_n\in (0,T_n)$. Then 
$$|f(x)-f(0)|=|f(c_n)-f(0)|\leqslant \varepsilon.$$
As it's true for all $x$ and all $\varepsilon$ we get that $f(x)=f(0)$ for all $x\in\Bbb R$. 
(ii) A counter-example is the characteristic function of rational numbers.
A: Let $\Delta = \{\tau | f(0) = f(\tau)\}$. By assumption, there exists a sequence $T_i \downarrow 0$ such that $f$ is $T_i$-periodic. Hence $\{kT_i\}_{k \in \mathbb{Z}} \subset \Delta$ for all $i$. It follows from this that $\Delta$ is dense.
If $f$ is not continuous, then $1_\mathbb{Q}$ shows $f$ need not be constant.
If $f$ is continuous, then $\Delta$ is closed (and dense), hence $\Delta = \mathbb{R}$.
