Given
$$\tilde{f}(x)=-\sum_{n\geq 1}\frac{\sin(2\pi n)}{\pi n}=\{x\}-\frac{1}{2}$$
let us define $v_n(x)=f(nx)$ and
$$ w_n(x) = 2 v_{2n}(x) - 4 v_{n}(x).\tag{1} $$
We have that $w_n$ is a square wave with period $\frac{1}{2n}$ oscillating between $1$ and $-1$.
These functions fulfill the almost-orthogonality relation
$$ \langle w_m, w_n \rangle = \int_{0}^{1}w_m(x)w_n(x)\,dx =\left\{\begin{array}{rcl}\frac{\gcd(m,n)^2}{mn}&\text{if}&\frac{m}{\gcd(m,n)}-\frac{n}{\gcd(m,n)}\equiv 0\pmod{2}\\0&\text{if}&\frac{m}{\gcd(m,n)}-\frac{n}{\gcd(m,n)}\equiv 1\pmod{2}\end{array}\right.\tag{2}$$
so the Gram-Schidt process applied to $w_1,w_2,w_3,\ldots$ produces a complete orthonormal base for $L^2(0,1)\cap\{f:f(x)=-f(1-x)\}$.
In order to prove it is enough to compute the squared distance of $g(x)=\sin(2\pi x)$ from the span of $w_1,\ldots,w_N$ through ratios of determinants of Gram matrices, then show that such distance converges to $0$ as $N\to +\infty$. This should not be too hard since $G(w_1,\ldots,w_N)$ is just a small perturbation of the identity matrix. If needed we may replace $g(x)$ with the shifted Legendre polynomial $P_{2M+1}(2x-1)$.
We need an upper bound for $\left|\det G(g,v_1,\ldots,v_N)\right|$ and a lower bound for $\left|\det G(v_1,\ldots,v_N)\right|$. The former can be obtained by considering the product of the $L^2$ norms of the columns, the latter from Gershgorin circle theorem.
Althought this approach requires some pretty heavy computations. We may also consider that
$$\widehat{g}(s)=(\mathcal{L}g)(s)=\frac{2\pi}{4\pi^2+s^2},\qquad \widehat{w}_k(s)=(\mathcal{L}w_k)(s)=\frac{1}{s}\tanh\left(\frac{s}{4k}\right)=\sum_{n\geq 0}\frac{4k}{k^2(2n+1)^2 \pi^2+s^2} \tag{3}$$
and expand them as power series of $\frac{1}{s}$, getting
$$\widehat{g}(s)=\sum_{n\geq 1}\frac{(2\pi)^{2n+1}(-1)^{n+1}}{s^{2n}},\qquad \widehat{w}_k(s)=\frac{1}{4k}-\frac{2}{\pi}\sum_{n\geq 1}\frac{\zeta(2n)(4k)^{2n-1}(-1)^n}{\pi^{2n-1} s^{2n}}.\tag{4}$$
Proving that $\widehat{g}$ is arbitrarily well approximated by a linear combination of $\widehat{w}_1,\ldots,\widehat{w}_N$ still requires to bound the norm of the inverse of a linear operator, but in the context the direct operator is more clearly structured with respect to $(2)$. If we replace $\zeta(2n)$ with $1$ in the RHS of $(4)$ we get
$$\widehat{W_k}(x)=\frac{1}{4k}-\frac{2}{\pi}\sum_{n\geq 1}\frac{(4k)^{2n-1}(-1)^n}{\pi^{2n-1} s^{2n}}=\frac{1}{4k}+\frac{8k}{\pi^2 s^2+16k^2}$$
$$ W_k(x)=\left(\mathcal{L}^{-1}\widehat{W_k}\right)(x) = \frac{\delta(x)}{4k}+\frac{2}{\pi}\sin\left(\frac{4k x}{\pi}\right)\tag{5}$$
and the subspace generated by $kW_k-(k+1)W_{k+1}$ is clearly dense in $L^2_{\text{odd}}(0,1)$.
The last step is to lift the convergence in $L^2$ to a convergence in $L^{\infty}$, which can be done by a standard trick. For any $f\in C^{0}_{\text{odd}}[0,1]$ there exists a $f_{\varepsilon}\in C^{2}_{\text{odd}}(0,1)$ such that $\|f-f_{\varepsilon}\|\leq\varepsilon$: it is enough to consider the convolution between $f$ and a suitable kernel (for instance, Jackson's kernel). By the Weierstrass approximation theorem $f'_{\varepsilon}$ can be uniformly approximated by a sequence of polynomials, so there is some even $p_N(x)$ with degree $N$ such that $\|p_N(x)-f'_\varepsilon\|\leq\varepsilon$. If $p_N(x)=a_N x^N+\ldots a_1 x +a_0$ we consider approximations $x^{N+1}_{\text{app}},x^N_{\text{app}},x_{\text{app}},1_{\text{app}}$ in the $L^2$ norm of (the odd parts of) $x^{N+1},x^N,\ldots,x,1$, then take
$$ f_{\text{app}}(x) = \frac{a_{N}}{N+1} x^{N+1}_{\text{app}}+\frac{a_{N-1}}{N} x^{N}_{\text{app}} +\ldots + a_0 x^{1}_{\text{app}}.\tag{6}$$
In simpler terms, if we are able to uniformly approximate $f'$ in the $L^2$ norm we are also able to approximate $f$ in the uniform norm, since
$$ \left\|f-f_{\text{app}}\right\|_{\infty}=\sup_{x\in(0,1)}\left|\int_{1/2}^{x}(f'-f'_{\text{app}})\,dx\right| \stackrel{\text{CS}}{\leq}\|f'-f'_{\text{app}}\|_2. $$
In order to avoid even-ness/odd-ness issues we may also approximate $f''$ in the $L^2$ norm, then "integrate it twice" (more precisely, suitably change the coefficients of $(6)$) to get a uniform approximation of $f$.
Now I am wondering if $(3)$ and Moebius inversion formula allow us to find explicit coefficients $c_k$ such that $\widehat{g}\stackrel{L^2}{=}\sum_{k\geq 1}c_k \widehat{w}_k$. The residues of $\widehat{g}$ at $\pm 2\pi i$ equal $\mp\frac{i}{2}$. For any odd positive integer $d$, the residues of $\widehat{w_k}$ at $\pm kd\cdot 2\pi i$ equal $\mp \frac{2i}{d\pi}$. By considering only the poles in the upper-half plane, the identity $\widehat{g}=\sum_{k\geq 1}c_k \widehat{w}_k$ gives $c_1=\frac{\pi}{4}$ and for any integer $M>1$
$$0=\text{Res}\left(\widehat{g}(s),s=2M\pi i\right)=-\frac{2i}{\pi}\sum_{\substack{d\text{ odd}\\d\mid M}}\frac{c_{M/d}}{d}$$
hence by Moebius inversion we get the $L^2$-version of Davenport's identity
$$\sum_{n\geq 1}\frac{\mu(n)}{n}\psi(nx)\stackrel{L^2}{=}-\frac{1}{\pi}\sin(2\pi x)$$
which finishes the proof. And yes, the convergence is pretty slow, since the partial sums of $\mu$, even assuming $RH$, can grow as large as $\sqrt{N}\log(N)$. Neverthess the LHS is pointwise convergent by summation by parts (to some function which is bounded, but not necessarily continuous) and equality holds in $L^2$, so we are able to lift the approximation as described in the previous paragraph (actual polynomials or trigonometric polynomials do not make much of a difference).
A highly non-trivial corollary is that $\det G(v_1,\ldots v_N)$ has a closed form in terms of the tail of the series giving a $L$-function evaluated at $s=2$, greatly improving the lower bound given by Gershgorin theorem.
Another interesting observation is that $\frac{1}{2} f(2n) - f(nx)$ equals $c_n \operatorname{sgn}(\sin(nx))$, but I have no idea what to do with that.
– Daniel Smania Jul 29 '25 at 02:01