Compute $\int_{-2}^{2}\frac{\sin^2x}{[\frac{x}{\pi}]+\frac{1}{2}}dx$ using properties I was solving questions on Definite Integrals when I came across this one where we have to evaluate the value of the integral-
$$\int_{-2}^{2}\frac{\sin^2x}{[\frac{x}{\pi}]+\frac{1}{2}}dx$$
where [•] denotes the Greatest Integer Function.
This can easily be solved by applying the odd-even property-
$$\int_{-a}^{a}f(x)dx=0$$ if f(x) is an odd function.
Using this method the value of integral comes out to be 0.
But when I try to solve it using the piece-wise function property-
$$\int_a^cf(x)dx=\int_a^bf(x)dx+\int_b^cf(x)dx$$
the value comes out to be $$4-\sin4$$
So where am I going wrong?
 A: For $x\in [-2,0)$, $\lfloor x/\pi\rfloor=-1$ while for $x\in [0,2]$, $\lfloor x/\pi\rfloor=0$.  Hence,
$$\int_{-2}^2 \frac{\sin^2(x)}{\lfloor x/\pi\rfloor+\frac12}\,dx=-2\int_{-2}^0 \sin^2(x)\,dx+2\int_0^2 \sin^2(x)\,dx$$
A: Okay, let's use the piecewise function property.
We have $$\int_{-2}^2\frac{\sin^2x}{\lfloor\frac{x}{\pi}\rfloor +\frac{1}{2}}\mathrm{d}x=\int_{-2}^{0}\frac{\sin^2x}{\lfloor\frac{x}{\pi}\rfloor+\frac{1}{2}}\mathrm{d}x+\int_{0}^{2}\frac{\sin^2x}{\lfloor\frac{x}{\pi}\rfloor+\frac{1}{2}}\mathrm{d}x$$
Now, for the first integral, substitute $x=-t$, so that $\mathrm{d}x=-\mathrm{d}t$ and $x=-2 \implies t=2$ and $x=0 \implies t=0$ , therefore due to the negative sign, limits get flipped, and we are left with
$$\int_{-2}^2\frac{\sin^2x}{\lfloor\frac{x}{\pi}\rfloor +\frac{1}{2}}\mathrm{d}x=\int_{0}^{2}\frac{\sin^2x}{\lfloor\frac{-x}{\pi}\rfloor+\frac{1}{2}}\mathrm{d}x+\int_{0}^{2}\frac{\sin^2x}{\lfloor\frac{x}{\pi}\rfloor+\frac{1}{2}}\mathrm{d}x$$
Using $\lfloor\frac{-x}{\pi}\rfloor=-1-\lfloor\frac{x}{\pi}\rfloor$ for $x\neq n\pi,n\in \mathbb{N} $, we obtain that the first integral is the negative of the second integral, and hence the result is $\boxed{0}$.
A: Use $$\int_{-a}^{a} f(x) dx= \int_{0}^{a} [f(x)+f(-x)] dx$$
So here $$I=\int_{-2}^{2} \frac{\sin^2x}{[x/\pi]+1/2}dx=\int_{0}^{2}\sin^2 x\left(\frac{1}{[x/\pi]+1/2}+\frac{1}{[-x/\pi]+1/2}\right)dx$$
As $[x/\pi]=0$ and $[-x/\pi]=-1$ for $x\in (0,2)$, the term in the big brackets becomes $1/2-1/2=0$. Therefore $I=0.$
