Derivation of a closed-form solution for the integral of a 3D Gaussian over the *positive* reals












1












$begingroup$


in a post from over four years ago, Przemo gave the following formula for the integral over a Gaussian function over the positive reals in three dimensions (denoted here as $mathbb{R}^3_+$) with inverse covariance $A=left(begin{array}{rrr}a & a_{12} & a_{13}\a_{12}& b&a_{23}\a_{13}&a_{23}&cend{array}right)$:



begin{multline}
int_{mathbb{R}^3_+} mathrm{d}x ; expleft(-frac{1}{2}x^top A xright) = \
frac{pi}{sqrt{2 det A}}intlimits_0^infty mathrm{erfc}left(u sqrt{frac{-2 a_{12}a_{13}a_{23}+a_{13}^2 b+a_{12}^2 c}{det(A)}}right)e^{-u^2}cdot \
left[-mathrm{erfc}left(sqrt{a} frac{a_{12} c-a_{13}a_{23}}{a_{13} sqrt{det(A)}} uright)+mathrm{erfc}left(sqrt{a} frac{a_{12}a_{23}-a_{13} b}{a_{12} sqrt{det(A)}} uright)right] du
end{multline}



This integral can be done using the techniques outlined here, yielding a closed-form solution to the original problem.



I would like to understand the derivation of the intermediate result given above. In his original post, Przemo details the calculation in two dimensions: complete the square in the quadratic form; do the first integral, which yields an error function; expand the error function and do the remaining integral term by term. How can you adapt this approach to 3D?



Steps undertaken so far:




  • Completing the square in one variable, say $x$, leaves me with
    $$int_{mathbb{R}_+^2} mathrm{d}ymathrm{d}z expleft(-frac{1}{2} frac{mathrm{det},A_3}{mathrm{det},A_2}z^2right) expleft(-frac{1}{2} frac{mathrm{det}, A_2}{a}(y-m z)^2right) left[1 - mathrm{erf}left(frac{a_{12}y+a_{13}z}{sqrt{2a}}right) right] $$
    where $A_2=begin{pmatrix} a & a_{12}\ & bend{pmatrix}$, $A_3$ as defined above, and $m$ is a function of the coefficients of the matrices. However, I do not know how to proceed from there: expanding the error function to do the integral in y, say, is a nightmare due to the constant term in z; I also did not find a way to do a coordinate transform à la $s=a_{12}y+a_{13}z$ or something similar.


  • Indeed, the formula above looks more like one completed the square in two of the variables independently; but what happened to the cross-term? I cannot find a factorisation of the exponent that would allow me to complete two integrals over the half-line with only one variable left in the error function yielded by the integral.



Any help / hint would be greatly appreciated! Thank you in advance for your time :)










share|cite|improve this question











$endgroup$








  • 1




    $begingroup$
    @ workandheat I have provided detailed explanations in the original post if you wanna see them. Unfortunately for the time being I am unable to generalize tyhe solution to dimensions higher than three. My question to you is therefore why are you interested in this very problem? Have you managed to to make any progress? I have some ideas which I can share with you if you wish.
    $endgroup$
    – Przemo
    Jan 25 at 16:43










  • $begingroup$
    @Przemo I am also interested in this problem (the reason being that it directly relates to the probability of a perceptron with binary input/outputs producing a particular function, when weights are Gaussian). I still need to go through your derivation, but if you want to share the ideas with me too, I would appreciate it lots!
    $endgroup$
    – guillefix
    Feb 12 at 17:44
















1












$begingroup$


in a post from over four years ago, Przemo gave the following formula for the integral over a Gaussian function over the positive reals in three dimensions (denoted here as $mathbb{R}^3_+$) with inverse covariance $A=left(begin{array}{rrr}a & a_{12} & a_{13}\a_{12}& b&a_{23}\a_{13}&a_{23}&cend{array}right)$:



