For a real number $ x$, let $\lfloor x\rfloor$ denote the largest integer less than or equal to $x$ and $ \{x\}=x-\lfloor x\rfloor$ (floor and fractional part, resepectively). Let $n$ be a positive integer. I want to evaluate$$ \int_0^n \cos(2\pi \lfloor x\rfloor\{x\})dx$$
I broke down the integral as $$\int_0^1\cos(2\pi \cdot 0 \cdot x)dx+\int_1^2\cos(2\pi \cdot 1 \cdot x)dx +\cdots+ \int_{n-1}^{n}\cos(2\pi \cdot (n-1)\cdot x)dx$$
However I got the wrong answer and I couldn’t understand where I went wrong.
Here are some hints only, since you did not provide any effort:
I assume that $n$ is a positive integer. I suggest that you divide your integral as $$ \sum_{k=1}^n\int_{k-1}^k\cos\bigl(2\pi[x](x-[x])\bigr)\,dx. $$ Then use that, in the integral from $k-1$ to $k$, $[x]=k-1$. Insert this. Then, use the periodicity of cosine, and you will find that only one of the integrals (for what $k$?) is non-zero. A very simple calculation shows that the non-zero integral equals $1$.
For this question, a graph could be useful. The case $n=5$ is attached below.