Prove that the sum of the divisor function equals to sum of the floors I'm reading M. Hall's Combinatorial Theory (page 59).
There is a statement that it is easy to show that: 
$$s(n)=\sum_{k=1}^{n} \sigma(k)$$
Is equal to:
$$s(n)=\sum_{h=1}^{n} \dfrac{1}{2} \bigg(\bigg[\dfrac{n}{h}\bigg]^2+ \bigg[\dfrac{n}{h}\bigg]\bigg)$$  
where $\sigma(k)$ is a sum of positive divisors function, and $\big[x\big]$ is a floor of $x$.
But I don't understand how to prove that.
 A: For $1 \leqslant k \leqslant n$, draw/sketch/imagine the branch of the hyperbola $H_k := \{ (x,y) : x\cdot y = k\}$ in the first quadrant. The lattice points (points with integer coordinates) on $H_k$ correspond to the pairs of divisors of $k$, and we get $\sigma(k)$ as the sum of the $y$-coordinates of these points,
$$\sigma(k) = \sum_{(x,y) \in H_k \cap \mathbb{N}^2} y.$$
Then
$$\sum_{k = 1}^n \sigma(k) = \sum_{k = 1}^n \sum_{(x,y) \in H_k \cap \mathbb{N}^2} y,$$
and every lattice point below or on the hyperbola $H_n$ lies exactly on one of the $H_k$. But we can also sum the lattice points on or below $H_n$ by grouping them according to their $x$-coordinate. For $1 \leqslant h \leqslant n$, the lattice points $(h,m)$ lie on or below $H_n$ if and only if $1 \leqslant m \leqslant \frac{n}{h}$, and for $h > n$, there is no lattice point with $x$-coordinate $h$ on or below $H_n$. Hence
$$\sum_{k = 1}^n \sigma(k) = \sum_{h = 1}^n \sum_{m = 1}^{\bigl\lfloor\frac{n}{h}\bigr\rfloor} m,$$
and we know
$$\sum_{m = 1}^{\bigl\lfloor\frac{n}{h}\bigr\rfloor} m = \frac{1}{2}\biggl(\biggl\lfloor\frac{n}{h}\biggr\rfloor^2 + \biggl\lfloor\frac{n}{h}\biggr\rfloor\biggr).$$
