# Continuous function on $\mathbb{R}$ which is constant when $f(x)=f(x+1)=f(x+\pi)$

If $f$ is continuous on $\mathbb R$ and $f(x)=f(x+1)=f(x+\pi)$ all $x$ in $\mathbb R$ then $f$ is constant.

-
Hint: The subgroup $\mathbb{Z}+\pi\mathbb{Z}$ is dense in $\mathbb{R}$. – 1015 Jan 29 '13 at 2:37
@julien Make that an answer!!! – Pedro Tamaroff Jul 10 '13 at 4:15

By Dirichlet Theorem, the set

$$\{ m+ n \pi \mid m,n \in \mathbb Z \}$$

is dense in $\mathbb R$.

It is easy to show that $f(m+ n \pi)=f(0)$ for all $n,m \in \mathbb Z$, and using the definition of continuity and denseness mentioned above you can get that $f(x)=f(0)$ for all $x \in \mathbb R$.

-

Assume that $f$ is nonconstant. If it is nonconstant, continuous, and periodic, it must have a least positive period, $T$ (proof of this can be found here). If $f(x) = f(x+1)$ for all $x\in\mathbb{R}$, then $T=1/m$, where $m$ is a positive integer. Also, if $f(x) = f(x+\pi)$ for all $x\in\mathbb{R}$, then $T = \pi/n$, where $n$ is a positive integer. Since it cannot be that $1/m = \pi/n$, we have a contradiction, which then implies that $f$ cannot be nonconstant.

-
The fact that there are two periods does not imply that they are rationally proportional. – 1015 Jul 10 '13 at 2:04
If $1,\pi, a_2,a_3,\ldots$ be a basis of $\mathbb{R}$ as a $\mathbb{Q}$-vector space. Define $f(1)=f(\pi)=0$ and $f(a_i)=1$. Extend by linearity. This function is non-constant and has those periods. – Mlazhinka Shung Gronzalez LeWy Jul 10 '13 at 2:07
@julien There aren't two periods, there is one, which, by the hypothesis of the problem, is both rational and irrational. Hence the contradiction. – AnonSubmitter85 Jul 10 '13 at 3:55
@Franklin.vp How can a function have more than one period? – AnonSubmitter85 Jul 10 '13 at 3:57
@AnonSubmitter85 your mistake in the edited answer is in assuming that a function necessarily has a smallest period. Consider the function $f_{\mathbb{Q}}$ which is 1 on rationals and 0 on irrationals; then for all $n$, $f_{\mathbb{Q}}(x+\frac{1}{n}) = f_{\mathbb{Q}}(x)$, so $f_{\mathbb{Q}}$ has no smallest period. – Steven Stadnicki Jul 10 '13 at 4:16