You would use the chain rule to derive the function. You would first use the cos derivative to get the -sin(3theta) portion. Then you would derive 3theta to get 3. The final answer would multiply these steps to get -3sin(3theta). Symbolab can provide a better visual. derivative of cos(3x) (symbolab.com)
r=cos(3theta)
dr/dtheta=-3sin(3theta)