# Evaluate $\int_0^{2\pi}\frac{\cos(\theta)}{1 + A\sin(\theta) + B\cos(\theta)}\, \mathrm{d}\theta \ \text{ for }\ (A^2+B^2) <<1$

I need to evaluate the definite integral $\int_0^{2\pi}\frac{\cos(\theta)}{1 + A\sin(\theta) + B\cos(\theta)}\, \mathrm{d}\theta \ \text{ for }\ A<<1, B<<1, (A^2+B^2) <<1,$

For unresricted (but real) A&B, Wolfram Alpha provides the following indefinite general solution:-

$$\int \frac{\cos(\theta)}{1 + A\sin(\theta) + B\cos(\theta)}\, \mathrm{d}\theta = \left( \frac{1}{A^2+B^2}\right) \left[ \frac{2B}{K} \tanh^{-1} \left( \frac{A-(B-1)\tan\left(\frac{\theta}{2}\right)}{K}\right) + F(\theta)\right]$$ where $F(\theta) = A \ln(1 + A\sin\theta+B\cos\theta)+B\theta$,

and $K = \sqrt{A^2 + B^2 -1}$, therefore K is complex for the range of A,B I am interested in.

In a previous question seeking a solution for the similar, but slightly simpler, definite integral (with numerator $1$ rather than $\cos\theta$) user Dr. MV found a solution given by: $$\int_0^{2\pi}\frac{1}{1 + A\sin(\theta) + B\cos(\theta)}\, \mathrm{d}\theta = \frac{2\pi}{\sqrt{1-A^2-B^2}}\text{ } (\text { for} \sqrt{A^2+B^2}<1)$$.

My question: Can similar solutions be found for these two definite integrals $$\int_0^{2\pi}\frac{\cos\theta}{1 + A\sin(\theta) + B\cos(\theta)}\, \mathrm{d}\theta \tag 1$$ and $$\int_0^{2\pi}\frac{\sin\theta}{1 + A\sin(\theta) + B\cos(\theta)}\, \mathrm{d}\theta \tag 2$$?

# EDIT

I have taken the solution proposed by user Chappers.

By simultaneous equations in A,B,I,J it turns out that $$I=\int_0^{2\pi}\frac{\cos\theta}{1 + A\sin(\theta) + B\cos(\theta)}\, \mathrm{d}\theta = \frac{B}{A^2+B^2} 2\pi (1-\frac{1}{\sqrt{1-A^2-B^2}})$$ and $$J=\int_0^{2\pi}\frac{\sin\theta}{1 + A\sin(\theta) + B\cos(\theta)}\, \mathrm{d}\theta = \frac{A}{A^2+B^2} 2\pi (1-\frac{1}{\sqrt{1-A^2-B^2}})$$.

These were confirmed in a numerical model.

• 1) You can consider the last two integrals as real/imaginary parts of the same integral with $e^{i\theta}$ in the numerator instead. 2) Note that $A\sin \theta+B\cos\theta = R \cos(\theta+\phi)$ where $R=\sqrt{A^2+B^2}$ and an appropriate phase angle $\phi$. (It's an arctangent of a ratio of A and B, but I forget which one.) This angle can be removed from the denominator by a shift in $\theta$, and this factors out of $e^{i\theta}$. So WLOG one only needs consider $$\int_0^{2\pi} \frac{e^{i\theta}}{1+R \cos \theta}\,d\theta,$$ and the contour integral method is probably best for this. – Semiclassical Apr 12 '17 at 16:20
• This is just a minor twist on your previous question - math.stackexchange.com/questions/2229374/… – Jack D'Aurizio Apr 12 '17 at 17:44

There's a trick to this: let the cosine one be $I$, the sine one $J$. We add to get something easy to integrate: $$BI+AJ = \int_0^{2\pi} \frac{A\sin{\theta}+B\cos{\theta}}{1+A\sin{\theta}+B\cos{\theta}} \, d\theta = \int_0^{2\pi} \left( 1 - \frac{1}{1+A\sin{\theta}+B\cos{\theta}} \right) d\theta,$$ which you can do using the previous answer to get $$BI+AJ = 2\pi - \frac{2\pi}{\sqrt{1-A^2-B^2}}.$$
The harder bit is to come up with a second equation. Remembering our derivatives, we try $$AI-BJ = \int_0^{2\pi} \frac{A\cos{\theta}-B\sin{\theta}}{1+A\sin{\theta}+B\cos{\theta}} \, d\theta,$$ which has antiderivative $\log{(1+A\sin{\theta}+b\cos{\theta})}$, continuous if $A^2+B^2<1$. But this has the same value at both of the endpoints, so the integral is zero, and $AI=BJ$. Now you can solve this simultaneously with the first equation to find the values of $I$ and $J$.
• @Chappers Many thanks. So far I have gotten $$I=\frac{B}{A^2+B^2} 2\pi (1-\frac{1}{\sqrt{1-A^2-B^2}})$$ $$J=\frac{A}{A^2+B^2} 2\pi (1-\frac{1}{\sqrt{1-A^2-B^2}})$$. Next is to check against a numerical model. – steveOw Apr 12 '17 at 20:17
HINT: set $$t=\tan(x/2)$$, $$\sin(x)=\frac{2t}{1+t^2}$$, $$\cos(t)=\frac{1-t^2}{1+t^2}$$ and $$dx=\frac{2dt}{1+t^2}$$