# How to compute the integral $\int_0^\pi \lfloor\cot (x)\rfloor dx$

I have been given to compute

$$\int_0^\pi \lfloor\cot (x)\rfloor dx$$

Where, $\lfloor$ $\rfloor$ is floor function. Now since floor function is discontinuous we need to break out Integral in continuous regions but problem here is that at $x=0$ value of $\cot (x)$ tends to infinity so , how to calculate this Integral ?

• It clearly diverges both in $0$ and $\pi$, as it behaves like $1/x$ in $0$. Or $[1/x]$ is you like. – Peter Franek Dec 26 '14 at 12:32
• In English there are articles the floor function, the Integral,the problem. It would make your post more readable using this peculiarity of English. – Karl Dec 26 '14 at 12:48

Let $a=\frac\pi2$. For every $x$ in $(0,a)$, $\cot(\pi-x)=-\cot(x)$ hence $\lfloor\cot(\pi-x)\rfloor=-\lfloor\cot(x)\rfloor-1$ for every $x$ in $(0,a)$ such that $\cot(x)$ is not an integer. In particular, the integral from $t$ to $2a-t$ is $-(a-t)$ for every $t$ in $(0,a)$. When $t\to a$, the limit is $-a$, that is, $$\lim_{t\to0^+}\int_t^{\pi-t}\lfloor\cot(x)\rfloor\,\mathrm dx=-\frac\pi2.$$ As noted by others, the integral on $(0,\pi)$ diverges (both at $0$ and at $\pi$) hence it is not definite in any sense of the term that I am aware of, but the limit above, based on the near symmetry of the function with respect to the midpoint of the interval, is a simple way to give it some meaning.