# Integral of the product of Normal density and cdf

I am struggling with an integral pretty similar to one already resolved in MO (link: Integration of the product of pdf & cdf of normal distribution ). I will reproduce the calculus bellow for the sake of clarity, but I want to stress the fact that my computatons are essentially a reproduction of the discussion of the previous thread.

In essence, I need to solve: $$\int_{-\infty}^\infty\Phi\left(\frac{f-\mathbb{A}}{\mathbb{B}}\right)\phi(f)\,df,$$ where $$\Phi$$ is cdf of a standard normal, and $$\phi$$ its density. $$\mathbb{B}$$ is a negative constant.

As done in the aforementioned link, the idea here is to compute the derivative of the integral with respect to $$\mathbb{A}$$ (thanks to Dominated Convergence Theorem, integral and derivative can switch positions). With this, \begin{align*} \partial_A\left[\int_{-\infty}^\infty\Phi\left(\frac{f-A}{B}\right)\phi(f)\,df\right]&=\int_{-\infty}^\infty\partial_A\left[\Phi\left(\frac{f-A}{B}\right)\phi(f)\right]\,df=\int_{-\infty}^\infty-\frac{1}{B}\phi\left(\frac{f-A}{B}\right)\phi(f)\,df \end{align*} We note now that

$$\phi\left(\frac{f-A}{B}\right)\phi(f)=\frac{1}{2\pi}\exp\left(-\frac{1}{2}\left[\frac{(f-A)^2}{B^2}+f^2\right]\right)=\exp\left(-\frac{1}{2B^2}\left[f^2(1+B^2)+A^2-2Af\right]\right)$$ $$=\frac{1}{2\pi}\exp\left(-\frac{1}{2B^2}\left[\left(f\sqrt{1+B^2}-\frac{A}{\sqrt{1+B^2}}\right)^2+\frac{B^2}{1+B^2}A^2\right]\right)$$

Finally, then,

$$\partial_A\left[\int_{-\infty}^\infty\Phi\left(\frac{f-A}{B}\right)\phi(f)\,df\right]$$

$$\ \ \ \ \ =-\frac{1}{\sqrt{2\pi}B}\exp\left(-\frac{A^2}{2(1+B^2)}\right)\frac{1}{2\pi}\int_{-\infty}^\infty\exp\left(-\frac{1}{2B^2}\left[f\sqrt{1+B^2}-\frac{A}{\sqrt{1+B^2}}\right]^2\right)\,df$$

and with the change of variable \begin{align} \left[y\longmapsto f\frac{\sqrt{1+B^2}}{B}-\frac{A}{B\sqrt{1+B^2}}\Longrightarrow df=\frac{B}{\sqrt{1+B^2}}\,dy\right] \end{align} we get \begin{align} \frac{1}{\sqrt{2\pi}}\int_{-\infty}^\infty\exp\left(-\frac{1}{2B^2}\left[f\sqrt{1+B^2}-\frac{A}{\sqrt{1+B^2}}\right]^2\right)\,df=\frac{B}{\sqrt{1+B^2}}\int_{-\infty}^{\infty}\phi(y)\,dy=\frac{B}{\sqrt{1+B^2}} \end{align} This means that \begin{align} \partial_A\left[\int_{-\infty}^\infty\Phi\left(\frac{f-A}{B}\right)\phi(f)\,df\right]&=-\frac{1}{\sqrt{2\pi}B}\exp\left(-\frac{A^2}{2(1+B^2)}\right)\frac{B}{\sqrt{1+B^2}}=-\frac{1}{\sqrt{1+B^2}}\phi\left(\frac{A}{\sqrt{1+B^2}}\right) \end{align} At this point, given that (as $$\mathbb{B}$$ is negative) $$\Phi\left(\frac{f-A}{\mathbb{B}}\right)\phi(f)=0$$ when $$\mathbb{A}\rightarrow-\infty$$, the integral we are looking for is equal to \begin{align} \int_{-\infty}^{\mathbb{A}}-\frac{1}{\sqrt{1+\mathbb{B}^2}}\phi\left(\frac{A}{\sqrt{1+\mathbb{B}^2}}\right)\,dA \end{align} Again with the obvious change of variables $$\left[y\longmapsto\frac{A}{\sqrt{1+\mathbb{B}^2}}\Longrightarrow\sqrt{1+\mathbb{B}^2}\,dy=dA\right]$$ one gets \begin{align} \int_{-\infty}^{\mathbb{A}}-\frac{1}{\sqrt{1+\mathbb{B}^2}}\phi\left(\frac{A}{\sqrt{1+\mathbb{B}^2}}\right)\,dA=-\frac{1}{\sqrt{1+\mathbb{B}^2}}\sqrt{1+\mathbb{B}^2}\int_{-\infty}^{\mathbb{A}/\sqrt{1+\mathbb{B}^2}}\phi(y)\,dy=-\Phi({\mathbb{A}/\sqrt{1+\mathbb{B}^2}}). \end{align} The problem here is that this number should obviously be positive, so at some point I am missing a signal. As the computations seem sound to me, I would like to see if anyone could help me to find my mistake.

