Solution:
Key idea: We integrate by parts: ∫uvdx=u∫vdx−∫(dxdu∫vdx)dx. We take u=1+x as the first function, since its derivative is 1, 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=(1+x)2sin2x−∫1⋅2sin2xdx
Step 3 — Finish the remaining integral.
We use ∫sin2xdx=−2cos2x.
I=2(1+x)sin2x−21(−2cos2x)+C
I=21(1+x)sin2x+41cos2x+C
Therefore, ∫(1+x)cos2xdx=21(1+x)sin2x+41cos2x+C.