2. Let $u=x\implies du=dx$ and $dv=f(x)dx\implies v=\int f(x)dx$.
So we get $\int xf(x)dx = x\int f(x)dx -\iint f(x)dx dx$.