# Another interesting way to evaluating the integral $\int \frac{\cos(x)}{a+b \cos(x)}\:dx$

I need help in evaluating the following integral, please: $$\int\frac{\cos(x)}{a+b\cos(x)}dx$$ so that we get the following result: $$\int \frac{\cos x }{a + b\cos x}\:dx = \frac{a}{b\sqrt{a^2-b^2}} \arcsin\left(\frac{b+a\cos x}{a+b\cos x}\right) - \frac1b \arcsin(\cos x) + C$$

Also, I would say I don't have a clue how the substitution can be done. I know another well-known answer which is done using the tangent half-angle substitution, but the result I am asking about exists nowhere online as far as I am concerned. This interesting result is given as a hint to a problem in a physics book and it is completely correct as you can test it yourself. I would appreciate any help. Thanks.

(edit: I came to know that the substitution [u=cos(x)] would lead to the desired formula. So, maybe you can help with that as a hint.)

• If you know the answer, and wonder how to get there, you can just differentiate and see what happens. Then do it in reverse, and voila! – Arthur Dec 12 '18 at 17:42
• the answer only seems to be valid for $|b| < |a|$ otherwise the root becomes complex – gt6989b Dec 12 '18 at 17:45
• Use this here mathworld.wolfram.com/WeierstrassSubstitution.html – Dr. Sonnhard Graubner Dec 12 '18 at 17:46
• @Arthur I tried doing so and still can't figure it out. – physicist bychoice Dec 12 '18 at 19:03
• @gt6989b yes, a>b – physicist bychoice Dec 12 '18 at 19:04

$$I=\int\frac{\cos x}{a+b\cos x}dx$$ $$Ib=\int\frac{b\cos x}{a+b\cos x}dx$$ $$Ib=\int\frac{a+b\cos x}{a+b\cos x}dx-a\int\frac{dx}{a+b\cos x}$$ $$Ib=x-a\int\frac{dx}{a+b\cos x}$$ Then we focus on $$J=\int\frac{dx}{a+b\cos x}$$ We may write the integral as $$J=-\int\frac{\sec^2(\frac x2)}{(b-a)\tan^2(\frac x2)-b-a}dx$$ $$J=\frac1{a+b}\int\frac{\sec^2(\frac x2)dx}{\frac{a-b}{a+b}\tan^2(\frac x2)+1}$$ Then we let $$\tan(x/2)=\sqrt{\frac{a+b}{a-b}}u\ \ \Rightarrow\ \ \sec^2(x/2)dx=2\sqrt{\frac{a+b}{a-b}}du$$ Which gives $$J=\frac1{a+b}\int\frac{2\sqrt{\frac{a+b}{a-b}}du}{\frac{a-b}{a+b}\big(\sqrt{\frac{a+b}{a-b}}u\big)^2+1}$$ $$J=\frac2{\sqrt{a^2-b^2}}\int\frac{du}{u^2+1}$$ $$J=\frac2{\sqrt{a^2-b^2}}\arctan u$$ $$J=\frac2{\sqrt{a^2-b^2}}\arctan\bigg[\sqrt{\frac{a-b}{a+b}}\tan\bigg(\frac x2\bigg)\bigg]$$ Hence we have $$Ib=x-\frac{2a}{\sqrt{a^2-b^2}}\arctan\bigg[\sqrt{\frac{a-b}{a+b}}\tan\bigg(\frac x2\bigg)\bigg]$$ Which means $$I=\frac{x}b-\frac{2a}{b\sqrt{a^2-b^2}}\arctan\bigg[\sqrt{\frac{a-b}{a+b}}\tan\bigg(\frac x2\bigg)\bigg]+C$$
Hint: Use $$u=\tan(\frac{x}{2})$$ so $$du=\frac{1}{2}\sec^2(\frac{x}{2})dx$$ and $$\sin(x)=\frac{2u}{u^2-1},\cos(x)=\frac{1-u^2}{1+u^2}$$ and $$dx=\frac{2du}{1+u^2}$$ and we get $$\int\frac{2(1-u^2)}{(u^2+1)^2\left(a+\frac{b(1-u^2)}{u^2+1}\right)}du$$