# Integration of floor function.

$\displaystyle{\int_{0}^{3\pi}\left\lfloor\sin\left(x\right)\right\rfloor\,\mathrm{d}x = -\pi \approx -3.14159}$

Here, $\left\lfloor\cdots\right\rfloor$ means floor function

Why is it so ?. What I did is that I broke the limits from 0 to $\pi$, $\pi$ to $2\pi$ and $2\pi$ to $3\pi$.

In $0$ to $\pi$, and $x = \pi/2$, the value of $\sin\left(x\right)$ will be $1$. So, we should include that one in our final result, no ?.

From $\pi$ to $2\pi$, floor function of $\sin\left(x\right)$ becomes $-1$. Hence it comes as $-\left(2\pi - \pi\right) = -\pi$. Okay

Again from $2\pi$ to $3\pi$, at $x = 2\pi + \pi/2$, $\sin\left(x\right) = 1$. Hence we should include it.

So, the result should be $1 - \pi + 1 =2 - \pi$.

But Wolfram Alpha shows only -$\pi$. Why?

• You are correct to break the integrals at those points, but the values the integrand takes on in those regions are $0,-1,0$ respectively. Thus the total integral is $\pi*0 + \pi *-1 + \pi*0 = -\pi$ – SquirtleSquad Jun 6 '16 at 6:48

Notice that $0\leq\sin x<1$ for $2\pi\leq x\leq 3\pi$ except by one point, namely $x=\frac52\pi$, then
$$\int_{2\pi}^{3\pi}\lfloor\sin(x)\rfloor dx=\int_{2\pi}^{3\pi}0dx=0$$
• But still, since we are integrating, that means we are looking each and every point separately (logiclly), and adding the values that fx) attains at every point individually. From [0,$pi$/2) U ($pi/2$,$pi$], f(x) attains value 0. But at $pi/2$, f(x) attains value 1. – Reeshabh Ranjan Jun 6 '16 at 7:02