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.)
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$$