Evaluate the following integrals:
$\int \frac{1}{\cos 3 x-\cos x} d x$
The denominator is of the form $\cos C-\cos D=-2 \sin \left(\frac{c+d}{2}\right) \cdot \sin \left(\frac{c-d}{2}\right)$
$\therefore \cos 3 x-\cos x=-2 \sin \left(\frac{3+1}{2} x\right) \sin \left(\frac{3-1}{2} x\right)$
$\therefore \cos 3 x-\cos x=-2 \sin 2 x \cdot \sin x$
$-2 \sin 2 x \cdot \sin x=-2 \cdot 2 \cdot \sin x \cdot \cos x \cdot \sin x$
$-2 \sin 2 x \cdot \sin x=-4 \sin ^{2} x \cdot \cos x$
Also $\sin ^{2} x+\cos ^{2} x=1$
$\Rightarrow \int \frac{\sin ^{2} x+\cos ^{2} x}{-4 \sin ^{2} x \cos x} d x$
$\Rightarrow \frac{-1}{4} \int \frac{\sin ^{2} x}{\sin ^{2} x \cdot \cos x} d x+\frac{-1}{4} \int \frac{\cos ^{2} x}{\sin ^{2} x \cdot \cos x} d x$
$\Rightarrow \frac{-1}{4}\left(\int \frac{1}{\cos x} d x+\int \frac{\cos x}{\sin ^{2} x} d x\right)$
$\Rightarrow \frac{-1}{4} \int \sec x d x+\int \csc x \cdot \cot x d x$
$d(\csc x)=\csc x \cdot \cot x$
$\therefore \int \csc x \cot x d x=\csc x+c$
$\therefore \int \sec x d x+\int \csc x \cdot \cot x d x$
$\because \int \sec x d x=\log |\sec x+\tan x|+c$
$\Rightarrow \frac{-1}{4}(\csc x+\log |\sec x+\tan x|)+c$