Answer
$$\frac{1}{6} (3 \sin x-1)^{2}+C$$
Work Step by Step
Given $$ \int \cos x(3 \sin x-1) d x $$
Let
$$u=3 \sin x-1 \ \ \ \ \Rightarrow \ \ \ du =3\cos x dx $$
\begin{aligned} \int \cos x(3 \sin x-1) d x &=\frac{1}{3} \int u d u \\ &=\frac{1}{3}\left(\frac{1}{2} u^{2}+C\right) \\ &=\frac{1}{6} u^{2}+C \\
&= \frac{1}{6} (3 \sin x-1)^{2}+C \end{aligned}