Answer
$$\frac{1}{3}\sin(3 \theta)-2\tan\left(\frac{\theta}{4}\right)+c.
$$
Work Step by Step
Since $(\sin(3 \theta))'= 3\cos (3 \theta)$ and $(\tan\left(\frac{\theta}{4}\right))'=\frac{1}{4}\sec ^{2}\left(\frac{\theta}{4}\right)$ , we have
$$
\int\left(\cos (3 \theta)-\frac{1}{2} \sec ^{2}\left(\frac{\theta}{4}\right)\right) d \theta\\
=\frac{1}{3}\sin(3 \theta)-\frac{4}{2}\tan\left(\frac{\theta}{4}\right)+c\\
=\frac{1}{3}\sin(3 \theta)-2\tan\left(\frac{\theta}{4}\right)+c.
$$