# Help Solving Integration $\int_{-\infty}^{\infty} {(\text{Standard Normal} \times \text{Sigmoid}) }$ [duplicate]

This question is an exact duplicate of:

Does anyone know how to analytically solve the below expression?

$$\int_{-\infty}^\infty p(x) \times \sigma(ax + b) \, dx$$

where $p(x) = N(0, 1) = \frac{1}{\sqrt{2\pi}}e^{\frac{-x^2}{2}}$ and $\sigma(z) = \frac{1}{1+e^{-z}}$.

I know that the integration of standard Gaussian is $\pi$. Moreover, the integration of sigmoid alone is,

$$\int \sigma(x) \, df = \int \frac{e^x}{1+e^x} \, dx = x + c$$

But I cant figure out how to integrate the first equation), when they are multiplied together.

Can we use integration by part and solve above equation?

Any help will be appreciated. Thanks

Edit 1:

Sorry about the complicated notations. If we simplify the above expression, then we get following equation. $$\frac{1}{\sqrt{2\pi}} \int_{-\infty}^\infty \frac{e^{-\frac{x^2}{2}}}{1+e^{-x}} dx$$

## marked as duplicate by Did, Sil, Namaste integration StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Aug 11 '18 at 12:36

This question was marked as an exact duplicate of an existing question.

• What is $p(x)$ ? Is it the probability density function ? – MysteryGuy Aug 2 '18 at 12:11
• yes. $p(x) = \frac{1}{\sqrt{2\pi}}e^{\frac{-x^2}{2}}$ – Nadheesh Aug 2 '18 at 12:17
• If $x$ is between $\pm\infty,$ as opposed to $x$ having an imaginary part, then $\ln|e^x|$ is redundant and one can just write $\ln e^x,$ and $\ln e^x$ is the same as $x,$ so $\ln e^x + c = x + c. \qquad$ – Michael Hardy Aug 2 '18 at 12:26
• @MichaelHardy thanks for the suggestion. edited the post accordingly. However, that is not what I'm interested in. I want to solve the first expression. – Nadheesh Aug 2 '18 at 12:33
• Sorry I’m not familiar with this topic...but what is $N(0,1)$? – Szeto Aug 2 '18 at 12:35

• Thanks for all the work, I would have never thought of this myself. How can we solve the expression if the sigmoid function include some other parameters as show below? $$\frac{1}{\sqrt{2\pi}} \int_{-\infty}^\infty \frac{e^{-\frac{x^2}{2}}}{1+e^{-(ax+b)}} dx$$ – Nadheesh Aug 3 '18 at 1:54
• Going from the second to the first line, why can we change the integration bounds and $e^x$ – badatmath Aug 27 '18 at 9:01
• I used $x \to -x$ transformation. – Math-fun Aug 27 '18 at 9:15
$$\varphi(x) = \frac 1 {\sqrt{2\pi}} e^{-x^2/2}$$ $$\sigma (x) = \frac 1 {1+e^{-x}}$$ Some simple algebra shows that $$\sigma(-x) = 1 - \sigma(x)$$ and it is even easier to show that $$\varphi(-x) = \varphi(x),$$ so we have $$\int_{-\infty}^0 \varphi(x)\,dx = \int_0^\infty \varphi(x)\,dx = \frac 1 2.$$
Therefore \begin{align} \int_{-\infty}^0 \sigma(x) \varphi(x) \, dx & = \int_0^{+\infty} (1-\sigma(x)) \varphi(x)\, dx \\[10pt] & = \int_0^{+\infty} \varphi(x)\,dx - \int_0^{+\infty} \sigma(x)\varphi(x)\,dx \end{align} Therefore $$\int_{-\infty}^{+\infty} \sigma(x)\varphi(x)\,dx = \int_0^{+\infty} \varphi(x)\, dx = \frac 1 2.$$
• Thanks for the solution. This seems pretty simple yet, I could not have think of without your help. However, if we have some other variables within the sigmoid function, then how can we solve the same expression. I tried substituting z = ax+b, then I could not get rid of the sigmoid. $$\frac{1}{\sqrt{2\pi}} \int_{-\infty}^\infty \frac{e^{-\frac{x^2}{2}}}{1+e^{-(ax+b)}} dx$$ – Nadheesh Aug 3 '18 at 1:57