integral involving floor function and absolute value of sin(x) $\int [x]\mid sin( \pi x)\mid dx $ i am struggling with this integral 
$$\int [x]\mid sin( \pi x)\mid dx  $$
i tried integrating by parts and the fact that 
$$\int [x]dx=x[x]  $$
according to WolframAlpha but i couldn't get to anything.
 A: It seems that either you have copied your professor's answer incorrectly or your professor made a mistake in writing it out.
This Wolfram Alpha query
shows the function you have copied.
As you can clearly see, this function is not constant between $x=0$ and $x=1.$
But $\lfloor x\rfloor \lvert \sin( \pi x)\rvert = 0$ when $0 < x < 1,$
and therefore any antiderivative of 
$\lfloor x\rfloor \lvert \sin( \pi x)\rvert$
must be constant between $x=0$ and $x=1.$
(I am using the more modern notation $\lfloor x\rfloor$ for the floor function.)
I think this Wolfram Alpha query
shows the graph of the antiderivative your professor meant to give you:
$$
\int \lfloor x\rfloor \lvert \sin( \pi x)\rvert \,dx
 = \frac{\lfloor x\rfloor}{\pi} 
     (\lfloor x\rfloor - (-1)^{\lfloor x\rfloor }cos( \pi x)).
$$
Now think about your strategy for attacking the problem.
When you already have a function $F$ that you believe is an antiderivative of $f,$ it is usually easier prove that $F$ is the antiderivative of $f$ by taking the derivative of $F$ than by attempting to integrate $f.$
The reason this gets a little bit sticky for this particular is that $\lfloor x\rfloor$ is discontinuous at every integer, which makes it difficult to differentiate expressions involving $\lfloor x\rfloor.$
I would tackle the derivative at integer $x$ differently from the way I would tackle the derivative at non-integer $x.$ This means using at least two separate cases to calculate the derivative.
Assuming $n < x < n+1$ for some integer $n,$ you should be able to show relatively directly that 
$$
\frac{d}{dx} \left(\frac{\lfloor x\rfloor}{\pi} 
     (\lfloor x\rfloor - (-1)^{\lfloor x\rfloor }cos( \pi x))\right)
 = \lfloor x\rfloor \lvert \sin( \pi x)\rvert.
$$
That takes care of the derivative at all non-integer values of $x.$
Then, assuming $x_0 = n$ where $n$ is an integer, show that
$\frac{\lfloor x\rfloor}{\pi} 
     (\lfloor x\rfloor - (-1)^{\lfloor x\rfloor }cos( \pi x))$
is continuous at $x_0$ 
and that its left and right derivatives at $x_0$ are both equal to
$\lfloor x_0\rfloor \lvert \sin(\pi x_0)\rvert.$

