Show that $\int_a^b[x]\mathrm dx+\int_a^b[-x]\mathrm dx=a-b.$ My question is from Apostol's Vol. 1 One-variable calculus with introduction to linear algebra textbook.

Page 70. Exercise 3. Show that $\int_a^b \lfloor x \rfloor \mathrm dx+\int_a^b \lfloor-x \rfloor \mathrm dx=a-b.$
Additional information. Definition of the integral of step functions. The integral of $s$ from $a$ to $b$, denoted by the symbol $\int_a^bs(x)\mathrm dx$, is defined by the following formula: $$\int_a^bs(x)\mathrm dx=\sum_{k=1}^ns_k(x_k-x_{k-1}).$$

I haven't had much problem computing integrals of these floor functions, but I am stuck at proving this general case of $\int_a^b \lfloor x \rfloor \mathrm dx+\int_a^b \lfloor-x \rfloor \mathrm dx=a-b.$ Any hints would be appreciated. Thanks in advance.
 A: $$\int_{a}^{b}[x]dx+\int_{a}^{b}[-x]dx=\int_{a}^{b}([x]+[-x])dx$$
and  use this follow  $$[x]+[-x]=\begin{cases}-1,x\neq z\\
0,x\in Z
\end{cases}$$
A: Assuming your dealing with a floor function ie $\lfloor{x}\rfloor$. Then assume that $x\geq 0$ for simplicity. It can be written an $\lfloor{x}\rfloor=(x-\epsilon)$ for some $0\leq \epsilon<1$. Then it follows that $\int_{a}^{b} (x-\epsilon) dx =\frac{x^2}{2}-x\epsilon$ from $a$ to $b$ is just $\dfrac{b^2}{2}-b\epsilon-\dfrac{a^2}{2}+a\epsilon$. Finally $\int_{a}^{b}\lfloor{-x}\rfloor=\int_{a}^{b} (-x-1+\epsilon) dx= \frac{-x^2}{2}-x+x\epsilon$ from a to b which is just $\dfrac{-b^2}{2}-b+b\epsilon+\dfrac{a^2}{2}+a-a\epsilon$. Thus adding the two integrals we get  $\dfrac{b^2}{2}-b\epsilon-\dfrac{a^2}{2}+a\epsilon-\dfrac{b^2}{2}-b+b\epsilon+\dfrac{a^2}{2}+a-a\epsilon=a-b$.
We see that $\lfloor{x}\rfloor=(x-\epsilon)$ where  $0\leq \epsilon<1$. It must follow that $\lfloor{-x}\rfloor=-x-1+\epsilon$ when $x>0$. 
*If you want to see this suppose that we stick with $x\geq 0$ then it follows that $x$ is between some integer $n$ and $n-1$ that is $n-1\leq x\leq n$. Let $\epsilon=x-n+1$. That is the distance between $x$ and $n-1$. Then the distance between $-x$ and $-n$ is just $1-\epsilon= -x+n$. Since it follows that $\lfloor{-x}\rfloor=-n$ which really is $-x-1+\epsilon$. This is not really a proof but more so some intuition behind it. You will need the Archimidean property to prove the existence of a $n\in\mathbb{Z}$ such that $n-1\leq x\leq n$ which is a bit outside the scope of this problem.
The case when $x<0$ is the same except its flipped flopped.
