Integration by parts: ∫uvdx=u∫vdx−∫(u′∫vdx)dx, with u the first function.
Given / To find: the indefinite integral, then its value on [0,π].
Step 1 — reduce the power. Using sin2x=21−cos2x,
∫xsin2xdx=21∫xdx−21∫xcos2xdx=4x2−21J
Step 2 — find J by parts with u=x and v=cos2x:
J=∫xcos2xdx=x⋅2sin2x−∫2sin2xdx=2xsin2x+4cos2x
Step 3 — combine.
∫xsin2xdx=4x2−4xsin2x−8cos2x+C
Step 4 — the definite integral. Let F(x)=4x2−4xsin2x−8cos2x. Then F(π)=4π2−0−81 and F(0)=0−0−81, so
∫0πxsin2xdx=F(π)−F(0)=4π2
Answer: ∫xsin2xdx=4x2−4xsin2x−8cos2x+C, and ∫0πxsin2xdx=4π2.
Note: A quick check by property P4: with I=∫0πxsin2xdx, also I=∫0π(π−x)sin2xdx, so 2I=π∫0πsin2xdx=π⋅2π and I=4π2.