# Looking for a closed-form expression of an integral involving Erfc and Exp

I'm looking for a closed-form expression of an integral below involving Erfc.

Integrate[Erfc[c*x + d]*Exp[-a*x^2]*Exp[b*x], x]


or

$$\int \operatorname{erfc}(c x+d) e^{-a x^2} e^{b x} \, dx$$

I've checked standard lists such as this one.

The integrand is well behaved, and I can numerically integrate it for real positive constants a, b, c, d.

Any hope of an analytic answer? Mathematica 11.1 does not find one.

I actually want a closed-form expression for the following definite integral, should that turn out to be easier.

Integrate[Erfc[c*x + d]*Exp[-a*x^2]*Exp[b*x], {x, -Infinity, Infinity}]


or

$$\int_{-\infty}^{\infty} \operatorname{erfc}(c x+d) e^{-a x^2} e^{b x} \, dx$$

• – Michael E2 Apr 11 '18 at 23:45
• A closed-form solution may not exist. About the best Mathematica appears to be able to do is Integrate[ Erfc[c*x + d]*Exp[-a*x^2]*Exp[b*x], {x, -Infinity, Infinity}, Assumptions -> c > 0 && a > 0 && d == 0 && b == 0], which yields Sqrt[π]/Sqrt[a]. – bbgodfrey Apr 12 '18 at 1:32

$$I(d)=\int_{-\infty }^{\infty } \text{erfc}(c x+d) \exp \left(-a x^2\right) \exp (b x) \, dx$$ Assume: $d=\infty$

Limit[Erfc[c*x + d]*Exp[-a*x^2]*Exp[b*x], d -> Infinity]

(* O *)


then we have: $I(\infty )=0$

We differentiate the two sides of the equation for d.

$$\frac{\partial I(d)}{\partial d}=\int_{-\infty }^{\infty } \frac{\partial }{\partial d}\left(\text{erfc}(c x+d) \exp \left(-a x^2\right) \exp (b x)\right) \, dx$$

D[Erfc[c*x + d]*Exp[-a*x^2]*Exp[b*x], d]
(* -((2 E^(b x - a x^2 - (d + c x)^2))/Sqrt[\[Pi]])  *)


$$\frac{\partial I(d)}{\partial d}=\int_{-\infty }^{\infty } -\frac{2 e^{b x-a x^2-(d+c x)^2}}{\sqrt{\pi }} \, dx$$

Integrate[-((2 E^(b x - a x^2 - (d + c x)^2))/Sqrt[\[Pi]]), {x, -Infinity, Infinity}, Assumptions -> {b > 0, a > 0, c > 0, d > 0}]

(*-((2 E^((b^2 - 4 b c d - 4 a d^2)/(4 (a + c^2))))/Sqrt[a + c^2])*)


$$\frac{\partial I(d)}{\partial d}=-\frac{2 e^{\frac{b^2-4 b c d-4 a d^2}{4 \left(a+c^2\right)}}}{\sqrt{a+c^2}}$$

 Integrate[-((2 E^((b^2 - 4 b c d - 4 a d^2)/(4 (a + c^2))))/Sqrt[a + c^2]), d]
(* -((E^(b^2/(4 a)) Sqrt[\[Pi]]
Erf[(b c + 2 a d)/(2 Sqrt[a] Sqrt[a + c^2])])/Sqrt[a]) *)


$$I(d)=-\frac{e^{\frac{b^2}{4 a}} \sqrt{\pi } \text{erf}\left(\frac{b c+2 a d}{2 \sqrt{a} \sqrt{a+c^2}}\right)}{\sqrt{a}}+c(1)$$

and boundary condition $I(\infty )=0$ then $c(1)=\frac{e^{\frac{b^2}{4 a}} \sqrt{\pi }}{\sqrt{a}}$

$$\color{blue}{\int_{-\infty }^{\infty } \text{erfc}(c x+d) \exp \left(-a x^2\right) \exp (b x) \, dx=-\frac{e^{\frac{b^2}{4 a}} \sqrt{\pi } \text{erf}\left(\frac{b c+2 a d}{2 \sqrt{a} \sqrt{a+c^2}}\right)}{\sqrt{a}}+\frac{e^{\frac{b^2}{4 a}} \sqrt{\pi }}{\sqrt{a}}}$$

Check:

f[a_, b_, c_, d_] := NIntegrate[Erfc[c*x + d]*Exp[-a*x^2]*Exp[b*x], {x, -Infinity, Infinity}];

g[a_, b_, c_, d_] :=-((E^(b^2/(4 a)) Sqrt[π]Erf[(b c + 2 a d)/(2 Sqrt[a]
Sqrt[a + c^2])])/Sqrt[a]) + (E^(b^2/(4 a)) Sqrt[π])/Sqrt[a] // N

f[1, 2, 3, 4]
g[1, 2, 3, 4]

(* 0.008408032668 *)
(* 0.008408032668 *)

• Neat! $\phantom{}$ – J. M. will be back soon Apr 13 '18 at 2:46
• There's an upvote for you of something more deserving that I had missed. – Michael E2 May 6 '18 at 20:56
• @MichaelE2. Thank you very much. :) – Mariusz Iwaniuk May 6 '18 at 21:14

By changing variables, the definite integral can be rewritten as a constant times the following definite integral (where a and d are not the same as in the original integral):

int = Inactive[Integrate][Erfc[x + d] Exp[-a x^2], {x, -Infinity, Infinity}];


Let's series expand the integrand, and then integrate:

integrand = Erfc[x + d] Exp[-a x^2];
series = Series[integrand, {d, 0, 20}];

terms = Integrate[series[], {x, -Infinity, Infinity}, Assumptions->a>0];
terms //TeXForm


$\left\{\frac{\sqrt{\pi }}{\sqrt{a}},-\frac{2}{\sqrt{a+1}},0,\frac{2 a}{3 (a+1)^{3/2}},0,-\frac{a^2}{5 (a+1)^{5/2}},0,\frac{a^3}{21 (a+1)^{7/2}},0,-\frac{a^4}{108 (a+1)^{9/2}},0,\frac{a^5}{660 (a+1)^{11/2}},0,-\frac{a^6}{4680 (a+1)^{13/2}},0,\frac{a^7}{37800 (a+1)^{15/2}},0,-\frac{a^8}{342720 (a+1)^{17/2}},0,\frac{a^9}{3447360 (a+1)^{19/2}},0\right\}$

Dropping the constant term, and noticing that the series alternates, we can try using FindGeneratingFunction as follows:

gf = FindGeneratingFunction[terms[[2 ;; -1 ;; 2]] /. a->λ/(1-λ) //Simplify, d];
Sqrt[d] gf /. {λ -> a/(1+a), d->d^2} //Simplify


-((Sqrt[π] Erf[Sqrt[a/(1 + a)] Sqrt[d^2]])/Sqrt[a])

Hence, the definite integral might be:

dint[a_, d_] = Sqrt[π/a](1 - Erf[Sqrt[a/(1+a)] d])


Sqrt[1/a] Sqrt[π] (1 - Erf[Sqrt[a/(1 + a)] d])

For comparison, here's the numerical integration version:

nint[a_, d_] := NIntegrate[Erfc[x + d] Exp[-a x^2], {x, -Infinity, Infinity}]


Spot checks:

dint[Pi, 1.1]
nint[Pi, 1.1]

dint[2, -1.]
nint[2, -1.]


0.175458

0.175458

2.19554

2.19554

So, it looks like FindGeneratingFunction successfully converted the series into a function. I will let you perform the shift + rescaling necessary to convert the above integral into the form you desire.