# Finding $\int\lfloor x\rfloor\cdot |\sin(\pi x)| dx$

Find $$\int\lfloor x\rfloor\cdot |\sin(\pi x)| dx$$

Any help would be appreciated.

The function is from $$\mathbb{R}$$ to $$\mathbb{R}$$, and so should be the result.

The best I got thus far is:

$$\int\lfloor x\rfloor\cdot |\sin(\pi x)| dx=\frac{k}{\pi}(-1)^{k+1}\cdot \cos(\pi x)+\frac{k^2}{\pi}+C, x\in [k,k+1), k\geq 0, k\in \mathbb{Z}$$

For $$k<0$$ it's similar, the problem is I am unable to prove this result.

EDIT: Solutions without using definite integration please, and also, I need to be able to prove that the solution is correct manually.

• What do you have in your mind @Eitan Levi? – Dbchatto67 Apr 6 '19 at 16:20
• Without bounds I don’t think that is possible. But If specify bounds, it can be easily done – DINEDINE Apr 6 '19 at 16:22
• We can't read your mind, please show us. – Yves Daoust Apr 6 '19 at 17:00
• My original direction was wrong. – איתן לוי Apr 6 '19 at 17:41
• "I need to be able to prove that the solution is correct manually": what is the problem ? – Yves Daoust Apr 6 '19 at 18:50

On each interval $$[2k,2k+1)$$, because $$\sin(\pi x)$$ is non-negative, the integral is equal to

$$f(x) = \lfloor x\rfloor\int |\sin(\pi x)| dx = \lfloor x\rfloor\int \sin(\pi x) dx$$

Solving this integral, you get

$$f(x) = f_1(x) = -\frac{\lfloor x\rfloor}{\pi}\cos(\pi x) + A(\lfloor x\rfloor)$$

On the intervals $$[2k-1, 2k)$$, you will have the same result, just with a different sign,

$$f(x) = f_2(x) = \frac{\lfloor x\rfloor}{\pi}\cos(\pi x) + B(\lfloor x\rfloor)$$

Notice that the above "constants" of integration are functions of $$\lfloor x\rfloor$$. This is because we have integrated separately on each interval, and therefore the constants for each interval are different. To determine these constants, we will use the fact that $$f(x)$$ is differentiable and therefore continuous.

By continuity at the points $$x=2k$$, we have

$$\begin{eqnarray*} &f_1(2k)=\lim\limits_{x\to2k^-} f_2(x)& \\ &\frac{2k}{\pi}\cos(2k\pi) + A(2k) = \frac{2k-1}{\pi}\cos(2k\pi) + B(2k-1)& \\ &\boxed{B(2k-1) = A(2k) + \frac{1-4k}{\pi}} \tag{1}& \end{eqnarray*}$$

By continuity at the points $$x=2k+1$$, we have

$$\begin{eqnarray*} &\lim\limits_{x\to(2k+1)^-} f_1(x) = f_2(2k+1)& \\ &-\frac{2k}{\pi}\cos(2k+1)\pi + A(2k) = \frac{2k+1}{\pi}\cos(2k+1)\pi + B(2k+1)& \\ &\boxed{A(2k) = -\frac{4k+1}{\pi} + B(2k+1)} \tag{2}& \end{eqnarray*}$$

Next, since the integrand is identically zero on $$[0,1)$$, $$f(x)=C$$ is constant on this interval. Because $$[0,1)$$ is of the form $$[2k,2k+1)$$ for $$k=0$$, this gives us $$A(0) = C$$. Consequently, $$(2)$$ yields $$B(1) = \frac{1}{\pi}+C$$.

Combining $$(1)$$ and $$(2)$$ we get

$$\begin{eqnarray*} &B(2k+1) = \frac{8k}{\pi} + B(2k-1) = \frac{8k}{\pi} + \frac{8(k-1)}{\pi} + B(2k-3) = \cdots =& \\ &= \frac{8}{\pi} (k+k-1+...+1) + B(1) = \frac{8}{\pi}\frac{k(k+1)}{2} + \frac{1}{\pi}+C =& \\ &= \frac{1}{\pi}(4k^2+4k+1)+C = \frac{1}{\pi}(2k+1)^2+C& \end{eqnarray*}$$

