Concrete Mathematics: Why replace floor of x with a sum is correct?

102 Views Asked by At

In the Concrete Mathematics book, the solution for the sum $\sum_{k=0}^{a^2-1}\lfloor \sqrt k \rfloor$ is written as follows.

$$ \begin{align*} \sum_{0 \le k < a^2} \lfloor \sqrt k \rfloor &= \sum_{j, k} [1 \le j \le \sqrt k][0 \le k < a^2]\\ &= \sum_{1 \le j < a} \sum_k [j^2 \le k < a^2]\\ &= \sum (a^2 - j^2) = a^3 - \frac{1}{3}a(a + \frac{1}{2})(a + 1), \text{integer a} \end{align*} $$

What I don't understand is the first step. How can $\lfloor \sqrt k \rfloor$ be equal to $\sum_j [1 \le j \le \sqrt k]$ ?

1

There are 1 best solutions below

0
On BEST ANSWER

Let $x>0$ and consider $S=\sum_j[1\le j\le x]$. This is the sum of $[1\le j\le x]$ over all integers $j$. Now, $[1\le j\le x]$ equals $1$ whenever $1\le j\le x$ and zero otherwise. So $S$ is the number of integers $j$ with $1\le j\le x$. These integers are $1,\ldots,\lfloor x\rfloor$. There are $\lfloor x\rfloor$ of them: $S=\lfloor x\rfloor$.