How to evaluate the following integral? $$ \int_0^\infty (-1)^{ \lfloor x \sin x \rfloor } dx$$

I have no idea how to calculate this improper integral. Maybe I have to use some property of floor functions to reduce $ (-1)^{ \lfloor x \sin x \rfloor } $ to something simpler I can work with, but I don't know what property.
Thanks in advance for help!

Edit: I reached the following,
For every $ k \in \mathbb{Z_+} $ we have that $ \int_0^{\pi \cdot (k+1)} (-1)^{ \lfloor x \sin x \rfloor } dx = \sum_{m=0}^k \int_{\pi \cdot m}^{ \pi \cdot (m+1)} (-1)^{ \lfloor x \sin x \rfloor } = \{ x = t + \pi \cdot m , dx = dt \} = \sum_{m=0}^k \int_{0}^{ \pi} (-1)^{ \lfloor ( t+\pi \cdot m)\cdot( \sin(t+\pi \cdot m) ) \rfloor } dt = \sum_{m=0}^k \int_{0}^{ \pi} (-1)^{ \lfloor ( t+\pi \cdot m)\cdot( \sin(\pi \cdot m )\cos(t) + \sin(t)\cos(\pi \cdot m) ) \rfloor } dt = \sum_{m=0}^k \int_{0}^{ \pi} (-1)^{ \lfloor ( t+\pi \cdot m)\cdot (-1)^m \cdot \sin(t) \rfloor } dt $ .
If I can get a formula for the last integral from $ 0 $ to $ \pi $ I'll have an answer whether the integral from $ 0 $ to $ \infty $ converges or not.

  • 2
    $\begingroup$ Decompose $(0,\infty)$ into sets $E_k = \{x > 0 : k \le x \sin x < k+1\}$ with $k \in \mathbb Z$. $\endgroup$
    – GEdgar
    Nov 5, 2021 at 15:46
  • $\begingroup$ Will that imply that $ { \int_{ x \in E_k,k\in \mathbb{Z_{odd}} } (-1)^k + \int_{ x \in E_k,k\in \mathbb{Z_{even}} } (-1)^k } \xrightarrow[k \to \infty]{} 0? $ $\endgroup$ Nov 5, 2021 at 16:04
  • $\begingroup$ It is not obvious, so (if true) it would require work. $\endgroup$
    – GEdgar
    Nov 5, 2021 at 16:49
  • 2
    $\begingroup$ The integral fails the alternating series test if you break the interval up into $\pi$ long intervals and integrate to get coefficients. It diverges. $\endgroup$ Nov 5, 2021 at 16:58
  • 2
    $\begingroup$ You can also split up $$(-1)^{\lfloor x\sin(x)\rfloor}=\cos(\pi\lfloor x\sin)x)\rfloor)+ i\sin(\pi\lfloor x\sin)x)\rfloor) $$ which kind of resembles this function, but there are better methods. $\endgroup$ Nov 7, 2021 at 19:12

2 Answers 2


(Too long for a comment)

1. Using the Fourier series

$$ (-1)^{\lfloor x \rfloor} = \frac{4}{\pi} \sum_{k=1,3,5,\ldots} \frac{\sin(k\pi x)}{k} \quad\text{for } x \in \mathbb{R}\setminus\mathbb{Z} $$

that converges uniformly over any compact subset of $\mathbb{R}\setminus\mathbb{Z}$,

it follows that

\begin{align*} \int_{0}^{R} (-1)^{\lfloor x\sin x\rfloor} \, \mathrm{d}x &= \frac{4}{\pi} \sum_{k=1,3,5,\ldots} \frac{1}{k} \int_{0}^{R} \sin(k \pi x\sin x) \, \mathrm{d}x \\ &= \frac{4}{\pi} \sum_{k=1,3,5,\ldots} \frac{1}{k^2} \int_{0}^{kR} \sin(\pi x\sin (x/k)) \, \mathrm{d}x \end{align*}

I suspect that the following holds:

$$ \sum_{k=1,3,5,\ldots} \frac{1}{k^2} \sup_{R \geq 0} \left| \int_{0}^{kR} \sin(\pi x\sin (x/k)) \, \mathrm{d}x \right| < \infty $$

If this is the case, then the above formula shows that $\int_{0}^{\infty} (-1)^{\lfloor x \sin x \rfloor} \, \mathrm{d}x$ converges as an improper Riemann integral and admits the series representation

$$ \int_{0}^{R} (-1)^{\lfloor x\sin x\rfloor} \, \mathrm{d}x = \frac{4}{\pi} \sum_{k=1,3,5,\ldots} \frac{1}{k^2} \int_{0}^{\infty} \sin(\pi x\sin (x/k)) \, \mathrm{d}x. $$

But of course, proving (or disproving) the above claim would be quite hard.

2. Here is a numerical simulation of the map $r \mapsto \int_{0}^{r} (-1)^{\lfloor x \sin x \rfloor} \, \mathrm{d}x$ for $0 \leq r \leq 100\pi$.


The graph is generated by finding all the points of discontinuity of $x \mapsto \lfloor x \sin x \rfloor$ in the range $0 \leq x \leq 100\pi$. So I believe it is much more precise than simply throwing the function $(-1)^{\lfloor x \sin x \rfloor}$ to a numerical integrator.

  • $\begingroup$ Using a stationary phase argument it is probably true that $$ \int_0^{ + \infty } {\sin (\pi x\sin (x/k))dx} = \Im \int_0^{ + \infty } {e^{\pi ix\sin (x/k)} dx} = k\Im \int_0^{ + \infty } {e^{\pi ikt\sin t} dt} = \mathcal{O}(\sqrt k ). $$ $\endgroup$
    – Gary
    Nov 6, 2021 at 2:42

Some pictures for the integral from $0$ to $2\pi$ .

$x\sin x$

$(-1)^{\lfloor x\sin x\rfloor}$

$\int_0^{2\pi}(-1)^{\lfloor x\sin x\rfloor}\;dx \approx -1.210856$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.