Solving messy integral with modulus and trigonometry. If $$a\in \mathbb R,\int_{a-\pi}^{3\pi+a}|x-a-\pi|\sin(x/2)dx=-16$$ then a can be?
I tried substituting $x-a=u$ and then breaking into two integrals removing modulus then used $\int \sin x=-\cos x,\int x\sin x=\sin x-x\cos x$
 A: The evaluation of the integral on the left hand side of the integral equation
\begin{equation*}
\int_{a-\pi }^{3\pi +a}\left\vert x-a-\pi \right\vert \sin \left( x/2\right)\tag{1}
\,dx=-16
\end{equation*}
can be carried out starting with the substitution suggested by GFauxPas $y=x-a-\pi $ in a comment, [edit] splitting the integral into two, one for $-2\pi <y<0$ and the other for $0\leq y<2\pi $, and proceeding with the substitution $z=\frac{y+a}{2}$ and integration by parts [edit end]:
\begin{eqnarray*}
-16 &=&\int_{a-\pi }^{3\pi +a}\left\vert x-a-\pi \right\vert \sin \left(
x/2\right) \,dx \\
&=&\int_{-2\pi }^{2\pi }\left\vert y\right\vert \sin \left( \frac{y+a}{2}+
\frac{\pi }{2}\right) \,dy,\qquad\qquad y=x-a-\pi  \\
&=&\int_{-2\pi }^{2\pi }\left\vert y\right\vert \cos \left( \frac{y+a}{2}
\right) \,dy \\
&=&-\int_{-2\pi }^{0}y\cos \left( \frac{y+a}{2}\right) \,dy+\int_{0}^{2\pi
}y\cos \left( \frac{y+a}{2}\right) \,dy, \\
&=&-\left[ 2y\sin \frac{y+a}{2}+4\cos \frac{y+a}{2}\right] _{-2\pi }^{0} +\left[ 2y\sin \frac{y+a}{2}+4\cos \frac{y+a}{2}\right] _{0}^{2\pi }\tag{$\ast$} \\
&=&-8\cos \frac{a}{2}+4\pi \sin \frac{a}{2}-8\cos \frac{a}{2}-4\pi \sin 
\frac{a}{2} \\
&=&-16\cos \frac{a}{2},
\end{eqnarray*}
because
\begin{eqnarray*}
I(y) &=&\int y\cos \left( \frac{y+a}{2}\right) \,dy \\
&=&\int 2\left( 2z-a\right) \cos z\,dz,\qquad \qquad z=\frac{y+a}{2} \\
&=&4\int z\cos z\,dz-2a\int \cos z\,dz
\end{eqnarray*}
and
\begin{eqnarray*}
I(y) &=&4\left( z\sin z-\int \sin z\,dz\right) -2a\sin z \\
&=&\left( 4z-2a\right) \sin z+4\cos z \\
&=&2y\sin \frac{y+a}{2}+4\cos \frac{y+a}{2}.\tag{$\ast$}
\end{eqnarray*}
Hence $(1)$ is equivalent to the simple trigonometric equation 
\begin{equation*}
\cos \frac{a}{2}=1,\tag{2}
\end{equation*}
whose solution is
\begin{equation*}
a=4k\pi ,\text{ }k\in\mathbb{Z}.\tag{3}
\end{equation*}
