Let
I=int(xsinx^2+tan^2x-cosx)dx
By sum rule
I=int(xsinx^2)dx+int(tan^2x)dx+int(cosx)dx
Let
I_1=int(xsinx^2)dx
I_2=int(tan^2x)dx
I_3=int(cosx)dx
I=I_1+I_2-I_3
Now,
I_1=int(xsinx^2)dx
Rearranging
I_1=int(sinx^2)(xdx)
Let
u=x^2
sinx^2=sinu
(du)/dx=2x
xdx=1/2du
I_1=intsinu(1/2du)
I_1=-1/2int(-sinudu)
int-sinudu=cosu
u=x^2
I_1=-1/2cosx^2
I_2=int(tan^2x)dx
sec^2x-tan^2x=1
tan^2x=sec^2x-1
int(tan^2x)dx=int(sec^2x-1)dx
=intsec^2xdx-int1dx
intsec^2xdx=tanx
int1dx=x
int(tan^2x)dx=tanx-x
I_2=tanx-x
I_3=int(cosx)dx
intcosxdx=sinx
I_3=sinx
I=I_1+I_2-I_3
I=int(xsinx^2+tan^2x-cosx)dx
I_1=-1/2cosx^2
I_2=tanx-x
I_3=sinx
int(xsinx^2+tan^2x-cosx)dx=-1/2cosx^2+tanx-x-sinx
Also
f(pi)=-2
Here,
f(x)=int(xsinx^2+tan^2x-cosx)dx+C
f(pi)=-1/2cospi^2+tanpi-pi-sinpi+C
tanpi=0
#sinpi=0
-2=-1/2cospi^2-pi+C#
C=pi-2-1/2cospi^2
f(x)=-1/2cosx^2+tanx-x-sinx+(pi-2-1/2cospi^2)