What is int1/(a+cos(x))*dx where a is a constant?

Apr 21, 2017

$\int \frac{1}{a + \cos \left(x\right)} \mathrm{dx} = \frac{2}{\sqrt{{a}^{2} - 1}} {\tan}^{-} 1 \left(\tan \left(\frac{x}{2}\right) \sqrt{\frac{a - 1}{a + 1}}\right) + C$

Explanation:

We will rewrite $\cos \left(x\right)$ using some identities. Starting with the cosine double angle formula:

$\cos \left(2 \alpha\right) = 2 {\cos}^{2} \left(\alpha\right) - 1$

Let $\alpha = \frac{x}{2}$ to show that

$\cos \left(x\right) = 2 {\cos}^{2} \left(\frac{x}{2}\right) - 1$

Rewriting:

$\cos \left(x\right) = \frac{2}{\sec} ^ 2 \left(\frac{x}{2}\right) - 1 = \frac{2 - {\sec}^{2} \left(\frac{x}{2}\right)}{\sec} ^ 2 \left(\frac{x}{2}\right)$

The denominator of the integrand is then:

$a + \cos \left(x\right) = a + \frac{2 - {\sec}^{2} \left(\frac{x}{2}\right)}{\sec} ^ 2 \left(\frac{x}{2}\right) = \frac{2 + \left(a - 1\right) {\sec}^{2} \left(\frac{x}{2}\right)}{\sec} ^ 2 \left(\frac{x}{2}\right)$

In the numerator, let ${\sec}^{2} \left(\frac{x}{2}\right) = {\tan}^{2} \left(\frac{x}{2}\right) + 1$:

$a + \cos \left(x\right) = \frac{2 + \left(a - 1\right) \left({\tan}^{2} \left(\frac{x}{2}\right) + 1\right)}{\sec} ^ 2 \left(\frac{x}{2}\right)$

$\textcolor{w h i t e}{a + \cos \left(x\right)} = \frac{a + 1 + \left(a - 1\right) {\tan}^{2} \left(\frac{x}{2}\right)}{\sec} ^ 2 \left(\frac{x}{2}\right)$

So:

$I = \int \frac{1}{a + \cos \left(x\right)} \mathrm{dx} = \int {\sec}^{2} \frac{\frac{x}{2}}{a + 1 + \left(a - 1\right) {\tan}^{2} \left(\frac{x}{2}\right)} \mathrm{dx}$

Let $u = \tan \left(\frac{x}{2}\right)$. This implies that $\mathrm{du} = \frac{1}{2} {\sec}^{2} \left(\frac{x}{2}\right) \mathrm{dx}$:

$I = 2 \int \frac{1}{a + 1 + \left(a - 1\right) {u}^{2}} \mathrm{du}$

Hopefully we can see an inverse tangent integral in the making.

Let $\left(a - 1\right) {u}^{2} = \left(a + 1\right) {\tan}^{2} \left(\theta\right)$.

This implies that $\sqrt{a + 1} \tan \left(\theta\right) = \sqrt{a - 1} \left(u\right)$, so $\sqrt{a + 1} {\sec}^{2} \left(\theta\right) d \theta = \sqrt{a - 1} \mathrm{du}$.

Then:

$I = \frac{2}{\sqrt{a - 1}} \int \frac{1}{a + 1 + \left(a + 1\right) {\tan}^{2} \left(\theta\right)} \sqrt{a + 1} {\sec}^{2} \left(\theta\right) d \theta$

$\textcolor{w h i t e}{I} = \frac{2 \sqrt{a + 1}}{\sqrt{a - 1} \left(a + 1\right)} \int {\sec}^{2} \frac{\theta}{1 + {\tan}^{2} \left(\theta\right)} d \theta$

Since $1 + {\tan}^{2} \left(\theta\right) = {\sec}^{2} \left(\theta\right)$:

$I = \frac{2}{\sqrt{a - 1} \sqrt{a + 1}} \int d \theta = \frac{2}{\sqrt{{a}^{2} - 1}} \theta + C$

$\sqrt{a + 1} \tan \theta = \sqrt{a - 1} \left(u\right)$ implies that $\theta = {\tan}^{-} 1 \left(u \sqrt{\frac{a - 1}{a + 1}}\right)$:

$I = \frac{2}{\sqrt{{a}^{2} - 1}} {\tan}^{-} 1 \left(u \sqrt{\frac{a - 1}{a + 1}}\right) + C$

$\textcolor{w h i t e}{I} = \frac{2}{\sqrt{{a}^{2} - 1}} {\tan}^{-} 1 \left(\tan \left(\frac{x}{2}\right) \sqrt{\frac{a - 1}{a + 1}}\right) + C$

Which is only valid when $\left(a + 1\right) \left(a - 1\right) > 0$, or for all values of $a$ except $- 1 < = a < = 1$.