Why \(r\)? Well because we are going to take advantage of the fact that the gaussian distribution is radially symmetric. This means that the probability density only depends on the distance from the centre, not the direction.
So really, \(I^2\) is a 2d gaussian distribution. And if we think of \(r\) as the radius of the circle, we can reformulate \(f(r) = -r^2\) as \(f(x,y) = -(x^2+y^2)\) (using pythagoras). The height of the pdf, \(z\), is then \(e^{-(r^2)} = e^{-(x^2+y^2)}\).
We can thus show that \(I^2\) is simply the square of the integral we are after:
So if we can solve \(\int_{-\infty}^{\infty}{\int_{-\infty}^{\infty}{e^{-(x^2+y^2)}\,dy\,dx}}\), then we just need to find its square root to get the answer to the original question.
Calculating the volume under the 2d gaussian distribution
So let’s visualise this: \(I^2\) is a 2d gaussian distribution along the x and y axes:
How might we go about estimating the volume? What we are looking for are shapes that have the same radial symmetry as the 2d gaussian distribution.
A tube (a hollow cylinder) would be a perfect candidate for this. The visual below shows how we might approximate the volume under the surface using a series of tubes:
Code
def create_tube( radius_outside =0.3, radius_inside =0, height =0.9, intervals =200, ):# points around circumference of the cylinder, using number of intervals specified (e.g. 30) theta_discr = np.linspace(0, 2*np.pi, intervals) # generate values from 0 to 2*pi x, y = np.cos(theta_discr), np.sin(theta_discr) # generate x and y values using sin and cos# generate top and bottom rings for the tube xi, xo = x * radius_inside, x * radius_outside yi, yo = y * radius_inside, y * radius_outside tube_x = [i for l inzip(xi, xi, xo, xo) for i in l] tube_y = [i for l inzip(yi, yi, yo, yo) for i in l] tube_z = np.tile([0,height,height,0],int(len(tube_x)/4))returndict(x=tube_x, y=tube_y, z=tube_z)fig.add_trace( go.Scatter3d(**create_tube(0.3,0.0,0.9), mode='lines', line=dict(color="rgba(57,106,170,0.3)",width=2), name ="Tube 1"), )fig.add_trace( go.Scatter3d(**create_tube(0.6,0.3,0.7), mode='lines', line=dict(color="rgba(218,124,48,0.3)",width=2), name ="Tube 2"), ) fig.add_trace( go.Scatter3d(**create_tube(0.8,0.7,0.5), mode='lines', line=dict(color="rgba(62,150,81,0.5)",width=2), name ="Tube 3"), )fig.add_trace( go.Scatter3d(**create_tube(1.1,0.8,0.3), mode='lines', line=dict(color="rgba(204,37,41,0.3)",width=3), name ="Tube 4"), ) fig.add_trace( go.Scatter3d(**create_tube(1.5,1.1,0.1), mode='lines', line=dict(color="rgba(40,102,200,0.5)",width=3), name ="Tube 5"), ) fig.add_trace( go.Surface( x=xx, y=yy, z=zz, opacity=0.1, colorscale=[(0, 'gray'), (1, 'gray')], showscale=False, contours =dict( x= {"show": True, "size": 0.5}, y= {"show": True, "size": 0.5},# z= {"show": True, "start": 0, "end": 1, "size": 0.025}, ) )) fig.update_layout( showlegend=True, scene =dict( aspectratio=dict(x=1, y=1,z=1), aspectmode="manual" )) fig.show()
Now we can make the estimation more accurate by increasing the number of tubes: thus decreasing the height and thickness of each tube. In fact, we would want an infinite number of tubes, with radii increasing from 0 to infinity, and thus each one having an infinitesimally small width.
A formula for working out the volume of each tube would thus approximate to the following:
We don’t need to worry that the circumference on the outside being slightly larger than the circumference on the inside. Since we are eventually estimating an infinite number of tubes, the thickness of each tube will be infinitesimally small, and thus the difference in circumference will be infinitesimally small too.
Since we want to perform an infinite sum of these tube volumes, we are really just looking for the integral across all tube radii from zero to infinity: