<s>[INST] Calculate $\int \frac{ 1}{\cos a\>+\> \cos x} \, dx $ where $a$ is a constant How to evaluate
$$\int \frac{ 1}{\cos(a) + \cos(x)} \, dx $$
where $a$ is a constant?
My Attempt:
I substituted in the integral:
$A = \cos(a)$
On solving by usual method, I got:
$$ \frac{2 \arctan(\frac{\sqrt{A-1} . \tan(\frac{x}{2})}{\sqrt{A+1}})}{\sqrt{A^2-1}} + C$$
where $C$ is the constant of integration and $A^2> 1$.
Now that means this solution does not work for $A = \cos(a)$.
How should I proceed with this question in the simplest possible way (beginner's approach) so that it works for $A^2 < 1$?
Thanks in advance!
 [/INST] Note
\begin{align}
\int \frac{ 1}{\cos a+ \cos x} \, dx
&=\int \frac{ 1}{2\cos \frac{x-a}2 \cos \frac{x+a}2} \, dx\\
&= \frac1{2\sin a}\int\left(\frac{\sin \frac{x+a}2}{ \cos \frac{x+a}2} -\frac{\sin \frac{x-a}2}{ \cos \frac{x-a}2} \right)dx\\
&= \frac1{\sin a} \ln\bigg|\frac{ \cos \frac{x-a}2}{\cos \frac{x+a}2 }\bigg|+C
\end{align}
</s>