# Gaussian integral

26-Jul-2023

In the previous post Deriving probability distribution from entropy, I mentioned about Gaussian integral and said it deserves its own post. So here it is, and hopefully a short article as well.

# Gaussian integral as an introductary “integral” trick

The integral is quite famous for being an example of an expression that doesn’t have elementary indefinite form, but it does converge to a certain value in the definite form. Moreover, the result involves $\pi$ which is usually related with a circle.

The integral (E1) doesn’t have elementary indefinite expression. But we can still calculate it using circular symmetry. The exact proof needs formal justification, but the idea is as follow.

Let the integral (E1) has convergent value, and we call it $L$.

Note that, if we change the variable from $x$ to $y$, the value should be the same. However, if both $x$ and $y$ is a perpendicular axis, then by Pythagorean Theorem, $r^2=x^2+y^2$ with $r$ being the hypotenuse.

The trick is to realize that $L^2=L_x \, L_y$.

Step (2) to step (3) is justified because we kind of assume that $L$ is converged, so we can swap and mix the integral, just like a sum. This is known as Fubini’s Theorem.

Step (3) to (4) is just circle identity we mentioned earlier.

Now this equation becomes a double integral. In other words, it measures an area or volume with the function $e^{-r^2}$ as its density. The integral with respect to Cartesian coordinate $dx\,dy$ differentials can be integrated the same way using a polar coordinate with $r\,dr\,d\theta$ differentials. Technically, the conversion is done using Jacobian matrix. But we can accept it as fact for now.

Step (5) to (6) is due the differentials changes. So the integration boundaries also changes.

Step (6) to (7) is applying Fubini’s Theorem again, since $dr$ and $d\theta$ is independent. We also substitute $s=r^2$.

The rests just follows.

We now understand that there is a circle symmetry at works, which is why the constant $\pi$ appears.

# Interpreting Gaussian integral as flux

An alternative way of interpreting Gaussian integral can be perceived using Gauss’s Law.

If you haven’t already know, an alternative of formulation for Coulomb’s Law and Newton’s Universal Gravitation is by using Gauss Law with spherical symmetry for constant electric flux. In the original derivation, it was known from observation/experimental results that the magnitude of electric field from a point charge in vacuum is a constant $E$. If we take the flux along a spherical area $\mathrm{d}\mathbf{A}$, we got:

If we observe above equation, we know that $E(r)$ is a function of $r$, and it measures the strength of the electric field. The above formulation has an equivalent expression using divergence theorem.

Where $\rho$ is the density of the charge.

Now if we use some kind of analogy, given this gaussian integral:

We can imagine that it is equivalent of a surface integral for a flat circle $S$, with $E$ is a vector field along the $z$ axis direction, so that it was integrated with parameter $dx\,dy$. So $E=e^{-r^2}$.

Since a total flux of zero means there are no charge inside, we can imagine that if the boundary contains charge inside, then we can choose a cylindrical shape. So we have two circle surface, and one surface wraps around the cylinder. Suppose that field $\mathbf{E}$ is completely in the direction of $z$ axis, then the flux around the cylinder (along the $r$ direction) is zero. The total flux is then:

What is interesting with above equation is that the total flux is capped at $2 \pi$ when $s$ is very large. The total flux is proportional with the charge quantity contained inside the surface.

If we follow along the divergence theorem, then equivalently we can construct the $\mathbf{E}$ field vector in cylindrical coordinate.

Interestingly, the divergence becomes zero this way because there are no $z$ parameter in $\hat{z}$ direction. Meanwhile if the total flux is non-zero then the divergence must be proportional to the density of the volume.

If we inspect the flux equation in more detail, in order for the flux to not be zero then the sign of the vector must change. Thus, if we “patched” the vector function $\mathbf{E}$, then it was supposed to be like this:

Here, $sgn (z)$ is a function that returns the sign of variable z. It will be -1 if $z \lt 0$, 1 if $z \gt 0$, and 0 if $z=0$.

We have an interesting connection that the divergence now non-zero and involves the derivative of the sign function $sgn(z)$.

If we treat $\varepsilon_0$ as just a unit constant (to make sure the unit dimension is correct in electromagnetic theory), then the general connection directly follows from divergence theorem that the density is the amount of charge contained in the cylindrical volume we decided earlier.

Now if we consider a step function $sgn(z)$, we can intuitively imagine that the value of $sgn'(z)$ is zero everywhere, except around 0. So, let’s just suppose we are inspecting the charge density around $z=0$ only. The density of the charge is proportional to the derivative.

The volume element $dV$ for a cylindrical coordinate is $dV=2\pi r\,dr \,dz$. Substituting this for density:

Combining both results confirms that $sgn'(z) = 2$ for some region near $z=0$.

But the question then remains on how to formally express this region?

Why there is such a strange connection from an entirely different perspectives? If we consider $e^{-r^2}$ as field vector that penetrates an area, then calculate it using gaussian integral, we got a certain factor $2 \pi$. This factor, coincidentally be the same factor needed in order for us to have the correct divergence, by the divergence theorem.

In other words, the factor $\pi$ appears because on Divergence theorem we observed shows circular symmetry. Then since it is proportional to the surface integral (power of two), then the gaussian integral along one single axis/dimension is $\sqrt\pi$.

Isn’t it fascinating? If the distribution $\rho$ has a factor of $e^{-r^2}$, then total flux is $2\pi$, implying that the total amount of charge contained inside the volume when $r$ goes to infinity, is $2\pi$. It doesn’t care about the unit.

If you are interested, you can also try using the same distribution, but apply it in all 3 axis. To calculate the flux, either use spherical or cylindrical coordinates, the result has to be the same.