Solution:
Key idea: We lower the power with cos3x=4cos3x−3cosx; rearranged, it says cos3x=4cos3x+3cosx. Each piece is then integrated by parts, ∫uvdx=u∫vdx−∫(dxdu∫vdx)dx, with u=x.
Step 1 — Lower the power and split.
We replace cos3x and split into two integrals.
I=∫x⋅4cos3x+3cosxdx
I=41∫xcos3xdx+43∫xcosxdx
Step 2 — Integrate xcos3x by parts.
We take u=x and v=cos3x, with ∫cos3xdx=3sin3x.
∫xcos3xdx=3xsin3x−∫3sin3xdx
∫xcos3xdx=3xsin3x+9cos3x
Step 3 — Integrate xcosx by parts.
We take u=x and v=cosx, with ∫cosxdx=sinx.
∫xcosxdx=xsinx−∫sinxdx
∫xcosxdx=xsinx+cosx
Step 4 — Combine.
We multiply Step 2 by 41 and Step 3 by 43, and add the constant.
I=121xsin3x+361cos3x+43xsinx+43cosx+C
Note: the printed answer ends with 34cosx; differentiating confirms the coefficient is 43.
Therefore, ∫xcos3xdx=121xsin3x+361cos3x+43xsinx+43cosx+C.