4

How do I calculate this integral? $a \gt b$ is given.

$$\int_0^\pi \frac{1}{a+b\sin^2(x)} dx $$

I am confused since WolframAlpha says one the one hand, that $F(\pi) = F(0) = 0 $ , but with some random values it isn't 0.

What am I missing?

Note that I am not really interested in a complete antiderivative, I am more interested in a $G(a,b) = F(\pi) - F(0) = \, ... $

Christian
  • 1,781

2 Answers2

4

The antiderivative $$ F(x) = \frac{1}{\sqrt{a}\sqrt{a+b}} \arctan\left(\frac{\sqrt{a+b} \tan x}{\sqrt{a}}\right) $$ given by WA isn't continuous on the whole interval $[0,\pi]$ (because it contains $\tan x$ which jumps at $x=\pi/2$), and this is why $F(\pi)-F(0)$ doesn't give the right answer. (Clearly, the answer "zero" is wrong, since the integrand is positive!)

On the other hand, $F(x)$ is continuous on the interval $(-\pi/2,\pi/2)$, and extends continuously to the endpoints by taking limits, and your integrand has period $\pi$ so we can integrate over any interval of length $\pi$ without changing the integral's value. So $$ \int_0^\pi \frac{1}{a+b\sin^2(x)} dx = \int_{-\pi/2}^{\pi/2} \frac{1}{a+b\sin^2(x)} dx = \lim_{x\to(\pi/2)^-} F(x) - \lim_{x\to(-\pi/2)^+} F(x) = \frac{\pi}{\sqrt{a}\sqrt{a+b}} $$ works.

You can find some articles about "gotchas" of this kind in computer algebra systems if you search the web for "D. J. Jeffrey continuous".

Hans Lundmark
  • 53,395
  • Are you sure it's $\sqrt{\pi}$ and not $\pi$ ? It's actually a physics problem and the solution is given ("Prove that..."). With your integral I get the wished result, but it's $\pi$ and not $\sqrt{\pi}$ ... – Christian May 24 '15 at 08:20
  • Also I think $\arctan(+\infty) = \pi/2 $ and $\arctan(-\infty) = -\pi/2 $, so the difference is $ \pi $ ? – Christian May 24 '15 at 08:26
  • 1
    @Christian: Yes, of course it should be $\pi$. That was a contamination from all the other square roots... Anyway, I've fixed it now. – Hans Lundmark May 24 '15 at 08:32
1

Suppose we seek to evaluate $$\frac{1}{2} \int_0^{2\pi} \frac{1}{a+b\sin^2 x} dx.$$

Put $z = \exp(ix)$ so that $dz = i\exp(ix) \; dx$ and hence $\frac{dz}{iz} = dx$ to obtain $$\frac{1}{2} \int_{|z|=1} \frac{1}{a+b(z-1/z)^2/4/(-1)}\frac{dz}{iz} \\ = \frac{1}{2} \int_{|z|=1} \frac{4}{4a-b(z-1/z)^2}\frac{dz}{iz} \\ = \frac{2}{i} \int_{|z|=1} \frac{z}{4a-b(z-1/z)^2}\frac{dz}{z^2} \\ = \frac{2}{i} \int_{|z|=1} \frac{z}{4az^2-b(z^2-1)^2} dz \\ = \frac{2}{i} \int_{|z|=1} \frac{z}{-bz^4+(2b+4a)z^2-b} dz.$$

The poles here are all simple and located at $$\rho_{1,2,3,4} = \pm\sqrt{\frac{2a+b}{b} \pm \frac{2\sqrt{a^2+ab}}{b}}.$$

Re-write this as $$\rho_{1,2,3,4} = \pm\sqrt{1+\frac{2a}{b} \pm \frac{2\sqrt{a^2+ab}}{b}}.$$

With $a$ and $b$ positive the first two poles are clearly not inside the contour (modulus larger than one). That leaves $$\rho_{3,4} = \pm\sqrt{1+\frac{2a}{b} - \frac{2\sqrt{a^2+ab}}{b}}.$$

Now we have $$1+\frac{2a}{b} - \frac{2\sqrt{a^2+ab}}{b} < 1$$ and also $$1+\frac{2a}{b} - \frac{2\sqrt{a^2+ab}}{b} > 0$$ since $$(b+2a)^2 = b^2+4ab+4a^2 > 4(a^2+ab)$$ and therefore these poles are indeed inside the contour.

The residues are given by $$\left. \frac{z}{-4bz^3+2(2b+4a)z} \right|_{z=\rho_{3,4}} = \left. \frac{1}{-4bz^2+2(2b+4a)} \right|_{z=\rho_{3,4}}.$$

This is $$\frac{1}{-4b-8a+8\sqrt{a^2+ab} +2(2b+4a)} = \frac{1}{8\sqrt{a^2+ab}}.$$

It follows that the desired value is $$\frac{2}{i}\times 2\pi i \times \frac{2}{8\sqrt{a^2+ab}} = \frac{\pi}{\sqrt{a}\sqrt{a+b}}.$$

Marko Riedel
  • 61,317