Motivated by this nice question I have been trying to compute the function $f: \mathbb{R}^+ \to \left[0,\frac{1}{2}\right]$ defined by

$$f(\alpha) = \lim_{x \to \infty} \frac{1}{x} \int \limits_0^x \lvert\sin(\alpha s) \cos(s)\rvert \, \mathrm{d} s \, .$$

Note that $f(\alpha) \leq \frac{1}{2}$ follows from the Cauchy-Schwarz inequality.

In the answers to the original question the equidistribution theorem is used to show that $f(3 - 2 \sqrt{2}) = \frac{4}{\pi^2}$ holds. This argument can be extended to every irrational number, so we have $f(\alpha) = \frac{4}{\pi^2} \approx 0.405285$ for any $\alpha \in \mathbb{R}^+ \setminus \mathbb{Q}^+$ .

For rational arguments we can take $m , n \in \mathbb{N}$ with $\gcd(m,n) =1$ . The change of variables $s = n t$ yields $$ f \left(\frac{m}{n}\right) = \lim_{x \to \infty} \frac{1}{x} \int \limits_0^x \lvert\sin(m t) \cos(n t)\rvert \, \mathrm{d} t \, .$$ The integrand is periodic with period $\pi$, so $$ f \left(\frac{m}{n}\right) = \lim_{x \to \infty} \frac{1}{x} \left[\bigg\lfloor \frac{x}{\pi} \bigg\rfloor \int \limits_0^\pi \lvert\sin(m t) \cos(n t)\rvert \, \mathrm{d} t + \mathcal{O} (1)\right] = \frac{1}{\pi} \int \limits_0^\pi \lvert\sin(m t) \cos(n t)\rvert \, \mathrm{d} t\, .$$

Now the idea is to split the interval of integration into subintervals on which the sign of the product is constant and then use $$ \sin(m t) \cos(n t) = \frac{\sin[(m+n)t] + \sin[(m-n)t]}{2}$$ to find the integrals. The result is basically given by a finite sum of cosines evaluated at the zeroes of the integrand.

The first few results are \begin{align} f(1) &= \frac{1}{\pi} \approx 0.318301 \, , \\ f(2) &= \frac{4}{3 \pi} \approx 0.424413 \, , \\ f\left(\frac{1}{2}\right) &= \frac{2(2\sqrt{2}-1)}{3\pi} \approx 0.388004 \, . \end{align} Interestingly, most of the other values (especially those with large $m$ and $n$) seem to be very close to $\frac{4}{\pi^2}$ .

This method can be used (at least in principle) to compute $f$ at every rational argument, but it becomes increasingly complicated for larger values of $m$ and $n$ . Maybe I am overlooking a simple trick, maybe there is a better method. My question is:

How can we find a general expression for $f\left(\frac{m}{n}\right)$ with arbitrary coprime $m,n \in \mathbb{N}$ ?

Edit 1 July 2020

Thanks to Zacky's bounty and River Li's and asgeige's nice answers we have some closed-form results for special cases and a promising (but still somewhat complicated) conjecture for the general case. Using similar methods, I have also found $$ f(m) = \frac{2}{\pi (m^2-1)} \left[m \csc \left(\frac{\pi}{2m}\right) \cos \left(\frac{\pi}{2m} 1_{2\mathbb{N}}(m)\right) - 1_{2 \mathbb{N}-1}(m)\right]$$ for $m \in \mathbb{N} \setminus \{1\}$ ($1_A$ is the indicator function of the set $A$), which implies $\lim_{m \to \infty} f(m) = \frac{4}{\pi^2}$. While a simple expression for general values of $m,n$ seems unlikely, it may be possible to show that $\lim_{n \to \infty} f \left(\frac{m}{n}\right) = \frac{4}{\pi^2}$ and $\lim_{m \to \infty} f \left(\frac{m}{n}\right) = \frac{4}{\pi^2}$ do indeed hold for fixed $m \in \mathbb{N}$ and $n \in \mathbb{N}$, respectively.

