Indefinite integration of $\int\frac{1}{\cos(x-1)\cos(x-2)\cos(x-3)}\,\textrm dx$ 
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?
 A: Hint:
I found the expression $$=\dfrac{\sin(x-1)}{\cos(x-1)\cos(x-3)}-\dfrac{\sin(x-2)}{\cos(x-2)\cos(x-3)}$$
Now,
$$\dfrac{\sin(x-1)}{\cos(x-1)\cos(x-3)}$$
$$=\dfrac{\sin(x-1)}{\sin2}\cdot\dfrac{\sin(x-1-(x-3))}{\cos(x-1)\cos(x-3)}$$
$$=\dfrac{1-\cos^2(x-1)}{\sin2\cos(x-1)}-\dfrac{\sin(x-1)\sin(x-3)}{\sin2\cos(x-3)}$$
The first part can be managed easily.
For the second part,
$$\dfrac{\sin(x-1)\sin(x-3)}{\cos(x-3)}=\dfrac{\sin(x-3+2)\sin(x-3)}{\cos(x-3)}=\dfrac{\cos2\sin^2(x-3)}{\cos(x-3)}-\sin2\sin(x-3)$$
Can you take it home from here?
A: 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.
A: Little bit of trigonometry
$$\begin{align}
\frac{\tan(x-1)}{\cos(x-2)} 
&= \frac{\tan(x-1)}{\cos((x-1) - 1)} \\
&= \frac{\tan(x-1)}{\cos(x-1)\cos 1  + \sin(x-1)\sin 1} \\
&= \frac{\tan(x-1)\sec(x-1)}{\cos 1 + \tan(x-1)\sin 1} \\
&= \frac{d\left(\sec(x-1)\right)}{\cos1 + \sin 1 \sqrt{\sec^2(x-1) - 1}} \\
&= \frac{du}{\cos 1 + \sin 1 \sqrt{u^2-1}}\end{align}$$
So, we are to calculate in a more general case
$$\begin{align}
\int \frac{du}{a+b\sqrt{u^2-1}} \end{align}$$
You can find a solution for this here and it gives
$$\frac{1}{2b}\ln\frac{|\sqrt{u^2-1}-1|}{|\sqrt{u^2-1}+1|} + \frac{a}{b\sqrt{a^2+b^2}}\left(\text{artanh}\frac{bu}{\sqrt{b^2+a^2}} - \text{artanh}\frac{\sqrt{b^2+a^2}\sqrt{u^2-1}}{au}\right) + C$$
Now substitute back $\sqrt{u^2 - 1} = \tan(x-1)$ and $a = \cos 1$, $b = \sin 1$ to get something prettier.
