# How to evaluate $\int_0^n \cos(2\pi \lfloor x\rfloor\{x\})dx$?

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.

• In the integrals you got (x) wrong: in the second integral you should write (x-1), in the last (x-n+1)
– Luca
Oct 28, 2016 at 19:44
• @Luca but I have also changed the limits.if x would have been what you have told in the second integral then limit must be then 1 to 2.did you get what I mean? Oct 28, 2016 at 19:52
• You are right, I didn't see it. So, now, you are saying that $1$ is not the right answer?
– Luca
Oct 28, 2016 at 19:56
• @Luca yes exactly the answer is given out to be n Oct 28, 2016 at 20:00
– Luca
Oct 28, 2016 at 20:04

The interval $$[0,1]$$ brings a contribution $$\int_0^1dx=1$$ while all others integrate the cosine over an integer number of periods !

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.

• I understood that integral 0 to 1 is 1. but how other integrals are zero?please explain. Oct 26, 2015 at 5:02

Here is to complete the ideas of the OP. I am surprised there are not many answers to this relatively old question.

Splitting the interval $$[0,n]$$ as $$[0,n]=[0,1]\cup(1,2]\cup\ldots\cup(n-1,n]$$ as the OP does the trick.

The first term in the OP's splitting $$\int_0^1\cos(2\pi \cdot 0\cdot x)dx+\int_1^2\cos(2\pi x)dx +\cdots+ \int_{n-1}^{n}\cos(2\pi (n-1)\cdot x)dx$$

is $$\int^1_0\,dt=1$$. Each of the remaining terms is $$0$$

$$\int^{k+1}_k\cos(2\pi k x)\,dx =\frac{1}{2\pi k}\sin(2\pi k x)\big|^{k+1}_k=0$$