# One Dimensional Gaussian Integral involving a rational function

In the process of solving this question Integral involving product of arctangent and Gaussian, I've come across the integral:

$$\int_0^b \frac{e^{-s^2}}{a^2 + s^2} d s .$$

This integral appears simple enough that I would expect something to be known about it. Does a closed-form solution exist in terms of $$a$$ and $$b$$? I haven't managed to find anything or work out the integral myself.

you could try something like: $$I(c)=\int_0^b\frac{e^{-cx^2}}{a^2+x^2}dx$$ then: $$I'(c)=-\int_0^b e^{-cx^2}\frac{x^2}{a^2+x^2}dx=-\int_0^b e^{-cx^2}\left(1-\frac{a^2}{a^2+x^2}\right)dx \\=a^2I(c)-\int_0^b e^{-cx^2}dx$$ which ends up giving you the DE: $$I'-a^2I=-\int_0^b e^{-cx^2}dx$$ where the right hand side can be represented in terms of the error function, although this equation in itself can be hard to find a particular solution for

• Very good. I was trying something like this but didn’t go all the way and end up with DE. I think I could be able to do something with this. There are lots of results for integrals over the error function times some exponential (which is what is needed as far as I can tell). Aug 9, 2021 at 0:29
• I literally tried the same exact thing but then gave up as soon as WolframAlpha told me that there were no solutions in terms of existing functions. Pro-tip: Don't be me. Aug 9, 2021 at 3:21

This integral can be expressed in terms of a special function called Owen's T-function. We have $$J(a,b) \equiv \int \limits_0^b \frac{\mathrm{e}^{-s^2}}{a^2+s^2} \, \mathrm{d} s \overset{s=a t}{=} \frac{2 \pi \mathrm{e}^{a^2}}{a} \frac{1}{2\pi} \int \limits_0^{b/a} \frac{\mathrm{e}^{-\frac{1}{2} (\sqrt{2} a)^2 (1+t^2)}}{1+t^2} \, \mathrm{d} t = \frac{2 \pi \mathrm{e}^{a^2}}{a} \operatorname{T} \left(\sqrt{2} a, \frac{b}{a}\right) \, .$$

Further simplifications are only possible for particular values of $$b$$. For example, we have $$J(a,\infty) = \frac{\pi}{2 \lvert a \rvert} \mathrm{e}^{a^2} \operatorname{erfc}(\lvert a \rvert)$$ and, as already derived by Arjun Vyavaharkar, $$J(a,a) = \frac{\pi}{4 a} \mathrm{e}^{a^2} [1 - \operatorname{erf}^2(a)] \, .$$