If you absolutely must demonstrate how the integral can be derived when only the integrand is given, without "making a lucky guess,"
a good first step is to graph the function that you want to integrate.
Notice that for $x$ between any two consecutive integers,
$\lfloor x\rfloor \lvert \sin(\pi x)\rvert$
is just $k \sin(\pi x)$ for some (possibly negative) integer $k,$
so it's just a half-cycle of the sine function scaled by some factor.
See how Wolfram Alpha graphs this.
Examining the graph, you should be able to identify pieces of the function's domain on which the function is simple to integrate.
If you simply integrate each piece separately and ignore the constant of integration, you will derive a piecewise continuous function
of which each piece is a correct antiderivative of
$\lfloor x\rfloor \lvert \sin(\pi x)\rvert$
over the interval covered by that piece.
But since the function found in this way will be discontinuous
(unless you just happen to have skipped ahead to the next step already),
it will not be a correct antiderivative of
$\lfloor x\rfloor \lvert \sin(\pi x)\rvert$
over all real numbers.
To get a correct antiderivative everywhere,
you can find a sequence of constants to add to each piece of the piecewise continuous function in order to "connect" each piece to the pieces before and after and make a continuous function over all real numbers.
Then figure out a general formula for the constant to add to each piece,
and you have your integral. In fact, if you look at the professor's
answer and consider only the interval between two consecutive integers,
you can split the formula into two parts, 
one of which is a (relatively) simple antiderivative of
a sinusoidal function on that interval, 
and the other of which is constant over the interval.
A: I will be edging around definite and indefinite integrals using Newton-Leibniz formula, since the question asks about an indefinite integral. So, let's consider the following function $f(x)=\left \lfloor x \right \rfloor \left | \sin(\pi x)  \right |$ and look at some intervals and values of $f(x)$ on those intervals:
$$x \in [0,1) \Rightarrow f(x)=0$$
$$x \in [1,2) \Rightarrow f(x)=\left | \sin(\pi x)  \right |$$
$$x \in [2,3) \Rightarrow f(x)=2\left | \sin(\pi x)  \right |$$
$$...$$
$$x \in [n,n+1) \Rightarrow f(x)=n\left | \sin(\pi x)  \right | \tag{1}$$
On top of this, because $x = \left \lfloor x \right \rfloor + \{x\}$ we have
$$f(x)=\left \lfloor x \right \rfloor\left | \sin(\pi x)  \right | =\left \lfloor x \right \rfloor \left | \sin(\pi \left( \left \lfloor x \right \rfloor + \{x\}\right))  \right |=\left \lfloor x \right \rfloor \left | \sin\left(\pi \left \lfloor x \right \rfloor+ \pi \{x\}\right)  \right |=\\
\left \lfloor x \right \rfloor \left | (-1)^{\left \lfloor x \right \rfloor}\sin( \pi \{x\}))  \right |=\left \lfloor x \right \rfloor \left | \sin( \pi \{x\}))  \right | \tag{2}$$
Now, combining $(1)$, $(2)$ and the facts that $ \sin(\pi x)\geq0, x\in [0,1]$ and $\left|\sin(\pi x)\right|$ is periodic with period $1$
$$F(x)=\int\limits_{0}^{x}f(t)dt + C=\int\limits_{0}^{1}f(t)dt+\int\limits_{1}^{2}f(t)dt+...+\int\limits_{\left \lfloor x \right \rfloor}^{x}f(t)dt+C=\\
0+\int\limits_{1}^{2}\left | \sin(\pi t)  \right |dt+2\int\limits_{2}^{3}\left | \sin(\pi t)  \right |dt+...+\left \lfloor x \right \rfloor\int\limits_{\left \lfloor x \right \rfloor}^{x}\left | \sin(\pi t)  \right |dt+C=\\
\int\limits_{0}^{1}\left | \sin(\pi t)  \right |dt+2\int\limits_{0}^{1}\left | \sin(\pi t)  \right |dt+...+\left(\left \lfloor x \right \rfloor -1\right)\int\limits_{0}^{1}\left | \sin(\pi t)  \right |dt+\left \lfloor x \right \rfloor\int\limits_{\left \lfloor x \right \rfloor}^{x}\left | \sin(\pi t)  \right |dt+C=\\
\left(1+2+...+\left \lfloor x \right \rfloor-1\right)\int\limits_{0}^{1}\left | \sin(\pi t)  \right |dt + \left \lfloor x \right \rfloor\int\limits_{\left \lfloor x \right \rfloor}^{x}\left | \sin(\pi t)  \right |dt + C=\\
\frac{\left \lfloor x \right \rfloor \left(\left \lfloor x \right \rfloor-1\right)}{2}\cdot \frac{2}{\pi}+\left \lfloor x \right \rfloor\int\limits_{0}^{\{x\}}\left | \sin(\pi t)  \right |dt + C=\\
\frac{\left \lfloor x \right \rfloor}{\pi} \left(\left \lfloor x \right \rfloor - 1 - \cos(\pi \{x\}) +1 \right)+ C=\frac{\left \lfloor x \right \rfloor}{\pi} \left(\left \lfloor x \right \rfloor - \cos\left(\pi \left(x- \left \lfloor x \right \rfloor\right)\right) \right)+ C=\\
\frac{\left \lfloor x \right \rfloor}{\pi} \left(\left \lfloor x \right \rfloor - (-1)^{\left \lfloor x \right \rfloor}\cos\left(\pi x\right) \right)+ C$$
