I tried to integrate the following in Mathematica.

$\int\limits_{-\infty}^\infty\cfrac{\text{e}^{\text{i}ax}}{x^2-b^2}\text{d}x$ where $a,b>0$

The analytical result is well known.


I used the following code

Integrate[E^(I a x)/(x^2 - b^2), {x, -Infinity, Infinity},
 Assumptions->{a > 0, b != 0, b ∈ Reals}]

But Mathematica returned something else

-((π (I Abs[b] Cos[a b] + b Sin[a b]))/b^2)

How can I get the above analytical expression?

  • $\begingroup$ Well, if your assumption is that $b>0$, then why did you only specify b != 0 in your assumptions to Integrate? Have you tried specifying that b is positive, rather than nonzero? $\endgroup$
    – MarcoB
    Apr 29, 2016 at 14:18
  • 1
    $\begingroup$ @MarcoB The assumptions should be fine. b != 0 && b ∈ Reals is equivalent to b > 0 since the integral only has b^2. $\endgroup$
    – Greg Hurst
    Apr 29, 2016 at 14:19
  • 1
    $\begingroup$ @MarcoB : Yes I have used Assumptions -> {a > 0, b > 0, b \[Element] Reals}. But then it fails to converge. $\endgroup$ Apr 29, 2016 at 14:24
  • $\begingroup$ Solving the indefinite integral and then using limit gives -((2 π Sin[a b])/b). $\endgroup$ Apr 29, 2016 at 14:34
  • 2
    $\begingroup$ Mathematica claims the integral diverges because, well, it diverges. So that's not a good way to get the Fourier transform of 1/(x^2-b^2). To get the FT one can do In[14]:= FullSimplify[ Sqrt[2*Pi]* FourierTransform[1/(x^2 - b^2), x, a, Assumptions -> {a > 0, b != 0, Element[b, Reals]}]] Out[14]= -((\[Pi] Sin[a b])/b) $\endgroup$ Apr 29, 2016 at 15:53

2 Answers 2


Sometimes they're equal:

Block[{a = 2, b = 4},
 {NIntegrate[E^(I a x)/(x^2 - b^2),
   {x, -Infinity, -b - I, b + I, Infinity}],
  -((π (I Abs[b] Cos[a b] + b Sin[a b]))/b^2) // N}
  {-0.77704 + 0.114275 I, -0.77704 + 0.114275 I}

Kidding aside, perhaps you should specify PrincipalValue -> True (which I just noticed, belatedly, than Daniel Lichtblau suggested in a comment). After a cup of coffee, the following returns with the desired answer:

Integrate[E^(I a x)/(x^2 - b^2), {x, -Infinity, Infinity}, 
 Assumptions -> {a > 0, b != 0, b ∈ Reals, x ∈ Reals}, PrincipalValue -> True]
  -((π Sin[a b])/b)
  • $\begingroup$ Thanks a lot. Use of PricipalValue solves the problem. $\endgroup$ Apr 30, 2016 at 10:36
  • $\begingroup$ Must have been one big cup, or else your computer is much faster than mine. $\endgroup$ Apr 30, 2016 at 22:07

This integral has not a value in Riemann's sense, then it has not a value independent of your particular problem, as many people already commented above. Hence, it is better to use the residue theorem, and decide whether you want to include the residue from the pole at +b, at -b, both ou none. Therefore:

rplus = Residue[E^(I a x)/(x^2 - b^2), {x, b}]
rminus = Residue[E^(I a x)/(x^2 - b^2), {x, -b}]

If you decide that the adequate solution includes both residues, your answer is

2 Pi I (rplus + rminus) // FullSimplify

which gives

-((2 \[Pi] Sin[a b])/b)

as you expect. Note, however, that (2 Pi I rplus), (2 Pi I rminus), and 0 can be acceptable values for this integral, depending on the specificities of your problem.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.