# Piecewise constant functions with zero average

Consider $0=t_0\leq t_1\leq...\leq t_n=1$, $f_0,...,f_{n-1}\in\mathbb{Z}$ and $F:[0,1]\to\mathbb{R}$ be such that

1) $F\equiv f_i$ on the interval $(t_i,t_{t+1})$, for all $i=0,...,n-1$,

2) $\displaystyle \int_0^1 F(t) dt=\sum_{i=0}^{n-1}(t_{i+1}-t_i)f_i=0$.

Does there exist an arbitrarily large prime number $p$ and a positive integer $k=k(p)$ such that $q:=p^k$ satisfies

$\displaystyle \sum_{i=1}^{q-1} F\left(\frac{i}{q}\right)=0$ ?

I know that the answer is YES when all the $t_j$'s are rational number: if $t_j=\frac{p_j}{q_j}$, then it suffices to choose $q\equiv 1$ mod $\mathrm{lcm}(q_1,...,q_{n-1})$.

Any idea for the general case?

-
Are the two $n$'s in your problem the same? –  Alan Haynes Dec 2 '11 at 16:30
Sorry, that was a typo. –  Marco Mazzucchelli Dec 2 '11 at 16:32
Is it known whether there are infinitely many integers $m$ such that $\sum_{i=1}^{m-1} F(i/m) = 0$? –  Greg Martin Dec 2 '11 at 19:55
@Greg It's not known to me. I would be happy with that already. –  Marco Mazzucchelli Dec 2 '11 at 22:25
@GH: I think you might be able to improve your proof to the case where q is prime, using results about equidistribution of primes. The Theorem of Green-Tao quoted in these lecture notes looks like it should do the job, but I haven't checked the original reference yet, austms.org.au/tiki-download_file.php?fileId=162 (Horocycle Flow at Prime Times) –  George Lowther Dec 3 '11 at 2:24

Thanks to the comments of George Lowther and Greg Martin (for which I am most grateful), I can now show that the answer is YES for infinitely many primes $q$.

Theorem 1. Let $t_1\dots,t_{n-1}$ be any finite set of real numbers.Then for any $\epsilon>0$ and any integer $r>0$ there are infinitely many primes $q\equiv 1\pmod{r}$ such that $$\|(q-1)t_i\|<\epsilon,\qquad i=1,\dots,n-1.\tag{1}$$ Here $\|x\|$ stands for the distance of $x$ to the nearest integer.

Proof. Without loss of generality, the numbers $1,t_1,\dots,t_{n-1}$ are linearly independent over $\mathbb{Q}$. Indeed, we can express each of them as a $\mathbb{Z}$-linear combination from a suitable basis $\frac{1}{s},t_1^*,\dots,t_{m-1}^*$ of their $\mathbb{Q}$-linear span, where $s>0$ is an integer. Then the statement for $t_1,\dots,t_{n-1}$ follows from the statement for $t_1^*,\dots,t_{m-1}^*$ (with $\mathrm{lcm}(r,s)$ in place of $r$). When the elements of $1,t_1,\dots,t_{n-1}$ are linearly independent over $\mathbb{Q}$, the statement follows from the stronger result that the vectors $(qt_1,\dots,qt_{n-1})$ are dense modulo $1$, as $q$ runs through the primes such that $q\equiv 1\pmod{r}$. This result is essentially due to Vinogradov, with technical improvements by Vaughan and Harman. See Theorem 4 in Harman: Diophantine approximation with primes, J. London Math. Soc. (2) 39 (1989), 405–413. Well, Harman does not have the condition $q\equiv 1\pmod{r}$, but it seems straightforward to incorporate it.

Theorem 2. Let $t_i$, $f_i$, $F$ be as in the original question but without the assumption $f_i\in\mathbb{Z}$. Then for any $\epsilon>0$ there is a prime $q$ such that $$\left|\sum_{j=1}^{q-1}F\left(\frac{j}{q}\right)\right|< \epsilon.$$ In particular, if $F$ is integer valued and $\epsilon=1$, then the left hand side is zero.

Proof. Assume that $\epsilon>0$ is sufficiently small, namely $$\epsilon<\|t_i\|,\qquad i=1,\dots,n-1.\tag{2}$$ By Theorem 1, there is a prime $q$ such that (1) holds. Observe that $$\sum_{j=1}^{q-1}F\left(\frac{j}{q}\right)=\sum_{i=0}^{n-2}f_i\bigl([qt_{i+1}]-[qt_i]\bigr)+f_{n-1}\bigl(q-1-[qt_{n-1}]\bigr),$$ where $[x]$ stands for the integral part of $x$. Here we used that no $\frac{j}{q}$ coincides with any $t_i$, as follows from (1) and (2). We subtract $$0=(q-1)\int_0^1 F(t)dt=\sum_{i=0}^{n-1}f_i\bigl((q-1)t_{i+1}-(q-1)t_i\bigr),$$ then with the notation $$\tilde t_i:=[qt_i]-(q-1)t_i,\qquad i=0,\dots,n-1,$$ we get $$\sum_{j=1}^{q-1}F\left(\frac{j}{q}\right)=\sum_{i=0}^{n-2}f_i\bigl(\tilde t_{i+1}-\tilde t_i\bigr)-f_{n-1}\tilde t_{n-1}=\sum_{i=1}^{n-1}(f_{i-1}-f_i)\tilde t_i.$$ By (1) we can write $(q-1)t_i=n_i+e_i$ with $n_i\in\mathbb{Z}$ and $|e_i|<\epsilon$. Then $$qt_i = n_i+t_i+e_i,\qquad i=1,\dots,n-1,$$ whence by (2), that is by $\epsilon<\min(t_1,1-t_{n-1})$, we have $[qt_i]=n_i$, so that $\tilde t_i=-e_i$. It follows that $$\sum_{j=1}^{q-1}F\left(\frac{j}{q}\right)=\sum_{i=1}^{n-1}(f_i-f_{i-1})e_i,$$ whence $$\left|\sum_{j=1}^{q-1}F\left(\frac{j}{q}\right)\right|<\epsilon\sum_{i=1}^{n-1}|f_i-f_{i-1}|.$$ The right hand side can be made arbitrary small, so we are done.

-
Nice job GH. I think it follows from general exponential sum techniques that there are infinitely many primes $p=q-1$ that satisfy (2). (One probably gets an asymptotic formula even, although the constant will depend upon the linear relations among the $t_i$ in a perhaps complicated way.) –  Greg Martin Dec 3 '11 at 5:31
@George: You are right, George Lowther made a similar comment below. I will update my answer in a moment. Thank you. –  GH from MO Dec 3 '11 at 6:33
Thanks a lot GH!!! In Hamiltonian dynamics, this theorem should implies the following: if the average Maslov index of an orbit $\gamma$ is zero, then for infinitely many prime numbers $p$ the $p$-iteration of the orbit gamma has the same Maslov index as $\gamma$. Maybe one may get something useful out of this... –  Marco Mazzucchelli Dec 4 '11 at 4:41
@Marco: Sounds interesting, although I am not familiar with this theory. I am glad I could help! –  GH from MO Dec 4 '11 at 4:57