#I=int(xsin2x+cosx)dx#
we have two integrals, the first one needs to be done by parts, the second is a standard integral. We will omit the constant of integration until the end.
#f(x)=I=int(xsin2x)dx+intcosxdx=I_1+I_2#
#I_2=intcosxdx=sinx--(1)#
#I_1=intxsin2xdx#
#IBP#
#intu(dv)/(dx)dx=uv-intv(du)/(dx)dx#
#u=x=>(du)/(dx)=1#
#(dv)/(dx)=sin2x=>v=-1/2cos2x#
#I_1=-1/2xcos2x+int1/2cos2xdx#
#I_1=-1/2xcos2x+1/4sin2x#
#:.I=I-1+I_2=f(x)=-1/2xcos2x+1/4sin2x+sinx+c#
now#f(pi/2)=-4#
#-4=-1/2pi/2cos2(pi/2)+1/4sin(2(pi/2))+sin(pi/2)+c#
#-4=-(pi/4)cancel(cos(pi))^(-1)+cancel(1/4sinpi)^0+cancel(sin(pi/2))^1+c#
#=>-4=pi/4+1+c#
#c=-5-pi/4#
#f(x)=-1/2xcos2x+1/4sin2x+sinx-5-pi/4#