There is already an excellent answer left by someone far smarter than me, so you should check out his (Henry Lee's) first. Anyway, the main way you should go about solving this integral is by considering a whole new family of integrals, namely $$I(\beta)$$ (I wanted to use $$\alpha$$ but that looks too similar to $$a$$):

$$I(\beta) = \int_0^b \dfrac{e^{-\beta s^2}}{a^2+s^2} \textrm{d}s$$

Then, differentiate both sides and use the Leibniz rule:

$$I'(\beta) = \dfrac{\textrm{d}}{\textrm{d}\beta}\int_0^b \dfrac{e^{-\beta s^2}}{a^2+s^2} \textrm{d}s$$

$$I'(\beta) = \int_0^b \dfrac{\frac{\partial}{\partial\beta}e^{-\beta s^2}}{a^2+s^2} \textrm{d}s$$

$$I'(\beta) = -\int_0^b \dfrac{s^2e^{-\beta s^2}}{a^2+s^2} \textrm{d}s$$

$$I'(\beta) = -\int_0^b \dfrac{a^2+s^2-a^2}{a^2+s^2}e^{-\beta s^2} \textrm{d}s$$

$$I'(\beta) = -\int_0^b \left(1-\dfrac{a^2}{a^2+s^2}\right)e^{-\beta s^2} \textrm{d}s$$

$$I'(\beta) = \int_0^b \left(\dfrac{a^2}{a^2+s^2}-1\right)e^{-\beta s^2} \textrm{d}s$$

$$I'(\beta) = a^2\int_0^b \dfrac{e^{-\beta s^2}}{a^2+s^2} \textrm{d}s - \int_0^b e^{-\beta s^2} \textrm{d}s$$

$$I'(\beta) = a^2 I(\beta) - \int_0^b e^{-\beta s^2} \textrm{d}s$$

$$I'(\beta) = a^2 I(\beta) - \dfrac{1}{2} \sqrt{\dfrac{\pi}{\beta}} \textrm{erf}(b\sqrt{\beta})$$

$$I'(\beta) - a^2 I(\beta) = -\dfrac{1}{2} \sqrt{\dfrac{\pi}{\beta}} \textrm{erf}(b\sqrt{\beta})$$

$$I'(\beta)\cdot e^{-\beta a^2} - I(\beta) \cdot a^2 e^{-\beta a^2} = -\dfrac{1}{2} \sqrt{\dfrac{\pi}{\beta}} \textrm{erf}(b\sqrt{\beta}) e^{-\beta a^2}$$

$$\dfrac{\textrm{d}}{\textrm{d}\beta}\left(I(\beta)\cdot e^{-\beta a^2}\right) = -\dfrac{1}{2} \sqrt{\dfrac{\pi}{\beta}} \textrm{erf}(b\sqrt{\beta}) e^{-\beta a^2}$$

$$I(\beta)\cdot e^{-\beta a^2} = -\dfrac{1}{2} \int \sqrt{\dfrac{\pi}{\beta}} \textrm{erf}(b\sqrt{\beta}) e^{-\beta a^2} \textrm{d}\beta$$

Unfortunately, I can't really give you a nice answer unless $$a$$ is equal to $$b$$, so you'll have to keep searching. However, if you're satisfied with $$a$$ and $$b$$ being the same, then the integral does have a nice "closed-form" (kind of) solution:

$$I(\beta)\cdot e^{-\beta a^2} = -\dfrac{1}{2} \int \sqrt{\dfrac{\pi}{\beta}} \textrm{erf}(a\sqrt{\beta}) e^{-\beta a^2} \textrm{d}\beta$$

$$I(\beta)\cdot e^{-\beta a^2} = -\dfrac{a}{2} \int \dfrac{\sqrt{\pi}}{a}\textrm{erf}(a\sqrt{\beta}) \dfrac{e^{-\beta a^2}}{\sqrt{\beta}} \textrm{d}\beta$$

$$u = \dfrac{\sqrt{\pi}}{a}\textrm{erf}(a\sqrt{\beta}) \implies \textrm{d}u = \dfrac{e^{-\beta a^2}}{\sqrt{\beta}} \textrm{d}\beta$$

$$I(\beta)\cdot e^{-\beta a^2} = -\dfrac{a}{2} \int u\; \textrm{d}u$$

$$I(\beta)\cdot e^{-\beta a^2} = C-\dfrac{au^2}{4}$$

$$I(\beta)\cdot e^{-\beta a^2} = C-\dfrac{a\left(\dfrac{\sqrt{\pi}}{a}\textrm{erf}(a\sqrt{\beta})\right)^2}{4}$$

Okay, now let's set $$\beta$$ to be equal to 0 and see what happens:

$$I(0)\cdot e^{0} = C-\dfrac{a\left(\dfrac{\sqrt{\pi}}{a}\textrm{erf}(0)\right)^2}{4}$$

$$I(0) = C$$

$$I(0) = \int_0^b \dfrac{1}{a^2+s^2} \textrm{d}s = \dfrac{1}{a} \arctan\left(\dfrac{b}{a}\right)$$

$$C = \dfrac{1}{a} \arctan\left(\dfrac{b}{a}\right) = \dfrac{1}{a} \arctan\left(1\right) = \dfrac{\pi}{4a}$$

So from this, we get the following result:

$$I(\beta)\cdot e^{-\beta a^2} = \dfrac{\pi}{4a}-\dfrac{a\left(\dfrac{\sqrt{\pi}}{a}\textrm{erf}(a\sqrt{\beta})\right)^2}{4}$$

$$I(\beta) = \left(\dfrac{\pi}{4a}-\dfrac{a\left(\dfrac{\sqrt{\pi}}{a}\textrm{erf}(a\sqrt{\beta})\right)^2}{4}\right) e^{\beta a^2}$$

$$I(\beta) = \left(\dfrac{\pi}{4a}-\dfrac{\pi\; \textrm{erf}^2(a\sqrt{\beta})}{4a}\right) e^{\beta a^2}$$

Unfortunately, I can't do much better than that. If you wanna solve your original integral, you'll have to find other ways of doing so. But hopefully this answer is good enough. Remember, it is only the solution to the following class of integrals:

$$I(\beta) = \int_0^a \dfrac{e^{-\beta s^2}}{a^2+s^2} \textrm{d}s$$

Edit: You could potentially define some multivariable function $$f(x,y)$$ to be the following:

$$f(x,y) = \dfrac{1}{y} \int \sqrt{\pi}\; \textrm{erf}(y\sqrt{\beta}) \dfrac{e^{-\beta x^2}}{\sqrt{\beta}} \textrm{d}\beta$$

And by IBP, one may prove the following relation to be valid:

$$f(x,y) = \dfrac{\pi}{xy}\textrm{erf}(x\sqrt{\beta})\textrm{erf}(y\sqrt{\beta}) - f(y,x)$$

This means that the function is pseudo-symmetric, in that it can be written as

$$f(x,y) = g(x,y) - f(y,x)$$

where $$g(x,y)$$ is some symmetric function.

• Very nice approach, I believe this will be the closest to a close form you can get for this problem (+1) Aug 9, 2021 at 12:06