Why do I get two different results in this contour integral?

Consider the following integral, $$I=\int_{-\infty}^\infty\frac{f(x)}{x^2-a^2}dx,$$

This can be solved using complex analysis by using Feynman's $$i\epsilon$$ prescription, \begin{align} I&=\lim_{\epsilon\rightarrow0}\int_{-\infty}^\infty\frac{f(x)}{x^2-a^2+i\epsilon}dx\\ &=\lim_{\epsilon\rightarrow0}\int_{-\infty}^\infty\frac{f(x)}{2a}\left[\frac{1}{x-(a-i\epsilon)}-\frac{1}{x-(-a+i\epsilon)}\right]dx\\ &=-\frac{2\pi i}{2a}f(-a), \end{align}

where we have chosen the contour as a semicircle of radius $$R$$ in the upper half-plane and taken the limit $$R\rightarrow\infty$$, assuming that $$f$$ is such that the integral over the arc vanishes at infinity. Since the only pole inside the contour is the one at $$-a$$, this is the only residue that contributes.

Now, instead of displacing the poles, consider deforming the contour as follows, Then, $$I$$ can be obtained by integrating over the above contour (let's call it $$C$$) and taking the radius $$R$$ of the large semicircle to $$\infty$$, and the radii $$\epsilon$$ of the small semicircles (call them $$S_1$$ and $$S_2$$) to $$0$$. Again, the integral over the big semicircle vanishes, and \begin{align} I&=\int_C-\int_{S_1}-\int_{S_2}\\ &=-\frac{2\pi i}{2a}f(-a)+\pi i\frac{f(-a)}{2a}+\pi i\frac{f(a)}{2a}\\ &=\frac{2\pi i}{2a}\left(\frac{f(a)-f(-a)}{2}\right), \end{align}

where we have used the residue theorem, and the corollary in this answer.

Why do the results differ?

Edit: My question is close to this one, but not quite the same, since I have deformed the contour in the same direction I've shifted the poles. According to the answer in that question, I should then get the same result with both methods, but I don't.

• Possible duplicate of Solving a contour integral with Feynman prescription Oct 15 '19 at 6:54
• the problem is that, in general, the integral is not well-defined for unknown $f$ Oct 15 '19 at 7:09
• @Masacroso That's a problem, but it's not the problem. Even if $f$ vanishes as fast as you like at infinity, so that all the integrals are well defined, the integrals over the two contours in question will be different. Oct 15 '19 at 16:30
• @Masacroso (unless $f(-a)=0$). Oct 15 '19 at 16:46

You haven't "deformed" your contour, you've simply replaced one contour by another! There's simply no reason the two integrals should be equal.

They'd be equal if the following false version of Cauchy's Theorem were true:

False CT. Suppose $$D$$ is an open set, $$f$$ is analytic in $$D$$, and $$C_1$$ and $$C_2$$ are closed contours in $$D$$. Then $$\int_{C_1}f=\int_{C_2}f$$.

That's clearly false, for example $$D=\Bbb C\setminus\{0\}$$, $$f(z)=1/z$$, $$C_1$$ the contour $$|z|=1$$ and $$C_2$$ the contour $$|z-2|=1$$.

A correct version of CT is this:

Actual CT. Suppose $$D$$ is an open set, $$f$$ is analytic in $$D$$, and $$C_1$$ and $$C_2$$ are closed contours in $$D$$. If $$C_2$$ is homotopic to $$C_1$$ in $$D$$ then $$\int_{C_1}f=\int_{C_2}f$$.

The hypothesis there means that there is a continuous family of contours $$C_t$$ for $$1\le t\le 2$$ that connects $$C_1$$ to $$C_2$$; in other words, in the correct version of the theorem you need to be able to continuously "deform" $$C_1$$ to $$C_2$$, a little tiny bit at a time, without ever leaving $$D$$.

Here, in order to get from the original contour to the one in the picture, continuously, at some point one of the intermediate contours must pass through the point $$z=-a$$, which says the "deformation" cannot be done within the set where $$f(z)/(z^2-a^2)$$ is analytic. So the correct version of CT simply doesn't apply.

A Technicality

That explains why you get two different answers. You don't say why you'd expect the two to be the same; the reason one might expect the two to be the same is CT, but there's no correct version of CT that applies here. What you're doing is blindly applying CT without worrying about the hypotheses - that's going to cause problems.

A separate question is whether there's any reason either answer should actually equal the original integral. In fact, regardless of what Feynmann may have said about $$i\epsilon$$, there's no reason to believe that $$\lim_{\epsilon\to0}\int_{-\infty}^\infty\frac{f(x)}{x^2+a^2+i\epsilon}=\int_{-\infty}^\infty\frac{f(x)}{x^2+a^2}.$$

In general the integral of a limit is not the limit of the integral. This is maybe a more subtle problem; here if, say, $$f$$ is bounded on $$\Bbb R$$ then the limit of the integral is the integral of the limit. As opposed to the problem I point out above, which is a blatantly incorrect application of CT. (The two contour integrals will always be different, unless $$f(-a)=0$$.)