# 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!

• If $A^2<1$, the denominator has zeros. how do you rectify that arctan in your answer? Example: if your $cos(a)=0.5$, your integral takes of the form $\frac{-4}{t^2-3}$ through the tangent half angle formula. That integral won't turn into an arctan, it will be logarithms. – imranfat Aug 26 '20 at 15:12
• @imranfat If I am not wrong, $A^2 < 1$ makes the denominator imaginary! If you can suggest me how I can modify my initial steps, that will be great! – Shatabdi Sinha Aug 26 '20 at 15:15
• It does make the denominator imaginary, but realize that the integral has a factorable denominator, so through partial fraction decomposition, the anti derivative consists of $ln$ terms and not an arctan. – imranfat Aug 26 '20 at 15:16
• @imranfat Thank you for suggesting me that! – Shatabdi Sinha Aug 26 '20 at 15:24

\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}
Use the substitution $$t=\tan(x/2)$$ Then $$\cos a+\cos x=\cos a+\frac{1-t^2}{1+t^2}=\frac{1+\cos a-(1-\cos a)t^2}{1+t^2}$$ and $$dx=\frac{2}{1+t^2}\,dt$$ Now, for $$\cos a\ne1$$, set $$b=\sqrt{(1+\cos a)/(1-\cos a)}$$ and the integral becomes $$\frac{1}{b^2}\int\frac{2}{b^2-t^2}\,dt$$ that's easily dealt with by using partial fractions: $$\frac{2}{b^2-t^2}=\frac{1/b}{b-t}+\frac{1/b}{b+t}$$ The particular case when $$\cos a=1$$ can be treated separately.