Given, $f(x) \cos x+ g(x) \sin x+ C$
$=\int[(3 x-1) \cos x+(1-2 x) \sin x] d x$
$=\int\underset{I}{(3 x-1)} \underset{II}{\cos x d x}+\int \underset{I}{(1-2 x)} \underset{II}{\sin x d x}$
$=(3 x-1) \sin x-\int 3 \sin x d x-(1-2 x) \cos x +\int(-2) \cos x d x$
(using integration by parts)
$=(3 x-1) \sin x+3 \cos x-(1-2 x) \cos x -2 \sin x +C$
$=(3 x-1-2) \sin x+(3-1+2 x) \cos x+ C$
$\Rightarrow f(x) \cos x+ g(x) \sin x +C$
$=3(x-1) \sin x+2(x+1) \cos x+ C$
On comparing the coefficients of $\cos x$ and $\sin x$, we get
$f(x)=2(x+1)$ and $g(x)=3(x-1)$