# Evaluating definite integral -

Let's say we want to evaluate $$\int_0^{2\pi} \frac{1}{a^2\cos^2x+b^2\sin^2x}dx$$

With substitution, one obtains $$\frac{1}{ab} \arctan\left(\frac ba \tan x\right)$$

as antiderivate. For more details on how to do this, see this question.

Now my question is, why do I receive $0$ if I insert $0$ and $2\pi$ as integration bounds ? This obviously can't be true since the integrand is always positive.

What do I oversee ?

• The formula for your anitderivative is not correct. It is only valid on a small interval, not over all of $[0,2\pi]$. It's the choice of the "branch" of $\arctan$ that makes the difference. – MPW Nov 5 '15 at 20:38
• By the way, if you want, write \mathrm dx to generate $\mathrm dx$ as opposed to $dx$. – Mr Pie Apr 25 '18 at 4:56

A substitution in a integral is allowed as soon as the substitution is given by a bijective and differentiable function. In our case, if the integration range is $(0,2\pi)$ we cannot simply replace $x$ by $\arctan t$ and $dx$ by $\frac{dt}{1+t^2}$, but we have to split the integration range, then apply such substitution on the integrals we get that way:

$$\int_{0}^{2\pi}\frac{dx}{a^2\cos^2(x)+b^2\sin^2(x)}\\=2\int_{0}^{\pi/2}\frac{dx}{a^2\cos^2(x)+b^2\sin^2(x)}+2\int_{0}^{\pi/2}\frac{dx}{a^2\sin^2(x)+b^2\cos^2(x)}\\=2\int_{0}^{+\infty}\left(\frac{1}{a^2 t^2+b^2}+\frac{1}{a^2+b^2 t^2}\right)\,dt=\color{red}{\frac{2\pi}{ab}}.$$

• Okay, I got 2 questions: 1) Why is it only $\pi$ according to WA ? wolframalpha.com/input/… 2) I have understood that the integration range needs to be split up, but what are your thoughts behind splitting it up exactly this way? – Christian Nov 5 '15 at 20:37
• @Christian: You gave to WA a different integral, where are $a$ and $b$ in the WA input? About the second point, the fundamental domain of the tangent function is $\left(-\frac{\pi}{2},\frac{\pi}{2}\right)$, hence if we split the integration range into four chunks of length $\frac{\pi}{2}$, we are allowed to perform the obvious substitution in every chunk. – Jack D'Aurizio Nov 5 '15 at 20:41
• In WA I wanted to use $a=b=1$, but I forgot the $1/\cos^2$, this is the correct link now: wolframalpha.com/input/… – Christian Nov 5 '15 at 20:43
• If $a=b=1$, $$\int_{0}^{2\pi}\frac{dx}{1^2\sin^2(x)+1^2\cos^2(x)} = \frac{2\pi}{1\cdot 1}$$ as expected. – Jack D'Aurizio Nov 5 '15 at 20:45

Arctan is only true from $-\frac{\pi}{2}$ to $\frac{\pi}{2}$ (I.e the domain of arctan)

Notice, the property of the definite integral $\int_{0}^{2a}f(x)\ dx=2\int_{0}^{a}f(x)\ dx\ \ \ \ \ \ \forall \ \ \ f(2a-x)=f(x)$

$$\int_{0}^{2\pi} \frac{1}{a^2\cos^2 x+b^2\sin^2 x}\ dx$$$$=2\int_{0}^{\pi} \frac{1}{a^2\cos^2 x+b^2\sin^2 x}\ dx$$ $$=4\int_{0}^{\pi/2} \frac{1}{a^2\cos^2 x+b^2\sin^2 x}\ dx$$ $$=\frac{4}{b^2}\int_{0}^{\pi/2} \frac{\sec^2 x}{\left(\frac{a}{b}\right)^2+\tan^2 x}\ dx$$$$=\frac{4}{b^2}\int_{0}^{\pi/2} \frac{d(\tan x)}{\left(\frac{a}{b}\right)^2+\tan^2 x}$$ $$=\frac{4}{b^2}\frac{b}{a}\left(\tan^{-1}\left(\frac{bx}{a}\right)\right)_{0}^{\pi/2}=\frac{4}{ab}\tan^{-1}\left(\frac{\pi b}{2a}\right)$$