# Argument principle in the evaluation of integral

Evaluate $$I=\int_{-\infty}^{\infty}\frac{x}{x^{2}+x+1}dx$$

Attempt: Note that $$\int_{-\infty}^{\infty}\frac{x}{x^{2}+x+1}dx=\frac{1}{2}\int_{-\infty}^{\infty}\frac{2x+1}{x^{2}+x+1}dx-\int_{-\infty}^{\infty}\frac{1}{x^{2}+x+1}dx$$

Denote $\Gamma$ as the circle with radius $R\rightarrow \infty$ and let $h=\frac{f{}'(z)}{f(z)}=\frac{2z+1}{z^{2}+z+1}$ be a holomorphic function in and on $\Gamma$. The conditions for the Argument principle are valid, and thus

$$\Rightarrow \int_{\Gamma }\frac{f{{}'}}{f}dz=2\pi i\left ( Z-P \right )=4\pi i$$. The second integral is easily evaluated to $\frac{2\pi}{\sqrt{3}}$, and finally our integral computes to $$I=2\pi i-\frac{2\pi}{\sqrt{3}}.$$ I am certain the wrongdoing is in using the argument principle, but how?

*Is it that $f$ is not holomorphic as $R\rightarrow \infty$?

• The integral does not converge, because $\int_0^{\infty} ... = \infty$ and $\int_{-\infty}^0 ... = -\infty$. – user296602 Dec 22 '17 at 1:36
• Yes, ok. So it means that the function is not holomorphic? – Elia Varane Dec 22 '17 at 1:44
• It is not holomorphic because the derivative is not defined everywhere. The integral does not converge because $|f(z)|$ does not get small quickly enough as $|z|$ gets large. – Doug M Dec 22 '17 at 2:12
• $h$ is not holomorphic at the zeros of $f$. The integral does not exist as an improper integral, but it does have a Cauchy principal value, i.e. $\lim_{R \to \infty} \int_{-R}^R \frac{x}{x^2+x+1}\; dx$, which should be $-\pi/\sqrt{3}$. – Robert Israel Dec 22 '17 at 3:10

Using, as you did,$$I=\int\frac{x}{x^{2}+x+1}\,dx=\frac{1}{2}\int\frac{2x+1}{x^{2}+x+1}\,dx-\int\frac{1}{x^{2}+x+1}\,dx$$ $$I=\frac{1}{2} \log \left(x^2+x+1\right)-\frac{1}{\sqrt{3}}\tan ^{-1}\left(\frac{2 x+1}{\sqrt{3}}\right)$$ making, after simplifications, $$J=\int_a^a\frac{x}{x^{2}+x+1}\,dx=\frac{1}{\sqrt{3}}\tan ^{-1}\left(\frac{a\sqrt{3} }{a^2-1}\right)+\frac{1}{2} \log \left(\frac{a^2+a+1}{a^2-a+1}\right)$$ For infinitely large values of $a$ $$J=-\frac{\pi }{\sqrt{3}}+\frac{2}{a}-\frac{2}{3 a^3}+O\left(\frac{1}{a^5}\right)$$