begin{multline}
int_{mathbb{R}^3_+} mathrm{d}x ; expleft(-frac{1}{2}x^top A xright) = \
frac{pi}{sqrt{2 det A}}intlimits_0^infty mathrm{erfc}left(u sqrt{frac{-2 a_{12}a_{13}a_{23}+a_{13}^2 b+a_{12}^2 c}{det(A)}}right)e^{-u^2}cdot \
left[-mathrm{erfc}left(sqrt{a} frac{a_{12} c-a_{13}a_{23}}{a_{13} sqrt{det(A)}} uright)+mathrm{erfc}left(sqrt{a} frac{a_{12}a_{23}-a_{13} b}{a_{12} sqrt{det(A)}} uright)right] du
end{multline}



This integral can be done using the techniques outlined here, yielding a closed-form solution to the original problem.



I would like to understand the derivation of the intermediate result given above. In his original post, Przemo details the calculation in two dimensions: complete the square in the quadratic form; do the first integral, which yields an error function; expand the error function and do the remaining integral term by term. How can you adapt this approach to 3D?



Steps undertaken so far:




  • Completing the square in one variable, say $x$, leaves me with
    $$int_{mathbb{R}_+^2} mathrm{d}ymathrm{d}z expleft(-frac{1}{2} frac{mathrm{det},A_3}{mathrm{det},A_2}z^2right) expleft(-frac{1}{2} frac{mathrm{det}, A_2}{a}(y-m z)^2right) left[1 - mathrm{erf}left(frac{a_{12}y+a_{13}z}{sqrt{2a}}right) right] $$
    where $A_2=begin{pmatrix} a & a_{12}\ & bend{pmatrix}$, $A_3$ as defined above, and $m$ is a function of the coefficients of the matrices. However, I do not know how to proceed from there: expanding the error function to do the integral in y, say, is a nightmare due to the constant term in z; I also did not find a way to do a coordinate transform à la $s=a_{12}y+a_{13}z$ or something similar.


  • Indeed, the formula above looks more like one completed the square in two of the variables independently; but what happened to the cross-term? I cannot find a factorisation of the exponent that would allow me to complete two integrals over the half-line with only one variable left in the error function yielded by the integral.



Any help / hint would be greatly appreciated! Thank you in advance for your time :)










share|cite|improve this question











$endgroup$








  • 1




    $begingroup$
    @ workandheat I have provided detailed explanations in the original post if you wanna see them. Unfortunately for the time being I am unable to generalize tyhe solution to dimensions higher than three. My question to you is therefore why are you interested in this very problem? Have you managed to to make any progress? I have some ideas which I can share with you if you wish.
    $endgroup$
    – Przemo
    Jan 25 at 16:43










  • $begingroup$
    @Przemo I am also interested in this problem (the reason being that it directly relates to the probability of a perceptron with binary input/outputs producing a particular function, when weights are Gaussian). I still need to go through your derivation, but if you want to share the ideas with me too, I would appreciate it lots!
    $endgroup$
    – guillefix
    Feb 12 at 17:44














1












1








1





$begingroup$


in a post from over four years ago, Przemo gave the following formula for the integral over a Gaussian function over the positive reals in three dimensions (denoted here as $mathbb{R}^3_+$) with inverse covariance $A=left(begin{array}{rrr}a & a_{12} & a_{13}\a_{12}& b&a_{23}\a_{13}&a_{23}&cend{array}right)$:



begin{multline}
int_{mathbb{R}^3_+} mathrm{d}x ; expleft(-frac{1}{2}x^top A xright) = \
frac{pi}{sqrt{2 det A}}intlimits_0^infty mathrm{erfc}left(u sqrt{frac{-2 a_{12}a_{13}a_{23}+a_{13}^2 b+a_{12}^2 c}{det(A)}}right)e^{-u^2}cdot \
left[-mathrm{erfc}left(sqrt{a} frac{a_{12} c-a_{13}a_{23}}{a_{13} sqrt{det(A)}} uright)+mathrm{erfc}left(sqrt{a} frac{a_{12}a_{23}-a_{13} b}{a_{12} sqrt{det(A)}} uright)right] du
end{multline}



