$$ \int_{-\pi/2}^{\pi/2} [\tan x] \,\text{d}x $$

where $[\quad]$ represents the floor function.

A graphical approach will help here. My observation is that all the areas on the positive and negative cancel out leaving a portion of area on the negative $x$-axis.

Post edit:

I add one more sub part.What happens when it is "least integer greater than" that means ceiling function.

  • $\begingroup$ I wouldn't call this a basic integration. $\endgroup$
    – user65203
    Aug 22, 2018 at 15:40
  • $\begingroup$ I will still wait for a better answer,but your method is good. $\endgroup$
    – Pole_Star
    Aug 22, 2018 at 15:47
  • $\begingroup$ I showed you a graphical method and answered the" post edit". What more do you want ??? $\endgroup$
    – user65203
    Aug 22, 2018 at 16:46
  • $\begingroup$ @starunique2016 If you could give us more feedback as to what you are looking for, then perhaps we could help you more. As it is, I'm pretty sure these answers cover everything you've asked for. $\endgroup$ Aug 22, 2018 at 20:17

3 Answers 3


Here's a nice little graphical solution, (which I believe is what your observation was): notice that the graph of $f(x)=\lfloor{\tan(x)} \rfloor$ has a sort of symmetry such that (for non-integers), we have $f(x)+f(-x)=-1$. Thus we can write the integral as $$\int_{-\pi/2}^{\pi/2} f(x)\ dx=\int_0^{\pi/2} f(x)+f(-x) \ dx = \int_0^{\pi/2} -1 \ dx = \color{red}{-\pi/2}$$ I'll add a picture here to show the observation that is guiding my equivalence of integrals. Also note that the last integral could really just the formula for an area of a rectangle, so I would definitely call this a geometric approach. enter image description here

On a cooler note, you can actually do this with any odd function (as long as the function doesn't take on the integers in any sizeable domain) as in general for $y$ is not an integer, we have $$\lfloor y \rfloor + \lfloor -y \rfloor= -1$$

Edit: To answer your question about the ceiling function, try to do the same type of thing based on the observation that the following holds when $y$ is not an integer $$\lceil y \rceil + \lceil -y \rceil = 1$$

  • $\begingroup$ Since it's the greatest integer function shouldn't it be ceiling not floor? $\endgroup$ Aug 21, 2018 at 22:12
  • 3
    $\begingroup$ $f(x)+f(-x)=-1$ only if $tan(x)\notin N$ $\endgroup$
    – rsy56640
    Aug 22, 2018 at 11:40
  • $\begingroup$ @rsy56640 Good point, but those blips dont matter when integrating as they are infinitely small. I can add this to the answer later tonight. $\endgroup$ Aug 22, 2018 at 12:24
  • $\begingroup$ @carsandpulsars Im pretty sure it's "greatest integer less than" which would be floor. $\endgroup$ Aug 22, 2018 at 12:24
  • $\begingroup$ area of rectangle length breadth? $\endgroup$
    – Pole_Star
    Aug 23, 2018 at 10:33

The improper integral as given is of the form $\infty-\infty$, hence does not exist. But there is the "principal value“ $$\lim_{\theta\to\pi/2}\int_{-\theta}^\theta\lfloor\tan x\rfloor\>dx=-{\pi\over2}\ .\tag{1}$$ Proof. Put $$\alpha_k:=\arctan k\quad(k\geq0)\ .$$ Then $\lim_{n\to\infty}\alpha_n={\pi\over2}$. Looking at the figure we obtain $$\eqalign{\int_{-\alpha_n}^{\alpha_n}\lfloor\tan x\rfloor\>dx&=\sum_{k=1}^n\int_{-\alpha_k}^{-\alpha_{k-1}}\lfloor\tan x\rfloor\>dx+\sum_{k=1}^n\int_{\alpha_{k-1}}^{\alpha_k}\lfloor\tan x\rfloor\>dx\cr &=\sum_{k=1}^n(\alpha_k-\alpha_{k-1})(-k)+\sum_{k=1}^n(\alpha_k-\alpha_{k-1})(k-1)\cr &=-\sum_{k=1}^n(\alpha_k-\alpha_{k-1})\cr &=-\alpha_n\to-{\pi\over2}\quad(n\to\infty)\ .\cr}$$ Since $$\alpha_k-\alpha_{k-1}=\arctan k-\arctan(k-1)=\arctan{1\over 1+k(k-1)}\approx{1\over k^2}\qquad(k\gg1)$$ we see that the two sums of type $\sum_{k=1}^\infty(\alpha_k-\alpha_{k-1})(k-1)$ diverge like the harmonic series. On the other hand their individual terms converge to $0$. It follows that we may take the continuous limit in $(1)$.

  • 2
    $\begingroup$ +1. I believe the OP wanted a graphical solution, but the discussion of principal value is necessary and good. $\endgroup$ Aug 22, 2018 at 14:12

Consider the function $\{\tan x\}$ (where the braces denote the fractional part of the argument).

As the plot has a central symmetry (the grapher spends a hard time with it), the areas under the curves are complementary to each other and add up to half of the rectangle area, i.e. $\dfrac\pi2$.

enter image description here

Then the claim follows from $\lfloor x\rfloor=x-\{x\}$.

For the ceiling, just observe that $\lceil x\rceil=-\lfloor-x\rfloor$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.