# How to show that $\int_{a}^{b}\left \lfloor x \right \rfloor dx+ \int_{a}^{b}\left \lfloor -x \right \rfloor dx=a-b$?

How to show that $$\int_{a}^{b}\left \lfloor x \right \rfloor dx+ \int_{a}^{b}\left \lfloor -x \right \rfloor dx=a-b$$ Where $\left \lfloor x \right \rfloor$ means greatest integer $\leqslant x$.

-
What have you tried? –  Vishal Gupta Jun 5 '13 at 11:51
@Vishal I tried $\int_{a}^{b}\left \lfloor x \right \rfloor dx+ \int_{a}^{b}\left \lfloor -x \right \rfloor dx=\int_{a}^{b}(\left \lfloor x \right \rfloor + \left \lfloor -x \right \rfloor)dx$. Then I think that $\left \lfloor x \right \rfloor + \left \lfloor -x \right \rfloor=0$, so $\int_{a}^{b}0dx = 0$. But it is clearly wrong, but why? –  Fazzolini Jun 5 '13 at 12:01
@Vishal I was mistaken. $\left \lfloor x \right \rfloor + \left \lfloor -x \right \rfloor=0$ only when $x$ is integer, at other points, $\left \lfloor x \right \rfloor + \left \lfloor -x \right \rfloor=-1$. –  Fazzolini Jun 5 '13 at 12:15

What happens when you add $\lfloor x \rfloor$ and $\lfloor -x \rfloor$? Can you see how this relates to the bound of the integral and the answer you want?

-

Represent $x$ as $n+k$, where $n$ is the greatest integer below $x$ and $k$ is below $1$. What is $\left \lfloor n+k \right \rfloor$ and $\left \lfloor -(n+k) \right \rfloor$?

-
I figured it out. At points, where $x$ is integer, $\left \lfloor x \right \rfloor + \left \lfloor -x \right \rfloor=0$, at any other point, $\left \lfloor x \right \rfloor + \left \lfloor -x \right \rfloor=-1$. So we have $\int_{a}^{b}-1dx = (b-a)(-1)=a-b$. –  Fazzolini Jun 5 '13 at 12:14

Show that :)

$\displaystyle\int \lfloor x\rfloor dx=\dfrac{\left\lfloor x\right\rfloor\left(2x-1-\left\lfloor x\right\rfloor\right)}{2}+C$

$\displaystyle\int \lfloor -x\rfloor dx=\dfrac{\left\lfloor -x\right\rfloor\left(2x+1+\left\lfloor -x\right\rfloor\right)}{2}+C$

-