This integral can be done using the techniques outlined here, yielding a closed-form solution to the original problem.



I would like to understand the derivation of the intermediate result given above. In his original post, Przemo details the calculation in two dimensions: complete the square in the quadratic form; do the first integral, which yields an error function; expand the error function and do the remaining integral term by term. How can you adapt this approach to 3D?



Steps undertaken so far:




  • Completing the square in one variable, say $x$, leaves me with
    $$int_{mathbb{R}_+^2} mathrm{d}ymathrm{d}z expleft(-frac{1}{2} frac{mathrm{det},A_3}{mathrm{det},A_2}z^2right) expleft(-frac{1}{2} frac{mathrm{det}, A_2}{a}(y-m z)^2right) left[1 - mathrm{erf}left(frac{a_{12}y+a_{13}z}{sqrt{2a}}right) right] $$
    where $A_2=begin{pmatrix} a & a_{12}\ & bend{pmatrix}$, $A_3$ as defined above, and $m$ is a function of the coefficients of the matrices. However, I do not know how to proceed from there: expanding the error function to do the integral in y, say, is a nightmare due to the constant term in z; I also did not find a way to do a coordinate transform à la $s=a_{12}y+a_{13}z$ or something similar.


  • Indeed, the formula above looks more like one completed the square in two of the variables independently; but what happened to the cross-term? I cannot find a factorisation of the exponent that would allow me to complete two integrals over the half-line with only one variable left in the error function yielded by the integral.



Any help / hint would be greatly appreciated! Thank you in advance for your time :)










share|cite|improve this question











$endgroup$




in a post from over four years ago, Przemo gave the following formula for the integral over a Gaussian function over the positive reals in three dimensions (denoted here as $mathbb{R}^3_+$) with inverse covariance $A=left(begin{array}{rrr}a & a_{12} & a_{13}\a_{12}& b&a_{23}\a_{13}&a_{23}&cend{array}right)$:



begin{multline}
int_{mathbb{R}^3_+} mathrm{d}x ; expleft(-frac{1}{2}x^top A xright) = \
frac{pi}{sqrt{2 det A}}intlimits_0^infty mathrm{erfc}left(u sqrt{frac{-2 a_{12}a_{13}a_{23}+a_{13}^2 b+a_{12}^2 c}{det(A)}}right)e^{-u^2}cdot \
left[-mathrm{erfc}left(sqrt{a} frac{a_{12} c-a_{13}a_{23}}{a_{13} sqrt{det(A)}} uright)+mathrm{erfc}left(sqrt{a} frac{a_{12}a_{23}-a_{13} b}{a_{12} sqrt{det(A)}} uright)right] du
end{multline}



This integral can be done using the techniques outlined here, yielding a closed-form solution to the original problem.



I would like to understand the derivation of the intermediate result given above. In his original post, Przemo details the calculation in two dimensions: complete the square in the quadratic form; do the first integral, which yields an error function; expand the error function and do the remaining integral term by term. How can you adapt this approach to 3D?



Steps undertaken so far:




  • Completing the square in one variable, say $x$, leaves me with
    $$int_{mathbb{R}_+^2} mathrm{d}ymathrm{d}z expleft(-frac{1}{2} frac{mathrm{det},A_3}{mathrm{det},A_2}z^2right) expleft(-frac{1}{2} frac{mathrm{det}, A_2}{a}(y-m z)^2right) left[1 - mathrm{erf}left(frac{a_{12}y+a_{13}z}{sqrt{2a}}right) right] $$
    where $A_2=begin{pmatrix} a & a_{12}\ & bend{pmatrix}$, $A_3$ as defined above, and $m$ is a function of the coefficients of the matrices. However, I do not know how to proceed from there: expanding the error function to do the integral in y, say, is a nightmare due to the constant term in z; I also did not find a way to do a coordinate transform à la $s=a_{12}y+a_{13}z$ or something similar.


  • Indeed, the formula above looks more like one completed the square in two of the variables independently; but what happened to the cross-term? I cannot find a factorisation of the exponent that would allow me to complete two integrals over the half-line with only one variable left in the error function yielded by the integral.



