Solution (source code)

= Solution

For a chord of length $1/2$, consider the <continuous function> $h(x)=f(x+1/2)-f(x)$ on $[0,1/2]$. Since $f(0)=f(1)$,
$$
h(1/2)=f(1)-f(1/2)=-h(0).
$$
An endpoint zero already supplies the chord. Otherwise the endpoint values have opposite signs, so the <intermediate value theorem> supplies $h(\alpha)=0$ at some $\alpha\in(0,1/2)$. Thus \b[a horizontal chord of length $1/2$ exists].

For each integer $n>1$, define $h_n(x)=f(x+1/n)-f(x)$ on $[0,1-1/n]$. The sampled differences telescope:
$$
\sum_{j=0}^{n-1}h_n(j/n)=\sum_{j=0}^{n-1}\bigl(f((j+1)/n)-f(j/n)\bigr)=f(1)-f(0)=0.
$$
If any sampled value is zero, it gives the required chord. Otherwise there must be both a positive and a negative sampled value. The <intermediate value theorem>, applied between their sample points, then gives $h_n(\alpha)=0$. Hence \b[a horizontal chord of length $1/n$ exists for every positive integer $n$]; for $n=1$, the endpoint chord itself suffices. This proves the <horizontal chord of reciprocal-integer length> result, without restricting $n$ to powers of two.