Many thanks to you all.

• A faulty step is "At this point, given that" since when $B\to-\infty$, the product you consider goes to $\Phi(0)\phi(f)=\frac12\phi(f)\ne0$. – Did Apr 10 '13 at 13:42
• Oh god that's more than faulty, thats outrageous ;). Many thanks for your help! – Víctor Apr 10 '13 at 14:13
• At the end this is not as outrageous as it seemed XD: in fact it is a typo, it should read "when A\rightarrow-\infty". Then the subsequent line holds. I have edited it. – Víctor Apr 10 '13 at 14:21
• Even though the original question is satisfactory solved, I am still curious with the mistake in the computations above, so any help would be appreciated ;). – Víctor Apr 10 '13 at 14:44
• minor typo-ette in the third line: missing the $1/2\pi$ – Hugh Perkins Oct 2 '17 at 6:58

## 2 Answers

The horror, the horror... :-)

Recall that $\Phi(x)=P[X\leqslant x]$ for every $x$, where the random variable $X$ is standard normal, and that, for every suitable function $u$, $$\int_{-\infty}^{+\infty}u(x)\phi(x)\mathrm dx=E[u(Y)],$$ where the random variable $Y$ is standard normal. Using this for $u=\Phi$, one sees that the integral $I$ you are interested in is $$I=P[X\leqslant B^{-1}(Y-A))]=P[BX\geqslant Y-A]=P[Z\leqslant A],$$ where $Z=Y-BX$, where $X$ and $Y$ are i.i.d. standard normal, and where we used the fact that $B\lt0$ to reverse the inequality sign. Now, the random variable $Z$ is centered gaussian with variance $\sigma^2=1+B^2$, hence $Z=\sigma U$ with $U$ standard normal, and $$I=P[U\leqslant A/\sigma]=\Phi(A/\sqrt{1+B^2}).$$

• This completely solves the original problem. Thanks! – Víctor Apr 10 '13 at 14:11
• +1 for the great answer! There seems a gap for me at $I=P[X\leqslant B^{-1}(Y-A))]$. Could you explain it a little bit? – Randel Sep 25 '15 at 15:04
• @Randel How can you think this is a great answer if you feel there is a gap at the first step, I wonder... Anyway, thanks for the appreciation, and note that $$\int_\mathbb R\Phi(B^{-1}(x-A))\varphi(x)\mathrm dx=E(\Phi(B^{-1}(Y-A)))$$ and that, for every $x$, $$\Phi(x)=P(X\leqslant x),$$ hence, using the independence of $X$ and $Y$, one gets the formula in the post. – Did Sep 25 '15 at 15:10

When you do the change of variable, you are doing:

\begin{align} \left[y\longmapsto f\frac{\sqrt{1+B^2}}{B}-\frac{A}{B\sqrt{1+B^2}}\Longrightarrow df=\frac{B}{\sqrt{1+B^2}}\,dy\right] \end{align}

.. which is correct. However, we need to apply the same change of variable to the bounds, ie to $-\infty$ and $+\infty$. Given that $\mathbb{B}$ is a negative constant, the bounds will change sign, becoming $+\infty$ and $-\infty$. So we will have:

\begin{align} \frac{1}{\sqrt{2\pi}}\int_{-\infty}^\infty\exp\left(-\frac{1}{2B^2}\left[f\sqrt{1+B^2}-\frac{A}{\sqrt{1+B^2}}\right]^2\right)\,df=\frac{B}{\sqrt{1+B^2}}\int_{\infty}^{-\infty}\phi(y)\,dy=-\frac{B}{\sqrt{1+B^2}} \end{align}

This sign change will then propagate through to the final answer, reversing its sign too.

Full working, based off your working above, but with some buggettes removed:

Start with:

$$I = \def\A{\mathbb{A}} \def\B{\mathbb{B}} \int_{-\infty}^\infty \Phi\left( \frac{f - \A} {\B} \right)\phi(f)\, df$$

Take derivative wrt $\A$:

$$\partial_\A I = \int_{-\infty}^\infty \partial_\A \left( \Phi \left( \frac{f - \A}{\B} \right) \phi(f) \right) \, df$$

$$=\int_{-\infty}^\infty \left( \frac{-1}{\B} \right) \phi\left( \frac{f - \A}{\B} \right) \phi(f) \, df$$

Looking at $E_1 = \phi\left(\frac{f - \A}{\B}\right) \phi(f)$:

