The question is as follows
For any real number $x$, let $\lfloor{x}\rfloor$ denote the greatest integer less than or equal to $x$. Let $f$ be a real valued function defined on the interval $[-10,10]$ by
$f(x)= \begin{cases} x-\lfloor{x}\rfloor & \ \ \text{if} \ \lfloor{x}\rfloor \ \text{is odd} \\ 1+\lfloor{x}\rfloor-x & \ \ \text{if} \ \lfloor{x}\rfloor \ \text{is even} \end{cases}$
Then the value of $\dfrac{\pi^2}{10}\displaystyle\int_{-10}^{10} f(x) \ \cos{\pi x} \ dx$ is
My try--
$f(x)$ can be rewritten as
$f(x)= \begin{cases} \{x\} & \ \ \text{if} \ \lfloor{x}\rfloor \ \text{is odd} \\ 1-\{x\} & \ \ \text{if} \ \lfloor{x}\rfloor \ \text{is even} \end{cases}$
Where $\{ \cdot\}$ denotes the fractional part function.
The graph of $f(x)$ will be somewhat like this, from $-10$ to $10$.
So, $\displaystyle\int_{-10}^{10} f(x) \ dx=10 \times \dfrac{1}{2} \times 2 \times 1=10.$
Then, using integration by parts, $$\displaystyle\int_{-10}^{10} \underbrace{f(x)}_{\text{2nd function}} \underbrace{\cos{\pi x}}_{\text{1st function}} \ dx=\left[\cos {\pi x} \cdot 10\right]_{-10}^{10}+\displaystyle\int_{-10}^{10}\pi\sin{\pi x} \cdot 10 \ dx \ \ \ \ \ \ \left(\text{because} \ \displaystyle\int_{-10}^{10} f(x) \ dx=10\right)$$
But my answer does not match that given in the book.