Edit 11 January 2021

Thanks to River Li's second answer we now have a proof of the conjectured limits. We can even use partial fractions and the pole expansions of $\csc$ and $\cot$ to simplify the remaining series and obtain the following general result (valid for $m, n \in \mathbb{N}$ coprime and not both equal to $1$): $$ f\left(\frac{m}{n}\right) = \frac{g_m\left(\frac{\pi}{2m}\right) - g_m \left(\frac{\pi}{2n}\right)}{m^2-n^2} \, , \, g_m = \begin{cases} x \mapsto \frac{\csc(x)}{x} &, \, m \in 2 \mathbb{N} - 1 \\ x \mapsto \frac{\cot(x)}{x} &, \, m \in 2 \mathbb{N}\end{cases} \, . $$

  • 2
    $\begingroup$ Finding a closed form seems a bit unlikely, of course I will be happy to be proven wrong, but I would also gladly give the bounty to an answer that shows significant progress such as finding a closed form when $n$ or $m$ is fixed (e.g. $n=1$ and $m\in \mathbb N$), or for proving "OP's conjecture" that for large $m$ and $n$ the result tends indeed to $\frac{4}{\pi^2}$, or other stuff. $\endgroup$
    – Zacky
    Commented May 2, 2020 at 18:12
  • 1
    $\begingroup$ Quick comment: have you already tried to obtain a Fourier series of $sgn(\cos(nt))sgn(\sin(mt))$? Perhaps the convolution theorem would be useful, since the coefficients for those square waves are well known. $\endgroup$ Commented May 9, 2020 at 12:47
  • $\begingroup$ The OP's final result is very nice! I have not thought it has a simple closed form. $\endgroup$
    – River Li
    Commented Jan 13, 2021 at 11:16

3 Answers 3


Case $m = 1$

By using Maple, we have \begin{align} f(\tfrac{1}{n}) &= \frac{1}{\pi}\int_0^\pi |\sin t \cos (nt)| \mathrm{d} t\\ &= \frac{2(n - \sin \tfrac{\pi}{2n})}{(n^2-1)\pi \sin \tfrac{\pi}{2n}}. \end{align} We have $$\lim_{n\to \infty} f(\tfrac{1}{n}) = \frac{4}{\pi^2}.$$

Case $m=2$, and $n$ odd

By using Maple, we have \begin{align} f(\tfrac{2}{n}) &= \frac{1}{\pi}\int_0^\pi |\sin 2t \cos (nt)| \mathrm{d} t\\ &= \frac{2(n \cos \frac{\pi}{2n}-2\sin \frac{\pi}{2n} )}{(n^2-4)\pi \sin \frac{\pi}{2n}}. \end{align} We have $$\lim_{n\to \infty} f(\tfrac{2}{n}) = \frac{4}{\pi^2}.$$

General Case $m \ne n$

Based on the results for $m=1, 2, 3, 4, \cdots$ by Maple, after simplification and observation, I $\color{blue}{\textrm{GUESS}}$ that, for $m, n \ge 1$ and $m\ne n$, \begin{align} &\int_0^\pi |\sin (mt) \cos (nt)| \mathrm{d} t \\ =\ & \frac{2n}{n^2-m^2} \left(\sum_{s=0}^{\lfloor \frac{n}{2} + \frac{3}{4}\rfloor - 1} \left|\sin \frac{m\pi (1 + 4s)}{2n}\right| + \sum_{s=0}^{\lfloor \frac{n}{2} + \frac{1}{4} \rfloor - 1} \left|\sin \frac{m\pi (3 + 4s)}{2n}\right|\right)\\ &\quad - \frac{2m}{n^2-m^2}\sum_{s=0}^{m-1} \left|\cos \frac{s\pi n}{m}\right| \end{align} where $\lfloor x \rfloor$ is the floor function.

