Write f : x mapsto x sin(x)f:x↦xsin(x).
Because f(-x) = f(x)f(−x)=f(x) for all x in [-pi , pi]x∈[−π,π], you can say that
int_(-pi)^pi f(x) dx = 2 int_0^pi f(x) d x∫π−πf(x)dx=2∫π0f(x)dx.
Now, use integration by parts with
u (x) = xu(x)=x and v(x) = -cos(x)v(x)=−cos(x).
The functions u,vu,v are C^1C1 on [0,pi][0,π] and
u'(x) = 1 and v'(x) = sin(x).
The integration by parts says that
int_0^pi u(x)v'(x) dx = [u(x)v(x)]_0^pi - int_0^pi u'(x)v(x) dx,
therefore,
int_0^pi x sin(x) dx = [-x cos(x)]_0^pi + int_0^pi cos(x) dx
int_0^pi x sin(x) dx = 1 + [sin(x)]_0^pi = 1.
Finally, int_(-pi)^pi x sin(x) dx =2int_0^pi x sin(x) dx = 2.