Sử dụng đẳng thức: $\frac{dx}{\cos^2x}=d(\tan x) $, ta có:
$\int\limits f(x)dx=\int\limits \frac{dx}{3\tan^2x-2\tan x-1)\cos^2x}=\frac{1}{3}\int\limits \frac{d(\tan x)}{(\tan x-\frac{1}{2} )^2-\frac{4}{9} } $
$=\frac{1}{3}\int\limits \frac{d(\tan -\frac{1}{3}) }{(\tan x-\frac{1}{3})^2-\frac{4}{9} }=\frac{1}{4}\ln|\frac{\tan x-\frac{1}{3}-\frac{2}{3} }{\tan x -\frac{1}{3}+\frac{2}{3} } | $
$=\frac{1}{4}\ln|\frac{\tan x-1}{3\tan x+1} |+C= \frac{1}{4}\ln|\frac{\sin x-\cos x}{3\sin x+\cos x} |+C $