Solution:
Key idea: We integrate by parts: ∫uvdx=u∫vdx−∫(dxdu∫vdx)dx. We take u=x as the first function and v=cos2x as the second.
Step 1 — Find the pieces needed.
We differentiate the first function and integrate the second.
dxdu=1
∫cos2xdx=2sin2x
Step 2 — Apply the parts formula.
We put these into the formula.
I=x⋅2sin2x−∫1⋅2sin2xdx
Step 3 — Finish the remaining integral.
We use ∫sin2xdx=−2cos2x, so the minus sign in front becomes a plus.
I=2xsin2x−21(−2cos2x)+C
I=2xsin2x+4cos2x+C
Therefore, ∫xcos2xdx=21xsin2x+41cos2x+C.