# Countour Integration

I had to evaluate this integral $$\int_{-\infty}^{\infty} \frac{x \sin(x)}{x^2 - b^2}dx$$, according to Wolfram this had the following result $$\int_{-\infty}^{\infty} \frac{x \sin(x)}{x^2 - b^2} dx= \pi e^{ib}$$

However, when I integrated it:

$$\oint_C f(z) dz = \oint_{\gamma_{1}} f(z) dz + \oint_{\gamma_{2}} f(z) dz + \oint_{\Gamma} f(z) dz$$

The last term goes to zero applying Jordan's Lemma and to get the result of the integral over $$\gamma_{1}$$ and $$\gamma_{2}$$, in which $$\gamma_{1}$$ is the contour over the first pole and $$\gamma_{2}$$ is the contour over the second pole.

So, I get $$\oint_{\gamma_{1}} f(z) dz = i \pi \lim_{z \rightarrow -b} \frac{z \sin(z)}{(z-b)(z+b)}(z+b) = i \pi \frac{\sin(-b)}{-2}$$

and

$$\oint_{\gamma_{2}} f(z) dz = i \pi \lim_{z \rightarrow b} \frac{z \sin(z)}{(z-b)(z+b)}(z-b) = i \pi \frac{\sin(b)}{2}$$

The result that I'm getting is:

$$\oint_C f(z) dz = i \pi \left( \frac{\sin(b)}{2} - \frac{\sin(-b)}{-2} \right) = \frac{\pi}{2} \left( e^{ib} - e^{-ib} \right)$$

That according to Wolfram is not the correct result.

What am I doing wrong?

Edit:

In this case, I used $$f(z) = \frac{z \sin(z)}{z^2 - b^2}$$

Edit 2:

Edit 3:

Using @Ted Shifrin 's suggestion to change $$f(z)$$ to a more well-behaved function when $$|z|$$ is very large, I got:

$$f(z) = \frac{z \exp(iz)}{z^2 - b^2}$$

So, I get $$\oint_{\gamma_{1}} f(z) dz = i \pi \lim_{z \rightarrow -b} \frac{z \exp(iz)}{(z-b)(z+b)}(z+b) = i \pi \frac{\exp(-ib)}{2}$$

and

$$\oint_{\gamma_{2}} f(z) dz = i \pi \lim_{z \rightarrow b} \frac{z \exp(iz)}{(z-b)(z+b)}(z-b) = i \pi \frac{\exp(ib)}{2}$$

The result that I'm getting is:

$$\oint_C f(z) dz = i \pi \left( \frac{\exp(ib)}{2} + \frac{\exp(-ib)}{2} \right) = i \pi \cos(b)$$

and in conclusion:

$$\int_{-\infty}^{\infty} \frac{x \sin(x)}{x^2 - b^2}dx = \Im(i \pi cos(b)) = \pi \cos(b)$$

I still don't understand, according to some of you this integral doesn't converge how do I prove that?

This result is equal to @FelixMarin 's result and he used another method of integration, but is different of Wolfram's result and assuming that $$b \in \Re$$ this integral is supposed to diverge. What am I missing?

• What are $\gamma_1$, $\gamma_2$, and $\Gamma$? You need to pick specific contours that are relevant to the original integral; it's not enough to have abstract contours that one can evaluate in the limit. Here, when you pick specific contours, you'll realize that only one of the two poles of the integrand is contained in the contour. (You can arrange the contour to contain either pole, but the integrand will be slightly different, and you should get the same answer in both cases.) Commented Dec 15, 2020 at 19:06
• As I said in the post, $\gamma_{1}$ and $\gamma_{2}$ are contours as small as I want around each pole. Commented Dec 15, 2020 at 19:09
• You've successfully evaluated those contour integrals, but they in and of themselves have nothing to do with the original problem. In other words, you invented an object $\oint_C f(z) \,dz$ and evaluated it; what does that have to do with $\int_{-\infty}^{\infty} f(x) \,dx$? Commented Dec 15, 2020 at 19:09
• In my complex analysis class, whenever I need to evaluate a real integral that is too complicated to do it by real methods, we extend the problem to the complex plane and use the following correspondence $$\oint_{C} f(z) dz = \int_{\infty}^{\infty}f(x) dx + \oint_{\Gamma} f(z) dz$$, where the last term goes to zero in this case. Am I missing something?@GregMartin Commented Dec 15, 2020 at 19:18
• Did you tell us what your $f(z)$ was? You should know by now that using $\sin z$ or $\cos z$ will be very problematic for control when $|z|$ is large. Commented Dec 15, 2020 at 19:21

$$\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,} \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack} \newcommand{\dd}{\mathrm{d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,} \newcommand{\ic}{\mathrm{i}} \newcommand{\mc}[1]{\mathcal{#1}} \newcommand{\mrm}[1]{\mathrm{#1}} \newcommand{\on}[1]{\operatorname{#1}} \newcommand{\pars}[1]{\left(\,{#1}\,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,} \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}} \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$$ \begin{align} &\bbox[5px,#ffd]{\left.\mrm{P.V.}\int_{-\infty}^{\infty} {x\sin\pars{x} \over x^{2} - b^{2}}\,\dd x \,\right\vert_{\,b\ \in\ \mathbb{R}}} \\[5mm] = &\ {1 \over 2}\,\mrm{P.V.}\int_{-\infty}^{\infty} {\sin\pars{x} \over x + b}\,\dd x + {1 \over 2}\,\mrm{P.V.}\int_{-\infty}^{\infty} {\sin\pars{x} \over x - b}\,\dd x \\[5mm] = &\ {1 \over 2}\,\mrm{P.V.}\int_{-\infty}^{\infty} {\sin\pars{x - b} + \sin\pars{x + b} \over x}\,\dd x \\[5mm] = &\ {1 \over 2}\,\mrm{P.V.}\int_{-\infty}^{\infty} {2\sin\pars{x}\cos\pars{b} \over x}\,\dd x = \bbx{\pi\cos\pars{b}} \\ & \end{align}
• Honestly, I don't agree with your answer. If $b \in \R$ the integral doesn't converge, has said by other users in the comments, using comparison test we see that $$\int_{-\infty}^{\infty} \frac{x sin(x)}{x^2 - b^2} > \int_{-\infty}^{\infty} \frac{1}{x^2}$$ and the integral on $\frac{1}{x^2}$ diverges, so does the integral on $\frac{x sin(x)}{x^2 - b^2}$. Aside from that, I got the same result as you, even though is different than Wolfram's result, Commented Dec 16, 2020 at 8:48
• @RFeynman That's where the principal value $\text{P.V.}$ comes in. It's an improper integral, but by applying the $\text{P.V.}$ we can treat it as a finite quantity Commented Dec 16, 2020 at 18:39
• @RFeynman ${\tt Matematica}$: $\verb*ClearAll[b, x]; Integrate[ x Sin[x]/(x^2 - b^2),*$ $\verb*{x, -Infinity, Infinity}, Assumptions -> Element[b, Reals], *$ $\verb*PrincipalValue -> True]*$. $\quad\color{red}{\mbox{Result}}$: $\verb*\[Pi] Cos[b]*$ Commented Dec 16, 2020 at 20:49