Consider the given integral.
I=∫xcosxdx
We know that
∫uvdx=u∫vdx−∫(ddx(u)∫vdx)dx
Therefore,
I=xsinx−∫1×(sinx)dx
I=xsinx−∫(sinx)dx
I=xsinx−(−cosx)+C
I=xsinx+cosx+C