Evaluate $\int \frac{1}{\cos (x-a) \cos (x-b)} d x$
Let $I=\int \frac{1}{\cos (x-a) \cos (x-b)} d x$
Multiply and divide $\frac{1}{\sin (a-b)}$ in R.H.S we get,
$I=\frac{1}{\sin (a-b)} \int \frac{\sin (a-b)}{\cos (x-a) \cos (x-b)} d x$
We can write above integral as:
$=\frac{1}{\sin (a-b)} \int \frac{\sin (a-b+x-x)}{\cos (x-a) \cos (x-b)} d x$
$=\frac{1}{\sin (a-b)} \int \frac{\sin [(x-b)-(x-a)]}{\cos (x-a) \cos (x-b)} d x$
$=\frac{1}{\sin (a-b)} \int\left[\frac{\sin (x-b) \cos (x-a)-\cos (x-b) \sin (x-a)}{\cos (x-a) \cos (x-b)}\right] d x$
$[\because \sin (A+B)=\sin A \cdot \cos B-\cos A \cdot \sin B]$
$=\frac{1}{\sin (a-b)} \int\left[\frac{\sin (x-b) \cos (x-a)}{\cos (x-a) \cos (x-b)}-\frac{\cos (x-b) \sin (x-a)}{\cos (x-a) \cos (x-b)}\right] d x$
By simplifying we get,
$=\frac{1}{\sin (a-b)} \int\left[\frac{\sin (x-b)}{\cos (x-b)}-\frac{\sin (x-a)}{\cos (x-a)}\right] d x$
$=\frac{1}{\sin (a-b)} \int[\tan (x-b)-\tan (x-a)] d x$
$=\frac{1}{\sin (a-b)}[-\log |\cos (x-b)|+\log |\cos (x-a)|]$
$\left[\because \int \tan x d x=-\log |\cos x|+C\right]$
$=\frac{1}{\sin (a-b)}[\log |\cos (x-a)|-\log |\cos (x-b)|]$
$=\frac{1}{\sin (a-b)}\left[\log \left|\frac{\cos (x-a)}{\cos (x-b)}\right|\right]+C$
$\therefore I=\int \frac{1}{\cos (x-a) \cos (x-b)} d x=\frac{1}{\sin (a-b)}\left[\log \left|\frac{\cos (x-a)}{\cos (x-b)}\right|\right]+C$