I've been encountering the problem of the below integration.
$$ \int_{0 }^{2\pi } \frac{ d\theta }{ R+ r \cdot \cos^{}\left(\theta_{} \right) } \tag{1} $$
The official description states that the above integration formula can be calculated using substitution of integration.
$$ t=\tan^{}\left( \frac{ \theta_{} }{ 2 } \right) $$
$$ \therefore ~~ \int_{0 }^{2\pi } \frac{ d\theta }{ R+ r \cdot \cos^{}\left(\theta_{} \right) } = \frac{ 2\pi }{ \sqrt{ R ^{2} -r ^{2} } } $$
Currently I can't derive the above RHS.
I think firstly find out the form of result of calculations of indefinite integral of eqn1 is wiser way.
What I tried so far are as below.
$$ t= \tan^{}\left( \frac{ \theta_{} }{ 2 } \right) $$
$$ \frac{ \theta_{} }{ 2 }= \tan^{-1} \left( t \right) ~~ \leftarrow~~ \text{Thought that this approach won't work} $$
$$ \frac{ dt }{ d\theta } = \sec^{2}\left( \frac{ \theta_{} }{ 2 } \right) \cdot \frac{1}{2} $$
$$ \frac{ 2dt }{ d\theta } = \sec^{2}\left( \frac{ \theta_{} }{ 2 } \right) $$
$$ \frac{ d\theta }{ 2 dt } =\sec^{-2}\left( \frac{ \theta_{} }{ 2 } \right) $$
$$ \frac{ d\theta }{ 2 dt } = \left( \sec^{}\left( \frac{ \theta_{} }{ 2 } \right) \right)^{-2} $$
$$ \frac{ d\theta }{ 2 dt } = \left( \cos^{-1}\left( \frac{ \theta_{} }{ 2 } \right) \right)^{-2} $$
$$ \frac{ d\theta }{ 2 dt } = \cos^{2}\left( \frac{ \theta_{} }{ 2 } \right) $$
$$ d\theta = 2 dt \cdot \cos^{2}\left(\frac{ \theta_{} }{ 2 } \right) $$
First things to first, the equation1 has $~ \cos^{}\left(\theta_{} \right) ~$ however how can I handle $~ t=\tan^{}\left( \frac{ \theta_{} }{ 2 } \right) ~$ ??
The goal with the $t=\tan\frac{\theta}{2}$ substitution is to find all trig functions in terms of $t$. Of course with any integral substitution, the first thing is to find $\frac{dt}{d\theta}$. $$\frac{dt}{d\theta}=\frac{1}{2}\sec^2\frac{\theta}{2}$$ $$\frac{dt}{d\theta}=\frac{t^2+1}{2}$$
Since we also have a $\cos\theta$ term in our integrand, we need to find $\cos\theta$ in terms of $t$. We start with $$\cos\theta=2\cos^2\frac{\theta}{2}-1$$ $$\cos\theta=\frac{2}{\sec^2\frac{\theta}{2}}-1$$ $$\cos\theta=\frac{2}{t^2+1}-1$$ $$\cos\theta=\frac{1-t^2}{t^2+1}$$
As for the bounds of the resulting integral, we can split the bounds in half, apply the substitution, and then merge the two bounds. This gives us a bounds of $t\in (-\infty,\infty)$, providing that both halves are finite. Our integral is now $$\int_{-\infty}^\infty \frac{2}{t^2+1}\cdot\frac{1}{R+\frac{1-t^2}{t^2+1}r}\, dt$$ $$=\int_{-\infty}^\infty 2\cdot\frac{1}{(R-r)t^2+(R+r)}\, dt$$ $$=\frac{2}{R+r}\int_{-\infty}^\infty \frac{dt}{\frac{R-r}{R+r}t^2+1}$$ $$=\frac{2}{\sqrt{R^2-r^2}}\left[\tan^{-1} \left(\sqrt{\frac{R-r}{R+r}}t\right)\right]_{-\infty}^\infty$$ As long as $R>r$, then we can see that $$\lim_{t\to\infty} \tan^{-1} \left(\sqrt{\frac{R-r}{R+r}}t\right)=\frac{\pi}{2}$$ $$\lim_{t\to -\infty} \tan^{-1} \left(\sqrt{\frac{R-r}{R+r}}t\right)=-\frac{\pi}{2}$$ Hence, our integral evaluates to $$=\boxed{\frac{2\pi}{\sqrt{R^2-r^2}}}$$