Solve $\int_{2}^{341} \left(x – \lfloor x \rfloor \right)^2$

ceiling-and-floor-functionsintegration

The question is $\int_{2}^{341} \left(x – \lfloor x \rfloor \right)^2$.

I understand how to solve integrals of floor functions (they get converted to discrete integrals) and even just this part: $(x – \lfloor x \rfloor)$.

I drew the graph and they're just 341 triangles with base 1 and height 1. so the answer is $\frac{341}{2}$.

How does one solve the square part?
The answer given is $\frac{341}{3}$.

Best Answer

If $x=n+u$ where $n\in\mathbb{Z}$ and $u\in[0,1)$, then $(x-\lfloor x\rfloor)^2=u^2$.

$$\int_n^{n+1}(x-\lfloor x\rfloor)^2dx=\int_0^1u^2du=\frac{1}{3}$$

$$\int_2^{341}(x-\lfloor x\rfloor)^2dx=\sum_{k=2}^{340}\int_n^{n+1}(x-\lfloor x\rfloor)^2dx=\frac{339}{3}=113$$

Related Question