Calculating the integral $\int\limits_{0}^{2\pi} \frac{d \theta}{a^2 \sin^2\theta+b^2 \cos^2\theta}$

I wanted to calculate $$\int\limits_{0}^{2\pi} \frac{d \theta}{a^2 \sin^2\theta+b^2 \cos^2\theta}$$

So I solved the indefinite integral first (by substitution): $$\int\frac{d \theta}{a^2 \sin^2\theta+b^2 \cos^2\theta}=\frac{1}{b^2}\int\frac{d \theta}{\cos^2\theta \left(\frac{a^2}{b^2} \tan^2\theta+1 \right)} =\left[u=\frac{a}{b}\tan\theta, du=\frac{a}{b\cos^2\theta} d\theta \right ]\\=\frac{1}{b^2}\int\frac{b}{a\left(u^2+1 \right)}du=\frac{1}{ab}\int\frac{du}{u^2+1}=\frac{1}{ab} \arctan \left(\frac{a}{b}\tan\theta \right )+C$$

Then:

$$\int\limits_{0}^{2\pi} \frac{d \theta}{a^2 \sin^2\theta+b^2 \cos^2\theta}=\frac{1}{ab} \arctan \left(\frac{a}{b}\tan (2\pi) \right )-\frac{1}{ab} \arctan \left(\frac{a}{b}\tan 0 \right )=0$$

Which is incorrect (the answer should be $$2\pi/ab$$ for $$a>0,b>0$$).

On the one hand, the substitution is correct, as well as the indefinite integral itself (according to Wolfram it is indeed $$\frac{1}{ab} \arctan \left(\frac{a}{b}\tan\theta \right )$$ ), but on the other hand I can see that had I put the limits during the substitution I'd get $$\int\limits_{0}^{0} \dots = 0$$ because for $$\theta = 0 \to u=0$$ and for $$\theta = 2\pi \to u=0$$.

Why is there a problem and how can I get the correct answer?

Wolfram is correct because $$\frac{a^2 b^2}{2}\int\limits_{0}^{2\pi} \frac{d \theta}{a^2 \sin^2\theta+b^2 \cos^2\theta}$$ is the area of an ellipse (defined by $$x=a\cos t , y=b\sin t$$), that is $$\frac{a^2 b^2}{2}\int\limits_{0}^{2\pi} \frac{d \theta}{a^2 \sin^2\theta+b^2 \cos^2\theta}=\pi ab$$

• Hint: use $\sin^2 \theta + \cos^2 \theta = 1$ to simplify the formula. – ToucanNapoleon Oct 12 '16 at 12:33
• Hint: $\frac{1}{ab}\arctan(\frac{a\tan(x)}{{b}})|_0^{2\pi}$ – user90369 Oct 12 '16 at 12:50
• Isn't the answer $0$? – StubbornAtom Oct 12 '16 at 12:54
• @user90369 - did you read my question? – user265336 Oct 12 '16 at 13:09
• @StubbornAtom - no. As I already said it should be $2\pi / ab$ - according to Wolfram and also because that integral times $a^2 b^2 / 2$ should give the area of an ellipse. – user265336 Oct 12 '16 at 13:10

The substitution is incorrect : the tangent is not bijective on the interval $[0,2\pi]$. First, you need to restrict yourself to an interval on which the tangent behaves better. Using the $\pi$-periodicity of the function you want to integrate, you can show that:

$$\int_0^{2 \pi} \frac{1}{a \sin^2 (\theta)+b \cos^2 (\theta)} d \theta = 2 \int_{-\pi/2}^{\pi/2} \frac{1}{a \sin^2 (\theta)+b \cos^2 (\theta)} d \theta,$$

and go from there.

Note that this is a good warning about using Wolfram (or any formal computation system) : the formula for the indefinite integral is good, but it holds only on each interval $(k\pi -\pi/2, k\pi+\pi/2)$, which the program does not tell you.

You have everything right up to $$\frac{1}{ab}\arctan(\frac{a}{b}\tan(2\pi))-\frac{1}{ab}\arctan(\frac{a}{b}\tan(0))$$ Now $\frac{1}{ab}\arctan(\frac{a}{b}\tan(2\pi))$ is $2\pi$ because the $\arctan$ and the $\tan$ are inverse functions.

So we get
$$\frac{1}{ab}\arctan(\frac{a}{b}\tan(2\pi))-\frac{1}{ab}\arctan(\frac{a}{b}\tan(0))=\frac{1}{ab}2\pi-0$$ or $$\frac{2\pi}{ab}$$

• There's $a/b$ inside $\arctan$. If it was $\arctan (\tan 2\pi)$ I could understand. – user265336 Oct 12 '16 at 13:11
• $\tan (2\pi)=0$ – StubbornAtom Oct 12 '16 at 13:12
• yes you are right I'm sorry – Riemann-bitcoin. Oct 12 '16 at 15:30
• You should delete this answer or else you might get downvoted. – StubbornAtom Oct 13 '16 at 6:15