Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to solve the following rational integral (I got assistance here):

$$\int_{-\infty}^{\infty}{\frac{a+x}{b^2 + (a+x)^2}\frac{1}{1+c(a-x)^2}}dx$$ where $\{a, b, c\}\in \mathbb{R}$. I would like also to find an analytical solution using Mathematica. I have tried Integrate,

Integrate[(a + x)/(b^2 + (a + x)^2)*1/(
  1 + c*(a - x)^2), {x, -Infinity, Infinity}]

but this gives me an imaginary result based on $a$, $b$ and $c$. I believe the result should be 100% real.

Am I using Integrate the correct way?

share|improve this question
"I believe the result should be 100% real." - no doubt, but you should know that sometimes Mathematica, out of convenience, expresses real results using complex numbers, somewhat similar to expressing the sine as complex exponentials. Anyway, have you seen Assuming[]? – J. M. May 15 '13 at 11:42
@J.M. I'll take a look at it and let you know how it turns out, thanks. – BillyJean May 15 '13 at 11:45
...or the Assumptions option to Integrate? Assumptions -> {a ∈ Reals, b ∈ Reals, c ∈ Reals} would probably work. – gpap May 15 '13 at 11:46
Alternatively, use the Residue Theorem. Implicitly assuming $b\gt 0$ (WLG) and $c\gt 0$, we may (very quickly) obtain the solution as 2 \[Pi] I Sum[Residue[(a + x)/((b^2 + (a + x)^2) (1 + c (a - x)^2)), {x, z}], {z, {b I - a, I/Sqrt[c] + a}}] // Simplify, yielding $\frac{2 a \sqrt{c} \pi }{1+2 b \sqrt{c}+4 a^2 c+b^2 c}$. – whuber May 15 '13 at 12:56
up vote 12 down vote accepted

Try this:

Integrate[(a + x)/((b^2 + (a + x)^2) (1 + c*(a - x)^2)), {x, -Infinity, Infinity}, 
 Assumptions -> {a ∈ Reals, b ∈ Reals, c ∈ Reals, b != 0, c > 0}]

Which gives:

(-4 a b^2 c π + 2 a Sqrt[c] (1 + 4 a^2 c + b^2 c) π Abs[b])/
(Abs[b] + c (8 a^2 - 2 b^2 + (4 a^2 + b^2)^2 c) Abs[b])

Note that I've added additional assumptions so that Mathematica doesn't return the result as a ConditionalExpression.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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