d[uv]= vdu+udv this is the product rule, where v and u are both functions of x.
Let u =3x and v=cos^2x
so we have ......cos^2x.[3]+3x[-2sinxcosx]
=3cos^2x-6xsinxcosx.....=3cosx[cosx-2xsinx].
cos^2x=[cosx]^2 and so need to use the chain rule to differentiate this, =2cosx, times the derivative of cosx which is -sinx, so d/dxcos^2x=-2sinxcosx. hope this helped.