Prove $\int_0^n \lfloor x\rfloor \,dx = \frac{n (n-1)}{2}$ Prove $\int_0^n \lfloor x\rfloor \,dx = \frac{n (n-1)}{2}, \text{ where $\lfloor x \rfloor$ is the greatest integer less than or equal to $x$ and $n \in \mathbb{Z}^+$.}$
I am working through Apostol's Calculus and if you know the text you know that he introduces integration before differentiation, so the idea of the antiderivative has not been introduced yet. I have graphed it out and I can see that:
$\int_0^n \lfloor x\rfloor \,dx = 0 (1-0 )+ 1(1-0) + ..+ $
but I am having a hard time making the leap from here.
 A: $$\begin{align}\int_0^n \lfloor x\rfloor\,dx &=\int_0^1 \lfloor x\rfloor\,dx + \int_1^2\lfloor x\rfloor\,dx + \cdots + \int_{n-1}^n\lfloor x\rfloor dx\\[10pt]
&= \int_0^1 0\,dx + \int_1^2 1\,dx + \cdots + \int_{n-1}^n (n-1)\,dx\\[10pt]
&= 0\Big|_0^1 + x\Big|^2_1 + \cdots + \big((n-1)x\big) \Big|_{n-1}^n\\[10pt]
&= 0 + 1 + \cdots + (n-1) \\[10pt]
&= \dfrac{n(n-1)}{2}\end{align}$$


*

*The second '$=$' is correct because function $\lfloor x \rfloor$ is defined as $\lfloor x \rfloor = \max\{ k \in \mathbb Z \colon k \leq x\}$.
So, as every integral is expressed from certain $w$ to $w+1$, it is true that $\forall w'\in [w, w+1)$, $\lfloor w' \rfloor = w$. That is, the image of every element in $[w, w+1)$ will be $\max\{ k \in \mathbb Z \colon k \leq w'\} = w$. 
There is only an exception: $w' = w+1$. But no problem, because, by definition:
$$\int_a^a f(x)\; dx = 0$$
In this case: $$\int_{w+1}^{w+1} \lfloor x \rfloor\;dx = 0$$
A: Hint: note that $$\int_0^n \lfloor x\rfloor \,dx = 0 + 1 + 2 + \ldots  (n-1)$$ where the RHS is a well known sum.
