# Integral with contour integration

I want to evaluate the integral: $$\int_{-\infty}^{0}\frac{2x^2-1}{x^4+1}\,dx$$

using contour integration.

I re-wrote it as: $\displaystyle \int_{0}^{\infty}\frac{2x^2-1}{x^4+1}\,dx$. I am considering of integrating on a semicircle contour with center at the origin. I considered the function $\displaystyle f(z)=\frac{2z^2-1}{z^4+1}$ which has $4$ simple poles but only two of them lie on the upper half plane and included in the contour which are: $\displaystyle z_1=\frac{1+i}{\sqrt{2}}, \;\; z_2=\frac{-1+i}{\sqrt{2}}$.

The residue at $\displaystyle z_1$ equals $\displaystyle \mathfrak{Res}\left ( f; z_1 \right )=-\frac{2i-1}{2\sqrt{2}}$ while the residue at $z_2$ equals $\displaystyle -2\sqrt{2}i-2\sqrt{2}$. (if I have done the calculations right)

Now, I don't know how to continue. Should I find the residues at the other poles as well and the say $\displaystyle \oint_{C}f(z)=2\pi i \sum res$ where $C$ is the semicircle contour and then expand it? That is:

$$\oint_{C}f(z)\,dz=\int_{0}^{a} + \int_{{\rm arc}}$$

Then let $a \to +\infty$ then than arc integral would go to zero. But I don't know how to proceed.

I had dealt with this integral with residues converting it into a minus infinity to infinity integral but with contours I am having a bit of problem.

Therefore I'd like some help.

• Your formula for the residue theorem isn't right, it should be residue multiplied by winding number. This answers what you need to do with the other poles. When you brake up the integral in a sum,it should be from $-a$ to $a$, otherwise it's not semicircle. Find the original integral from $-\infty$ to $+\infty$ and then use evenness to get what you want. – Git Gud Dec 24 '14 at 13:00
• Yes.. right .. i wrote that by mistake.. Oups... What do you mean by winding number? A contour integral is evaluated that way.. no? How to find the original integral from $-\infty$ to $\infty$ with contours? The procedure is the same.. Expand the contour after I have evaluated : $$\oint_{\gamma}=\int_{-a}^{a}+\int_{{\rm arc}}$$ As $a$ goes to $\infty$ that arc integral goes to zero. Then how do I proceed? – Tolaso Dec 24 '14 at 13:10
• See for instance the formula on wikipedia's article on the residue theorem. The $I(\gamma, a_k)$is the winding number. Basically since the other poles lie outside of the semicircle you can discard them and add only the residues inside the semicircle. Edit: Then you're basically done. You know what the LHS equals due to the residue theorem. – Git Gud Dec 24 '14 at 13:12
• Ok.. I know that the LHS equal to $2\pi i \sum res$ , no? But that's a complex value , while the RHS , well we want to be a real number not a complex one... This is where I get stuck? Could you elaborate a little more? – Tolaso Dec 24 '14 at 13:20
• My mistake.. got it.. thank you.. very much.. !! – Tolaso Dec 24 '14 at 13:26

## 2 Answers

You could also use the following contour. $$\int_{-\infty}^0 \frac{2x^2-1}{x^4+1}\operatorname dx =\int_{0}^{+\infty} \frac{2x^2-1}{x^4+1}\operatorname dx$$

Has an analytic continuation as $$\int_{\Gamma} \frac{2z^2-1}{z^4+1}\operatorname dz$$ with 4 poles, but just on pole inside of the contour.

$$\operatorname*{res}_{z=e^{i\frac{\pi}{4}}} f(z) = \frac{3\sqrt{2}}{8} -i \frac{\sqrt{2}}{8}$$

I think you made a calculation error here (?)

Using $$\int_{\Gamma} \frac{2z^2-1}{z^4+1}\operatorname dz = \color{blue}{\int_{\Gamma_1}\frac{2z^2-1}{z^4+1}\operatorname dz} + \int_{\Gamma_2}\frac{2z^2-1}{z^4+1}\operatorname dz + {\color{red}{\int_{\Gamma_3}\frac{2z^2-1}{z^4+1}\operatorname dz}}$$

• Now $\color{blue}{\int_{\Gamma_1} \to 0}$ as $R\to +\infty$ which can be proven using the triangle inequality.
• Use $\Gamma_2 \leftrightarrow z(x) = x$ and $x:0\to R$
• Use $\color{red}{\Gamma_3 \leftrightarrow z(y) = iy}$ and $y: R \to 0$

Which finally results in (as $R \to +\infty$) $$2\pi i \left(\frac{3\sqrt{2}}{8} -i \frac{\sqrt{2}}{8}\right) = \color{blue}{0}+\int_{0}^{+\infty}\frac{2x^2-1}{x^4+1}\operatorname dx + \color{red}{ i \int_{+\infty}^0\frac{-2y^2-1}{y^4+1}\operatorname dy}$$

