Answer
$$ 9\tan x -\frac{11}{2}x+\frac{1}{4}\sin 2x+C$$
Work Step by Step
Given $$\int(3 \sec x-\cos x)^{2} d x$$
Then
\begin{align*}
\int(3 \sec x-\cos x)^{2} d x&=\int(9 \sec^2 x-6+\cos^2 x) d x\\
&= \int(9 \sec^2 x-6+\frac{1}{2}+\frac{1}{2}\cos2 x) d x\\
&= 9\tan x -\frac{11}{2}x+\frac{1}{4}\sin 2x+C
\end{align*}