To answer your question, this could be the possible answer and i hope you understand and interpret it correctly:
[Integrate [0, 1/2] xcos(pix
let u=x so that du=dx
and v=intgral cos (xpi)dx
v=(1/pi)sin(pix)
integration by parts
uv-itgral[0,1/2]vdu just plug ins
(1/pi)sinpix]-(1/pi)itgrlsin(pix)dx from 0 to 1/2
(1/pi)x sinpix - (1/pi)[-(1/pi) cos pix] from 0 to 1/2
=(1/2pi)+(1/pi^2)[cos pi*x/2-cos 0]
=1/2pi - 1/2pi^2
=(pi-2)/2pi^2 ans