Remarks: 1. I have done numerical experiments $1\le m, n \le 10$ and more.

  1. Rigorous and step-by-step proofs are expected.

  2. Further simplification may be possible.

  • 4
    $\begingroup$ This might be more appropriate as a comment. $\endgroup$
    – Integrand
    Commented May 6, 2020 at 16:32
  • 6
    $\begingroup$ @Integrand I am trying to calculate $m=2$ and more. I believe all these are too long for a comment. $\endgroup$
    – River Li
    Commented May 7, 2020 at 0:46
  • 1
    $\begingroup$ i proved the first two of your results. $\endgroup$
    – asgeige
    Commented May 12, 2020 at 19:26
  • 1
    $\begingroup$ @asgeige Very nice. $m=1$ is easy even by hand. The general case may be not easy. $\endgroup$
    – River Li
    Commented May 12, 2020 at 23:26


$$f_{m,n}(x)=\sin(mx)\cos(nx)\\ \pi I_{m,n}=\int_0^{\pi}dx |f_{m,n}(x)|\\ \mathcal{I}_{m,n,k}=\int_{\frac{\pi (2k-1)}{2n}}^{\frac{\pi (2k+1)}{2n}}f_{m,n}(x)dx\\ \mathcal{I}_{m,n,0}=\int_0^{\pi/(2n)}f_{m,n}(x)dx\\ \mathcal{I}_{m,n,n}=\int^{\pi}_{\pi-\pi/(2n)}f_{m,n}(x)dx $$

Lemma 1:

$$ \int dt \cos(nt)\sin(mt)=\frac{1}{n^2-m^2}(m\sin(nt)\sin(mt)+n\cos(nt)\cos(mt)) $$

Proof: direct differentation

Partial results I: $m=1$, $n \in \mathbb{N}$.

Define $$ I_{1,n}=I_{n}\\ f_{1,n}(x)=f_{n}(x)\\ \mathcal{I_{k,n}}=\mathcal{I_{1,k,n}} $$ Now,we can split the integral as follows: $$ \pi I_n= \mathcal{I}_{n,0}+\sum_{k=1}^{n-1} (-1)^k \mathcal{I}_{n,k}+(-1)^n\mathcal{I}_{n,n}\quad(\star) $$

By Lemma 1, we have by taking into account that $k,n \in \mathbb{N}$ that $$ \mathcal{I}_{n,k}=(-1)^k\sin(k \pi/2n)\frac{2n \cos(\pi/2n)}{n^2-1}\\ \mathcal{I}_{n,0}=\frac{-1+n \sin(\pi/2n)}{n^2-1}\\ \mathcal{I}_{n,n}=(-1)^n\mathcal{I}_{n,0} $$

Using $\Im(e^{ix})=\sin(x)$ together with the finite geometric series we easily obtain:

$$ \sum_{k=1}^{n-1} (-1)^k \mathcal{I}_{n,k}=\cot(\pi/2n)\frac{2n \cos(\pi/2n)}{n^2-1} $$

so from $(\star)$ we have

$$ \pi I_n= \frac{2}{n^2-1}\left(\frac{n}{\sin(\pi/2n)}-1\right) $$

The limit $n \rightarrow \infty$ is now easily obtained:

$$ I_{\infty}=\frac{4}{\pi^2} $$ as conjectured.

Partial results II: $m=2$, $n \in 2\mathbb{N}+1$.

Since $\sin(2x)$ and $\cos(nx)$ have both a nice symmetry point (both change sign simultaniously in the same direction) at $x=\frac{\pi}2$ we can split the integral in this case as follows:

$$ \pi I_{2,n}= 2(\mathcal{I}_{2,n,0}+\sum_{k=1}^{\lfloor{n/2}\rfloor} (-1)^k \mathcal{I}_{2,n,k})\quad(\star \star) $$

we, again by Lemma 1, have:

