What is the greatest integer function, and how do you integrate it?

Given a real number $x$, the notation $[x]$ (also often seen as $\lfloor x\rfloor$) literally means "the greatest integer less than or equal to $x$". For example, $1.2$ is not an integer. The integers are $$\ldots,\;-4,\;-3,\;-2,\;-1,\;0,\;1,\;2,\;3,\;4,\ldots$$ We throw away all the integers that are not less than or equal to $1.2$: $$\ldots,\;-4,\;-3,\;-2,\;-1,\;0,\;1\hphantom{,\;2,\;3,\;4,\ldots}$$ and take the largest one of them, which is $1$. Therefore, the greatest integer less than $1.2$ is $1$, and we write $$\lfloor 1.2\rfloor =1.$$ (By the way, take a look at the relevant Wikipedia article.)


Here is a graph of $\lfloor x\rfloor$, from $x=-3$ to $x=3$:

enter image description here

Here is a version where I've added a graph of just the function $x$ itself (in red) and lines indicating the integers (in green).

enter image description here

You can see on this graph that, as we expected, $\lfloor 1.2\rfloor =1$.


Here is a graph of $\lfloor \sqrt{x}\rfloor$, from $x=0$ to $x=25$:

enter image description here

Here is a version where I've added a graph of just the function $\sqrt{x}$ itself (in red) and lines indicating the integers (in green).

enter image description here

Here's a check for this graph: using a calculator, we know that $$\sqrt{20}\approx 4.47214$$ and so the largest integer that's less than or equal to $\sqrt{20}$ will be $4$.


Using the fact that, for any numbers $a<b<c$, $$\int_a^c f(x)\,dx=\int_a^bf(x)\,dx+\int_b^cf(x)\,dx,$$ we can break up the range we're integrating over into pieces where $\lfloor\;\;\rfloor$ is constant, and we do know how to integrate constants (note that the endpoints don't contribute the value of the integral; integrating over the set of $x$'s for which $a\leq x\leq b$ will give the same answer as integrating over the set of $x$'s for which $a\leq x<b$, and we denote both of these operations by $\int_a^b$). For example, $$\int_1^3\lfloor x\rfloor\,dx=\int_1^2\lfloor x\rfloor\,dx+\int_2^3\lfloor x\rfloor\,dx=\int_1^21\,dx+\int_2^32\,dx=1+2=3.$$


The more usual notation is nowadays $\lfloor x\rfloor$. "The greatest integer that is $\le x$" means what it says. Everything will be clear once we do some examples.

The number $\lfloor 3.6\rfloor$ is the biggest integer which is $\le 3.6$. This is $3$. So $\lfloor 3.6\rfloor=3$. Similarly, $\lfloor \pi\rfloor=3$. Also, $\rfloor 17\rfloor =17$. Informally, if $x$ is an integer, then $\lfloor x\rfloor=x$. If $x$ is not an integer, we go down until we meet the first integer. For positive $x$, that means knocking off the part after the decimal point.

But it is easy to get a little confused when we apply the greatest integer function to negative numbers. Note that $\lfloor -4.7\rfloor=-5$, since the biggest integer which is $\le -4.7$ is $-5$. Luckily, one meets $\lfloor x\rfloor$ mainly with positive $x$. Now let us do an integrations, such as $$\int_0^9 \left\lfloor \sqrt{x}\right\rfloor \,dx.$$

Let $f(x)=\left\lfloor \sqrt{x}\right\rfloor$. First we will see what $f(x)$ looks like.

For $0\le x\lt 1$, we have $0\le \sqrt{x}\lt 1$, and therefore $\left\lfloor \sqrt{x}\right\rfloor=0$.

For $1\le x\lt 4$, we have $1\le \sqrt{x}\lt 2$, and therefore $\left\lfloor \sqrt{x}\right\rfloor =1$.

For $4\le x\lt 9$, similarly we have $\left\lfloor \sqrt{x}\right\rfloor=2$. And finally for $x=9$ we have $\left\lfloor \sqrt{x}\right\rfloor=3$.

So $f(x)$ is defined by different formulas over different parts of the world. It is $0$ in the interval $[0,1)$, and $1$ in the interval $[1,4)$, and $2$ in the interval $[4,9)$, and $0$ at $9$. You should graph $y=f(x)$ to see clearly what comes next.

To integrate, we integrate separately over our intervals, and add up. So we want $$\int_0^1 (0)\,dx+\int_1^4 1\,dx+\int_4^9 2\,dx+\int_9^9 3\,dx.$$ The first integral and the last are both $0$. The middle two are $3$ and $10$, so our integral is $13$. The individual integrations are easy: geometrically, we are just finding the areas of rectangles.