# Contour Integration - my solution for real integral is complex?

1. Apr 29, 2013

### IchiCC

1. The problem statement, all variables and given/known data

Evaluate the integral

$I=\int^\pi_{-\pi} \frac{\,d\theta}{a+b\cos\theta+c\sin\theta}$

where $a$, $b$, $c$ are real positive constants such that $a^2>b^2+c^2>0$

2. Relevant equations

Residue theorem.

3. The attempt at a solution

Consider the complex function

$f(z)=\frac{1}{az+\frac{1}{2}b(z^2+1)+\frac{1}{2i}c(z^2-1)}$

This has simple poles when denominator equals zero, i.e. at $z=z_1$ and $z=z_2$, where

$z_1=\frac{-a+\sqrt{a^2-(b^2+c^2)}}{b-ic}$ and $z_2=\frac{-a-\sqrt{a^2-(b^2+c^2)}}{b-ic}$

by the quadratic formula. See that $|z_2|>|z_1|\,\,\,\,\,\,(*)$.

Note that
$|z_1||z_2|=|z_1 z_2|=\left|\frac{b^2+c^2}{(b-ic)^2}\right|=1$

Referring back to $(*)$ we see that $|z_1|<1$ and $|z_2|>1$.

$\text{Res}[f(z), z_1]=lim_{z\to z_1}[(z-z_1)f(z)]=\frac{1}{z_1-z_2}=\frac{b-ic}{2 \sqrt{a^2-b^2-c^2}}$

Since $z_1$ is the only pole enclosed by the contour $|z|=1$, by the residue theorem:

$\oint_{|z|=1}f(z)dz=2\pi i \text{Res}[f(z), z_1]\,\,\,\,\,\,(**)$

Along the contour $|z|=1$, we can write
$z=e^{i\theta}$
$dz=ie^{i\theta}d\theta$ with $\theta$ in $[-\pi,\pi]$

Then

$\oint_{|z|=1}f(z)dz=\int^\pi_{-\pi}\frac{ie^{i\theta}}{ae^{i\theta}+\frac{1}{2}b(e^{2i\theta}+1)+\frac{1}{2i}c(e^{2i\theta}-1)}d\theta=i\int^\pi_{-\pi}\frac{1}{a+\frac{1}{2}b(e^{i\theta}+e^{-i\theta})+\frac{1}{2i}c(e^{i\theta}-e^{-i\theta})}d\theta=iI$

Returning to $(**)$, we see that

$I=2\pi\text{Res}[f(z), z_1]=\frac{b-ic}{\sqrt{a^2-b^2-c^2}}\pi$

This is clearly wrong since I can't have a complex solution to the real integral given, yet I've gone through my working countless times now and just can't spot my mistake... Maybe I'm just tired. Help would be much appreciated!

2. May 1, 2013

### jackmell

I can describe a methodology for you because if you continue in math, one day nobody in the entire world will be able to help you and you'll have to go by yourself: whenever you're confronted with a problem that you try and try to solve and can't get it right, one option is to numerically check each step before you go to the next one. So you have:

$$\int_{-\pi}^{\pi} \frac{dt}{a+b\cos(t)+c\sin(t)},\quad a^2>b^2+c^2>0$$

Now just let say b=1, c=2, and a=6 and obtain the exact or numerical answer but still continue to solve it in terms of a, b, and c. So we let $z=e^{it}$ and get:

$$\oint \frac{-i dz}{z}\frac{1}{a+\frac{b}{2z}(z^2+1)+\frac{c}{2iz}(z^2-1)}$$

Ok, just that one step. Let's numerically check the results. Not hard in mathematica:

NIntegrate[(f[z]ie^{it})/.z->e^{it},{t,0,2\pi}]

That might look like gibberish to you if you don't use Mathematica but you get the idea: If that result does not agree with the initial answer, you have made an error in your arithemetic so do not go a step further until they agree. Ok, we get that step. Now do another step and again check it numerically and continue that way step by step until to get to the end. I guarantee if you do that, you'll find your error and in the process, learn how to walk alone.