Now, applying $$(2)$$ we get $$A(2k) = \dfrac{4k^2}{\pi}+C$$. A more useful way to express the last two results is

$$B(\lfloor x\rfloor) = \frac{\lfloor x\rfloor^2}{\pi}+C,\ A(\lfloor x\rfloor) = \frac{\lfloor x\rfloor^2}{\pi}+C$$

on their respective domains.

Finally, just merge the functions $$f_1$$ and $$f_2$$ into one and get

$$\boxed{\boxed{f(x) = (-1)^{\lfloor x\rfloor+1}\cdot\frac{\lfloor x\rfloor}{\pi}\cos(\pi x) + \frac{\lfloor x\rfloor^2}{\pi}+C}}$$

An easier way

First, notice that the integrand is a continuous function on $$\mathbb R$$. This allows us to use the Fundamental theorem of calculus, i.e.

$$f(x)=\int\lfloor x\rfloor\cdot |\sin(\pi x)| dx = \int_0^x\lfloor t\rfloor\cdot |\sin(\pi t)| dx$$

We can forget about the constant of integration for now.

Next, for $$x\ge 1$$, we can write

$$f(x) = \sum_{k=1}^{\lfloor x\rfloor} \int_{k-1}^k \lfloor t\rfloor\cdot |\sin(\pi t)| dt + \int_{\lfloor x\rfloor}^x\lfloor t\rfloor\cdot |\sin(\pi t)|dt$$

Use the fact that $$\lfloor t \rfloor = k-1$$ on the interval $$[k-1,k)$$, and you will get $$\int_{k-1}^k \lfloor t\rfloor\cdot |\sin(\pi t)| dt = (k-1)\int_{k-1}^k |\sin(\pi t)| dt$$

Because $$|\sin(\pi t)|$$ is $$1-$$periodic, the integration interval $$[k-1, k]$$ can be reduced to the interval $$[0, 1]$$, which makes it easy to calculate it (the result is $$2/\pi$$).

Another thing you will need to use is the fact that

$$\int_{\lfloor x\rfloor}^x\lfloor t\rfloor\cdot |\sin(\pi t)|dt = \lfloor x\rfloor \int_{\lfloor x\rfloor}^x |\sin(\pi t)|dt = \lfloor x\rfloor \int_0^{x-\lfloor x\rfloor} \sin(\pi t)dt$$

For $$x<1$$, it can be shown that the result is the same. Also, you can add a constant of integration if you like.

• I feel like it's important to say that this one was given to us before we studied definite integrals, so I feel like there is a way to solve it without it. – איתן לוי Apr 6 '19 at 17:13
• @איתןלוי I have updated my answer showing the requested method. – Haris Gušić Apr 6 '19 at 20:31

In every unit interval $$[k,k+1[$$, the first factor is the constant $$k$$, while the second is a positive arch of sinusoid.

For $$k=0$$, we have

$$\int_0^x\sin(\pi x)\,dx=-\left.\frac{\cos(\pi x)}{\pi}\right|_0^x=\frac{1-\cos(\pi x)}{\pi},$$ which runs from $$0$$ to $$\dfrac2\pi$$. For the next intervals, the expression is the same with amplitude multiplied by $$k$$, and with an additional term $$\dfrac{k(k-1)}{\pi}$$ for continuity (triangular number).

Hence after simplification

$$\lfloor x\rfloor\frac{\lfloor x\rfloor-\cos(\pi\{x\})}{\pi}.$$

• I know it's a good solution, but this problem was given to us before we studied definite integrals, so I feel like there is a way to solve it without them. – איתן לוי Apr 6 '19 at 17:42
• @איתןלוי: you can integrate by parts, but due to non-differentiability issues, you must be careful. And the antiderivatives aren't so easy. – Yves Daoust Apr 6 '19 at 18:46