Any help / hint would be greatly appreciated! Thank you in advance for your time :)







definite-integrals gaussian-integral






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Dec 21 '18 at 15:55







workandheat

















asked Dec 21 '18 at 9:05









workandheatworkandheat

587




587








  • 1




    $begingroup$
    @ workandheat I have provided detailed explanations in the original post if you wanna see them. Unfortunately for the time being I am unable to generalize tyhe solution to dimensions higher than three. My question to you is therefore why are you interested in this very problem? Have you managed to to make any progress? I have some ideas which I can share with you if you wish.
    $endgroup$
    – Przemo
    Jan 25 at 16:43










  • $begingroup$
    @Przemo I am also interested in this problem (the reason being that it directly relates to the probability of a perceptron with binary input/outputs producing a particular function, when weights are Gaussian). I still need to go through your derivation, but if you want to share the ideas with me too, I would appreciate it lots!
    $endgroup$
    – guillefix
    Feb 12 at 17:44














  • 1




    $begingroup$
    @ workandheat I have provided detailed explanations in the original post if you wanna see them. Unfortunately for the time being I am unable to generalize tyhe solution to dimensions higher than three. My question to you is therefore why are you interested in this very problem? Have you managed to to make any progress? I have some ideas which I can share with you if you wish.
    $endgroup$
    – Przemo
    Jan 25 at 16:43










  • $begingroup$
    @Przemo I am also interested in this problem (the reason being that it directly relates to the probability of a perceptron with binary input/outputs producing a particular function, when weights are Gaussian). I still need to go through your derivation, but if you want to share the ideas with me too, I would appreciate it lots!
    $endgroup$
    – guillefix
    Feb 12 at 17:44








1




1




$begingroup$
@ workandheat I have provided detailed explanations in the original post if you wanna see them. Unfortunately for the time being I am unable to generalize tyhe solution to dimensions higher than three. My question to you is therefore why are you interested in this very problem? Have you managed to to make any progress? I have some ideas which I can share with you if you wish.
$endgroup$
– Przemo
Jan 25 at 16:43




$begingroup$
@ workandheat I have provided detailed explanations in the original post if you wanna see them. Unfortunately for the time being I am unable to generalize tyhe solution to dimensions higher than three. My question to you is therefore why are you interested in this very problem? Have you managed to to make any progress? I have some ideas which I can share with you if you wish.
$endgroup$
– Przemo
Jan 25 at 16:43












$begingroup$
@Przemo I am also interested in this problem (the reason being that it directly relates to the probability of a perceptron with binary input/outputs producing a particular function, when weights are Gaussian). I still need to go through your derivation, but if you want to share the ideas with me too, I would appreciate it lots!
$endgroup$
– guillefix
Feb 12 at 17:44




$begingroup$
@Przemo I am also interested in this problem (the reason being that it directly relates to the probability of a perceptron with binary input/outputs producing a particular function, when weights are Gaussian). I still need to go through your derivation, but if you want to share the ideas with me too, I would appreciate it lots!
$endgroup$
– guillefix
Feb 12 at 17:44










0






active

oldest

votes











Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3048317%2fderivation-of-a-closed-form-solution-for-the-integral-of-a-3d-gaussian-over-the%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Mathematics Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3048317%2fderivation-of-a-closed-form-solution-for-the-integral-of-a-3d-gaussian-over-the%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Ellipse (mathématiques)

Quarter-circle Tiles

Mont Emei