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