Here you can read the real parts which results in:

$$\int_{0}^{+\infty}\frac{2x^2-1}{x^4+1}\operatorname dx = \frac{\pi\sqrt{2}}{4}$$

• Wow.. thank you! I have one question.. How did you draw the contour online? – Tolaso Dec 24 '14 at 14:09
• Definitely I made error calculations... since I got a negative result.. problem is I cannot see what has gone wrong – Tolaso Dec 24 '14 at 14:10
• I've drawn the picture using GeoGebra. These exercises are quite lengthy, with a big risk of calculation errors. I know the frustration. – dietervdf Dec 24 '14 at 14:13
• Woops, typo. I'll fix it :) – dietervdf Dec 24 '14 at 14:28

Let's try and hope I have not made any mistakes here. We will calculate the integral: $$\int_{-\infty}^{0}\frac{2x^2-1}{x^4+1}\,dx$$

Since the integrand function is even we can rewritte it as: $$\int_{-\infty}^{\infty}\frac{2x^2-1}{x^4+1}\,dx=2\int_{-\infty}^{0}\frac{2x^2-1}{x^4+1}\,dx$$

Considering the function $\displaystyle f(z)=\frac{2z^2-1}{z^4+1}$ we see that is has $4$ simple poles which are $\displaystyle z_1=\frac{1+i}{\sqrt{2}}, \; z_2=\frac{1-i}{\sqrt{2}}, \; z_3=\frac{-1+i}{\sqrt{2}}, \; z_4=\frac{-1-i}{\sqrt{2}}$

Only two of them lie on the upper plane (meaning they have positive imaginery part) Those are $z_1, \; z_3$.

The residues at $z_1, \; z_3$ are: \begin{aligned} \mathfrak{Res}\left ( f; z_1 \right ) &=\lim_{z\rightarrow z_1}(z-z_1)f(z) \\ &= \lim_{z\rightarrow \frac{1+i }{\sqrt{2}}}\left ( z-z_1 \right )\frac{2z^2-1}{(z-z_1)\left ( z-\frac{1-i}{\sqrt{2}} \right )\left ( z-\frac{-1+i}{\sqrt{2}} \right )\left ( z-\frac{-1-i}{\sqrt{2}} \right )}\\ &= \cdots\\ &= \frac{3\sqrt{2}}{8} -i \frac{\sqrt{2}}{8}\\ \end{aligned}

and \begin{aligned} \mathfrak{Res}\left ( f; z_3\right ) &=\lim_{z\rightarrow z_3}(z-z_3)f(z) \\ &= \lim_{z\rightarrow \frac{-1+i }{\sqrt{2}}}\left ( z-z_3 \right )\frac{2z^2-1}{\left ( z-\frac{1+i}{\sqrt{2}} \right )\left ( z-\frac{1-i}{\sqrt{2}} \right )\left ( z-z_3 \right )\left ( z-\frac{-1-i}{\sqrt{2}} \right )}\\ &= \cdots\\ &= -\frac{3\sqrt{2}}{8} -i \frac{\sqrt{2}}{8}\\ \end{aligned}

Now we are integrating on a semicircle contour with center at the origin and radius $R$. We know that $\displaystyle \oint_{\gamma}f(z)\,dz=2\pi i \left ( \frac{3\sqrt{2}}{8} -i \frac{\sqrt{2}}{8} -\frac{3\sqrt{2}}{8}-i\frac{\sqrt{2}}{8} \right )=\frac{\pi}{\sqrt{2}}$ .

Expanding the contour integral we have that: $$\oint_{\gamma}f(z)\,dz=\int_{-a}^{a}+\int _{{\rm arc}}$$

Letting $a \to +\infty$ we have that the arc integral goes to zero, therefore we get the value of the integral is $\dfrac{\pi}{\sqrt{2}}$ thus the original integral is $\dfrac{\pi}{2\sqrt{2}}$

• I think the residue is not correct (I also made multiple errors calculating it ;) ) Wolfram Alpha comes in handy here as a correction tool: wolfr.am/2jjew0UO – dietervdf Dec 24 '14 at 14:10
• Thank you... Let me check that and adjust my solution properly. – Tolaso Dec 24 '14 at 14:12
• Still we the residues ready, I am gettin a negative result.. Why? – Tolaso Dec 24 '14 at 14:16
• The first residue you can see on dieter's answer, the other one should be $-\dfrac{3\sqrt 2}8-\dfrac{i\sqrt 2}8$. Adding them and multiplying by $2\pi i$ yields a positive number. – Git Gud Dec 24 '14 at 14:23
• Thank you... I'll adjust my answer.. and accept Dieter's solution.. because I like it more... – Tolaso Dec 24 '14 at 14:26