TITLE: Indefinite integration of $\int\frac{1}{\cos(x-1)\cos(x-2)\cos(x-3)}\,\textrm dx$
QUESTION [6 upvotes]: Integrate $$\int\dfrac{1}{\cos(x-1)\cos(x-2)\cos(x-3)}\,\textrm dx$$

My Attempt:
Using, $$\tan A-\tan B=\dfrac{\sin(A-B)}{\cos A\cdot \cos B}$$
The given integral can be transformed as
$$\int\dfrac{\tan(x-1)}{\cos(x-2)}\,\textrm dx - \int\dfrac{\tan(x-3)}{\cos(x-3)}\,\textrm dx$$
The right most integral can be calculated easily by writing $\tan(x-3)$ as $\frac{\sin(x-3)}{\cos(x-3)}$ and then by a substituiton $\cos(x-3)$ as $t$. But I have no clue for the left most integral. How to evaluate that?

REPLY [3 votes]: Note $\cos(x-n) = \cos x\cos n + \sin x \sin n$ and rewrite the integrand as
\begin{align}
\frac{1}{{\cos(x-1)\cos(x-2)\cos(x-3)}}
={}\frac{\csc1\csc2\csc3\sec^3 x}{(\tan x+\cot 1) (\tan x+\cot 2) (\tan x+\cot 3)}
\end{align}
Substitute $t=\tan x $ and perform the partial fractionization
\begin{align}
&\int \frac{1}{\cos(x-1)\cos(x-2)\cos(x-3)}\,dx \\
={}& \frac{1}{\sin 2}\int\frac{\sqrt{1+t^2}}{t+\cot1}\,dt
-\frac{1}{\sin1}\int\frac{\sqrt{1+t^2}}{t+\cot2}\,dt
 + \frac{\sin 3}{\sin1\sin2}\int\frac{\sqrt{1+t^2}}{t+\cot3} \, dt\\
\end{align}
The three integrals are of the same form and can be readily carried out.