$$ \mathcal{I}_{2,n,k}=(-1)^k\sin(2 k \pi/n)\frac{2n \cos(\pi/n)}{n^2-4}\\ \mathcal{I}_{2,n,0}=\frac{-2+n \sin(\pi/n)}{n^2-4}\\ $$

Using once again $\Im(e^{ix})=\sin(x)$ together with the finite geometric series we easily obtain:

$$ \sum_{k=1}^{\lfloor{n/2}\rfloor} (-1)^k \mathcal{I}_{2,n,k}=\frac{\cot(\pi/2n)}{2}\frac{2n \cos(\pi/n)}{n^2-4} $$

merging everything in $(\star \star)$ we get (after some trig-manipulations)

$$ \pi I_{2,n}= \frac{2}{n^2-4}\left(n\cot(\pi/2n)-2\right) $$

Taking the limit of $n\rightarrow\infty$ we get, since $\cot(y)\sim_{0_+} 1/y$

$$ I_{2,\infty}=\frac{4}{\pi^2} $$ as expected.

More tomorrow


Assume that $m\ge 1, n\ge 1$, $m\ne n$ and $\mathrm{gcd}(m, n) = 1$.

By the identity $$\left|\sin x\right| = \frac{2}{\pi}-\sum_{k = 1}^\infty \frac{4}{\pi(4k^2-1)}\cos(2k x),$$ we have $$|\sin mt | = \frac{2}{\pi}-\sum_{i = 1}^\infty \frac{4}{\pi(4i^2-1)}\cos(2i mt)$$ and $$|\cos nt| = |\sin (\pi/2 - nt)| = \frac{2}{\pi}-\sum_{j = 1}^\infty \frac{4}{\pi(4j^2-1)}(-1)^j \cos(2jnt).$$ Then we have \begin{align} |\sin (mt) \cos (nt)| &= \frac{4}{\pi^2} - \frac{2}{\pi}\sum_{i = 1}^\infty \frac{4}{\pi(4i^2-1)}\cos(2i mt)\\ &\quad - \frac{2}{\pi}\sum_{j = 1}^\infty \frac{4}{\pi(4j^2-1)}(-1)^j \cos(2jnt)\\ &\quad + \sum_{i = 1}^\infty \sum_{j = 1}^\infty \frac{16(-1)^j}{\pi^2(4i^2-1)(4j^2-1)}\cos(2i mt)\cos(2jnt). \end{align} Note that $$\int_0^\pi \cos(2i mt)\cos(2jnt) \mathrm{d} t = \left\{\begin{array}{ll} 0 & im - jn \ne 0 \\[4pt] \frac{\pi}{2} & im - jn = 0. \end{array} \right.$$ Then we have \begin{align} \frac{1}{\pi}\int_0^\pi |\sin (mt) \cos (nt)| \mathrm{d} t &= \frac{4}{\pi^2} + \sum_{i = 1}^\infty \sum_{j = 1}^\infty \frac{8(-1)^j}{\pi^2 (4i^2-1)(4j^2-1)}\delta(i m - jn)\\ &= \frac{4}{\pi^2} + \sum_{k=1}^\infty \frac{8(-1)^{km}}{\pi^2 (4k^2n^2-1)(4k^2m^2-1)}\\ &= \frac{4}{\pi^2} + \frac{1}{m^2n^2}\sum_{k=1}^\infty \frac{8(-1)^{km}}{\pi^2 (4k^2-1/n^2)(4k^2-1/m^2)}. \end{align} Note that $$\left|\sum_{k=1}^\infty \frac{8(-1)^{km}}{\pi^2 (4k^2-1/n^2)(4k^2-1/m^2)} \right| \le \sum_{k=1}^\infty \frac{8}{\pi^2 (4k^2-1)(4k^2-1)} = \frac{\pi^2 - 8}{2\pi^2}.$$ Thus, we have $$\lim_{\max(m, n) \to \infty} \frac{1}{\pi}\int_0^\pi |\sin (mt) \cos (nt)| \mathrm{d} t = \frac{4}{\pi^2}.$$


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .