Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

How do you integrate $\int \frac{1}{a + \cos x} dx$? Is it solvable by elementary methods? I was trying to do it while incorrectly solving a homework problem but I couldn't find the answer.


share|improve this question
The Weierstrass substitution $u=\tan(x/2)$ (Wikipedia) turns it into an integrating a rational function problem. –  André Nicolas Apr 20 '12 at 23:22
Wolfram|Alpha gives a surprisingly complicated antiderivative. If you click on "Show Steps", you can see how it's derived using the Weierstraß substitution that André suggested. –  joriki Apr 20 '12 at 23:25
@joriki: To remove your surprise, see my answer :-) –  Aryabhata Apr 20 '12 at 23:42
@Aryabhata: I'm not sure why that should lessen my surprise :-) I can see that it's complicated, either from your answer or from Wolfram|Alpha's; what I meant was that I wouldn't have expected it to be that complicated just from the integrand, which seems relatively tame at first sight. –  joriki Apr 20 '12 at 23:50
@joriki: I see, I should have chosen the word 'lessen' instead of 'remove' :-) –  Aryabhata Apr 20 '12 at 23:52

3 Answers 3

up vote 8 down vote accepted

Let $ y = \frac{x}{2}$.

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


$$\int \frac{1}{a + \cos x} \text{d}x = \int \frac{2}{a + \cos 2y} \text{d}y $$

$$ = \int \frac{ 2\sec^2 y}{ a + 1 + (a-1)\tan^2 y} \text{d} y$$

Now make the subsitution $t = \tan y$.

I remember having used the same trick before: Summing the series $ \frac{1}{2n+1} + \frac{1}{2} \cdot \frac{1}{2n+3} + \cdots \ \text{ad inf}$

share|improve this answer
Clever! Thanks for the solution :) –  badatmath Apr 23 '12 at 4:13

Expanding André's comment

Say we have an integral of the form

$$\int R(\sin x,\cos x) dx$$

Then the substitution

$$t= \tan\frac x 2 $$

will change the integral into a rational function of

$$\sin x = \frac{2t}{1+t^2}$$

$$\cos x = \frac{1-t^2}{1+t^2}$$

and of course

$$dx = \frac{2 dt}{1+t^2}$$

Would you like to try solve it that way or want a full solution?

share|improve this answer


Let's consider $\cos x = \frac{1-t^2}{1+t^2}; t = \tan\frac{x}{2}; dx=\frac{2}{1+t^2} dt.$ Then we get that our integral becomes:

$$J = \int \frac{2dt}{(a+b)+(a-b) t^2}$$

I. For the case $a>b$, consider $a+b=u^2$ and $a-b=v^2$, and obtain that: $$J = 2\int \frac{dt}{u^2+v^2 t^2}=\frac{2}{uv} \arctan\frac{vt}{u} +C.$$ Turning back to our notation we get: $$I=\frac{2}{\sqrt{a^2-b^2}} \arctan\left(\sqrt{\frac{a-b}{a+b}} \tan\frac{x}{2} \right) + C.$$

II. For the case $a<b$, consider $a+b=u^2$ and $a-b=-v^2$, and obtain that: $$J = 2\int \frac{dt}{u^2-v^2 t^2}=\frac{1}{uv}\ln\frac{u+vt}{u-vt} \ +C.$$

Turning back again to out initial notation and have that:

$$I=\frac{2}{\sqrt{b^2-a^2}} \ln\frac{b+a \cos x + \sqrt{b^2-a^2} \sin x}{a+b \cos x} + C.$$ Also, note that $x$ must be different from ${+}/{-}\arccos(-\frac{a}{b})+2k\pi$ if $|\frac{a}{b}|\leq1$.


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.