$$E_1 = \frac{1}{2\pi} \exp \left( - \frac{1}{2} \left( \frac{f^2 - 2f\A + \A^2 + \B^2f^2} {B^2} \right) \right)$$

$$=\frac{1}{2\pi} \exp\left( - \frac{1}{2\B^2} \left( \left( \sqrt{(1 + \B^2)}f - \A\frac{1}{\sqrt{1 + \B^2}} \right)^2 - \frac{\A^2} {1 + \B^2} + \A^2 \right) \right)$$

$$- \frac{\A^2}{1+\B^2} + \A^2$$

$$= \frac{-\A^2 + \A^2 + \A^2\B^2} {1 + \B^2}$$

$$= \frac{\A^2\B^2} {1 + \B^2}$$

Therefore $E_1$ is:

$$\frac{1}{2\pi} \exp \left( -\frac{1}{2\B^2} \frac{\A^2\B^2}{1 + \B^2} \right) \exp \left( - \frac{1}{2\B^2} \left( f\sqrt{1 + \B^2} - \frac{\A}{\sqrt{1 + \B^2}} \right)^2 \right)$$

$$= \frac{1}{2\pi} \exp \left( -\frac{\A^2}{2(1 + \B^2)} \right) \exp \left( - \frac{1}{2\B^2} \left( f\sqrt{1 + \B^2} - \frac{\A}{\sqrt{1 + \B^2}} \right)^2 \right)$$

Make change of variable:

$$y = f\frac{\sqrt{1 + \B^2}}{\B} - \frac{A}{\B\sqrt{1 + \B^2}}$$

Therefore:

$$dy = \frac{\sqrt{1 + \B^2}}{\B}\,df$$

For the limits, we have $f_1 = -\infty$, and $f_2 = \infty$

$\sqrt{1 + \B^2}$ is always positive. $\B$ is always negative. Therefore:

$$y_1 = +\infty, y_2 = -\infty$$

Therefore:

$$\partial_\A I = \frac{-1}{\B}\int_{+\infty}^{-\infty} \frac{1}{2\pi} \exp \left( - \frac{\A^2} {2(1+\B^2)} \right) \exp \left( - \frac{1}{2} y^2 \right) \frac{\B}{\sqrt{1 + \B^2}} \, dy$$

$$= \frac{1}{\sqrt{2\pi}} \frac{1}{\B} \frac{\B}{\sqrt{1 + \B^2}} \exp \left( - \frac{\A^2}{2(1 + \B^2)} \right) \int_{-\infty}^\infty \frac{1}{\sqrt{2\pi}} \exp\left( -\frac{1}{2} y^2 \right) \, dy$$

$$= \frac{1}{\sqrt{2\pi}} \frac{1}{\sqrt{1+\B^2}} \exp \left( - \frac{\A^2}{2(1 + \B^2)} \right) (1)$$

$$= \frac{1}{\sqrt{1 + \B^2}} \phi\left( \frac{\A}{\sqrt{1 + \B^2}} \right)$$

Now we need to re-integrate back up again, since we currently have $\partial_\A I$, and we need $I$.

Since we dont have limits, we'll need to find at least one known point.

We have the following integral:

$$I = \frac{1}{\sqrt{1 + \B^2}} \int \phi\left( \frac{\A}{\sqrt{1 + \B^2}} \right) \,d\A$$

$$= \frac{1}{\sqrt{1 + \B^2}} \sqrt{1 + \B^2} \Phi\left( \frac{\A} {\sqrt{1 + \B^2}} \right) + C$$ ... where $C$ is a constant of integration

$$= \Phi \left( \frac{\A}{\sqrt{1 + \B^2}} \right) + C$$

Looking at the original integral, we had/have:

$$I = \int_{-\infty}^\infty \Phi\left( \frac{f - \A}{\B} \right) \phi(f) \, df$$

We can see that, given that $\B$ is negative, as $\A \rightarrow \infty$, $\Phi\left(\frac{f-\A}{\B}\right) \rightarrow \Phi(\infty) = 1$.

Therefore, as $\A \rightarrow \infty$, $\int_{-\infty}^\infty \Phi(\cdot)\phi(f)\,df \rightarrow 1$

Meanwhile, looking at the later expression for $I$, ie:

$$I= \Phi\left( \frac{\A}{\sqrt{1 + \B^2}} \right) + C$$

... as $\A \rightarrow +\infty$, $\Phi\left( \frac{\A}{\sqrt{1 + \B^2}} \right) \rightarrow 1$

But we know that as $\A \rightarrow +\infty$, $I \rightarrow 1$.

Therefore, $C = 0$

Therefore:

$$I = \Phi \left( \frac{\A} {\sqrt{1 + \B^2}} \right)$$