The Gaussian Integral

The Gaussian integral is not only important in mathematics but is also extremely important in studying physics, for example, quantum mechanics, quantum field theory, and statistical mechanics. Let us begin with the most simple Gaussian integral
$$G=\int_{-\infty}^\infty e^{-x^2}dx$$
This is not an easy integral to calculate but it can be done easily if we extend it to an integral in two-dimensions as
\begin{align*} G^2&=\int_{-\infty}^\infty e^{-x^2}dx\int_{-\infty}^\infty e^{-y^2}dy\\ &=\int_{-\infty}^\infty\int_{-\infty}^\infty e^{-(x^2+y^2)}dxdy \end{align*}
Now, in term of the polar coordinates, $x=r\cos\theta$, $y=r\sin\theta$ and the area element is $dA=rdrd\theta$, so $G^2$ can be written as
\begin{align*} G^2&=\int_0^{2\pi}\int_0^\infty re^{-r^2}drd\theta\\ &=\pi \end{align*}
The integral $\int_0^\infty re^{-r^2}dr$ can be easily evaluated using the substitution $u=-r^2$ and its value is $\frac{1}{2}$. Now, we obtain
$$G=\int_{-\infty}^\infty e^{-x^2}dx=\sqrt{\pi}$$
From this you can evaluate more complicated Gaussian integrals using a simple substitution and/or some algebra. For example, $\int_{-\infty}^\infty e^{-ax^2}dx$ for a positive real number $a$ can be evaluated easily by a simple substitution $u=\sqrt{a}x$:
\begin{equation}
\begin{aligned}
\int_{-\infty}^\infty e^{-ax^2}dx&=\frac{1}{\sqrt{a}}\int_{-\infty}^\infty e^{-u^2}du\\
&=\sqrt{\frac{\pi}{a}}
\end{aligned}\label{eq:gaussint}
\end{equation}
If $a=\frac{1}{2}$, then $\int_{-\infty}^\infty e^{-\frac{1}{2}x^2}dx=\sqrt{2\pi}$. Normally one will have to use the integration by parts to calculate $\int_{-\infty}^\infty x^2e^{-x^2}dx$ or $\int_{-\infty}^\infty x^4e^{-x^2}dx$. There is a neat trick of evaluating such integrals by differentiating \eqref{eq:gaussint} with respect to $a$:
$$\frac{d}{da}\int_{-\infty}^\infty e^{-ax^2}dx=-\int_{-\infty}^\infty x^2e^{-ax^2}dx$$
and
$$\frac{d}{da}\sqrt{\frac{\pi}{a}}=-\frac{1}{2a}\sqrt{\frac{\pi}{a}}$$
Thus, we have
\begin{equation}
\label{eq:gaussint2}
\int_{-\infty}^\infty x^2e^{-ax^2}dx=\frac{1}{2a}\sqrt{\frac{\pi}{a}}
\end{equation}
For $a=1$, we obtain
$$\int_{-\infty}^\infty x^2e^{-x^2}dx=\frac{\sqrt{\pi}}{2}$$
Differentiating \eqref{eq:gaussint2} with respect to $a$ leads to
\begin{equation}
\label{eq:gaussint3}
\int_{-\infty}^\infty x^4e^{-ax^2}dx=\frac{3}{4a^2}\sqrt{\frac{\pi}{a}}
\end{equation}
For $a=1$, we obtain
\begin{equation}
\label{eq:gaussint4}
\int_{-\infty}^\infty x^4e^{-x^2}dx=\frac{3}{4}\sqrt{\pi}
\end{equation}
I learned this trick from the book Quantum Field Theory in a Nutshell by Anthony Zee. Another important variation is
\begin{equation}
\label{eq:gaussint5}
\int_{-\infty}^\infty e^{-ax^2+bx}dx
\end{equation}
This integral can be evaluated from \eqref{eq:gaussint} with a little bit of algebra. First, by completing the square, we write
\begin{align*} -ax^2+bx&=-a\left(x^2-\frac{b}{a}x\right)\\ &=-a\left(x^2-\frac{b}{a}x+\left(-\frac{b}{2a}\right)^2-\left(-\frac{b}{2a}\right)^2\right)\\ &=-a\left(x-\frac{b}{2a}\right)^2+\frac{b^2}{4a} \end{align*}
Now, \eqref{eq:gaussint5} is evaluated as
\begin{align*} \int_{-\infty}^\infty e^{-ax^2+bx}dx&=\int_{-\infty}^\infty e^{-a\left(x-\frac{b}{2a}\right)^2+\frac{b^2}{4a}}dx\\ &=e^{\frac{b^2}{4a}}\int_{-\infty}^\infty e^{-a\left(x-\frac{b}{2a}\right)^2}dx\\ &=e^{\frac{b^2}{4a}}\int_{-\infty}^\infty e^{-au^2}du\ \left[u=x-\frac{b}{2a}\right]\\ &=e^{\frac{b^2}{4a}}\sqrt{\frac{\pi}{a}} \end{align*}

This time let us try to calculate
\begin{equation}
\label{eq:gaussint6}
\int_{-\infty}^\infty\int_{-\infty}^\infty\int_{-\infty}^\infty (x^2+y^2+z^2)e^{-(x^2+y^2+z^2)}dxdydz
\end{equation}
You stumble upon this type of integral, for example, in a derivation of the Maxwell-Boltzmann statistics in the form of
$$\int d^3p\frac{p^2}{2m}\exp\left(-\beta\frac{p^2}{2m}\right)$$
The integral \eqref{eq:gaussint6} can be easily evaluated using the spherical coordinates:
\begin{align*} x&=r\sin\theta\cos\phi\\ y&=r\sin\theta\sin\phi\\ z&=r\cos\theta\ \end{align*}
where
$$0\leq r<\infty,\ 0\leq\theta\leq\pi,\ 0\leq\theta\leq 2\pi$$
The volume element in the spherical coordinates is $dV=r^2dr\sin\theta d\theta d\phi$, so
\begin{align*} \int_{-\infty}^\infty\int_{-\infty}^\infty\int_{-\infty}^\infty (x^2+y^2+z^2)e^{-(x^2+y^2+z^2)}dxdydz&=\int_0^{2\pi}\int_0^\pi\int_0^\infty r^4e^{-r^2}dr\sin\theta d\theta d\phi\\&=\frac{3}{2}\pi\sqrt{\pi} \end{align*}
We obtain
$$\int_0^\infty r^4e^{-r^2}dr=\frac{3}{8}\sqrt{\pi}$$
using \eqref{eq:gaussint4}.

Evaluating $\int\frac{dx}{a+b\cos x}$ where $b^2>a^2$

One of my Ph.D. students, Victor Zankoni is reading the paper Relativistically corrected Schrödinger equation with Coulomb interaction by J. L. Friar and E. L. Tomusiak, Physical Review C, Volume 29, Number 4, 1537. Following their calculations, he stumbled upon an integral of the form
$$\int\frac{dx}{a+b\cos x}$$
where $b^2>a^2$. Thinking it may not be easy to calculate, I suggested him to look up the well-known book Tables of Integrals, Series, and Products by Gradshteyn and Ryzhik. He said he couldn’t find a relevant formula (actually there is and he somehow missed it) and instead he decided to calculate it. He used a clever substitution and it worked beautifully, so here I am introducing his calculation. First note the identity
$$\cos x=\frac{1-\tan^2\left(\frac{x}{2}\right)}{1+\tan^2\left(\frac{x}{2}\right)}$$
Here, I assume $a>0$ and $b>0$ but similar calculations can be carried out for other cases as well. With the above substitution, we have
\begin{align*} \int\frac{dx}{a+b\cos x}&=\int\frac{\sec^2\left(\frac{x}{2}\right)}{b+a-(b-a)\tan^2\left(\frac{x}{2}\right)}dx\\ &=\frac{2}{b-a}\int\frac{du}{\left(\sqrt{\frac{b+a}{b-a}}\right)^2-u^2}\\ &=\frac{1}{\sqrt{b^2-a^2}}\left[\int\frac{du}{\sqrt{\frac{b+a}{b-a}}+u}+\int\frac{du}{\sqrt{\frac{b+a}{b-a}}-u}\right]\\ &=\frac{1}{\sqrt{b^2-a^2}}\ln\frac{u+\sqrt{\frac{b+a}{b-a}}}{u-\sqrt{\frac{b+a}{b-a}}}\\ &=\frac{1}{\sqrt{b^2-a^2}}\ln\frac{\sqrt{b^2-a^2}u+a+b}{\sqrt{b^2-a^2}u-(a+b)}\\ &=\frac{1}{\sqrt{b^2-a^2}}\ln\frac{\sqrt{b^2-a^2}\tan\left(\frac{x}{2}\right)+a+b}{\sqrt{b^2-a^2}\tan\left(\frac{x}{2}\right)-(a+b)} \end{align*}
The last expression coincides with 2.553 #3 of Gradshteyn and Ryzhik, 8th Edition on page 172. Gradshteyn and Ryzhik 7th Edition does not contain this expression but one can find a supposedly equivalent expression in 2.553 #3 of the 7th Edition but unfortunately, it is stated incorrectly. It has been corrected in the 8th Edition and is listed as 2.553 #4:
$$\int\frac{dx}{a+b\cos x}=\frac{2}{\sqrt{b^2-a^2}}\ln\left|\frac{(b-a)\tan\left(\frac{x}{2}\right)+\sqrt{b^2-a^2}}{(b-a)\tan\left(\frac{x}{2}\right)-\sqrt{b^2-a^2}}\right|\ [b^2>a^2]$$
There is another incorrect formula that caught my eyes:
\begin{align*} \int\frac{dx}{a+b\cos x}&=\frac{2}{\sqrt{b^2-a^2}}\mathrm{arctanh}\left(\frac{(a-b)\tan\left(\frac{x}{2}\right)}{\sqrt{b^2-a^2}}\right)\ \left[b^2>a^2,\ \left|(b-a)\tan\left(\frac{x}{2}\right)\right|<\sqrt{b^2-a^2}\right]\\ &=\frac{2}{\sqrt{b^2-a^2}}\mathrm{arccoth}\left(\frac{(a-b)\tan\left(\frac{x}{2}\right)}{\sqrt{b^2-a^2}}\right)\ \left[b^2>a^2,\ \left|(b-a)\tan\left(\frac{x}{2}\right)\right|>\sqrt{b^2-a^2}\right] \end{align*}
in both 7th Edition and the 8th Edition. It should be corrected to
\begin{align*} \int\frac{dx}{a+b\cos x}&=\frac{2}{\sqrt{b^2-a^2}}\mathrm{arctanh}\left(\frac{(b-a)\tan\left(\frac{x}{2}\right)}{\sqrt{b^2-a^2}}\right)\ \left[b^2>a^2,\ \left|(b-a)\tan\left(\frac{x}{2}\right)\right|<\sqrt{b^2-a^2}\right]\\ &=\frac{2}{\sqrt{b^2-a^2}}\mathrm{arccoth}\left(\frac{(b-a)\tan\left(\frac{x}{2}\right)}{\sqrt{b^2-a^2}}\right)\ \left[b^2>a^2,\ \left|(b-a)\tan\left(\frac{x}{2}\right)\right|>\sqrt{b^2-a^2}\right] \end{align*}
I don’t use Gradshteyn and Ryzhik’s book much but I have heard that it contains numerous typos and mistakes. It appears to be true. So, please use it with caution when you do.

The Binomial Distribution

For a fair coin, if we toss it a very large number of times, nearly half the time we will get heads and half the time we will get tails. So, we can say the probability of getting heads is equal to the probability of getting tails as $\frac{1}{2}$.

Now consider the simultaneous tossing of $N$ coins. For $N=2$, there are four possible outcomes: $HH$, $HT$, $TH$, and $TT$. The probabilities of getting 2 heads, 1 head, and no head are, respectively, $\frac{1}{4}$, $\frac{2}{4}=\frac{1}{2}$, $\frac{1}{4}$. The number of ways we can get $n$ heads (consequently $N-n$ tails) is
$$\frac{N!}{n!(N-n)!}$$
The probability $p$ of getting $n$ heads is then
\begin{equation}
\label{eq:binomial}
p=\frac{N!}{n!(N-n)!2^N}
\end{equation}
Let us consider
$$\ln p=\ln\frac{N!}{n!(N-n)!2^N}=\ln N!-\ln n!-\ln(N-n)!-N\ln 2$$
Using the Stirling’s formula
$$\ln N!\approx N\ln N-N$$
we obtain
$$\ln p\approx -N\left[\frac{n}{N}\ln\frac{n}{N}+\left(1-\frac{n}{N}\right)\ln\left(1-\frac{n}{N}\right)+\ln 2\right]$$
For very large $N$, $x=\frac{n}{N}$ can be considered to be continuous.
$$\ln p\approx -N[x\ln x+(1-x)\ln(1-x)]$$
$\ln p$ has only one critical point at $x=\frac{1}{2}$ and the second derivative of $\ln p$ at $x=\frac{1}{2}$ is negative. So $\ln p$ (and consequently $p$) assumes a maximum at $x=\frac{1}{2}$. Expanding $\ln p$ at $x=\frac{1}{2}$, we have
$$\ln p\approx -2N\left(x-\frac{1}{2}\right)^2$$
or
$$p\approx\exp\left[-2N\left(x-\frac{1}{2}\right)^2\right]$$
As seen clearly, the standard deviation from $x=\frac{1}{2}$ is $\frac{1}{2\sqrt{N}}$.

$p\approx\exp[-2N(x-\frac{1}{2})^2]$ with $N=11$.

Thus far, we have considered equal probabilities. Suppose that we have a coin with a probability of $q$, $0<q<1$ for heads. Then the probability of getting $n$ heads when $N$ coins are tossed is
\begin{equation}
\label{eq:binomial2}
\frac{N!}{n!(N-n)!}q^n(1-q)^{N-n}
\end{equation}
$q=\frac{1}{2}$ reduces \eqref{eq:binomial2} to \eqref{eq:binomial}. Note that the probability in $\eqref{eq:binomial}$ peaks at $x=q$ and the standard deviation from $x=q$ is the same.

We now consider events with more than two outcomes. For example, rolling a dice has six possible outcomes.
Suppose that we want to distribute $N$ particles into $K$ boxes in such a way that $n_i$ particles go into box $i$. How many ways are there to do this? There are $\frac{N!}{n_1!(N-n_1)!}$ ways to choose $n_1$ particles out of $N$ particles. Then there are $\frac{(N-n_1)!}{n_2!(N-n_1-n_2)!}$ ways to choose $n_2$ particles out of remaining $N-n_1$ particles, and so on and so forth. Hence, the number of ways to distribute $n_1$ particles in box 1, $n_2$ particles in box 2, …, $n_K$ particles in box $K$ is
\begin{align*} \frac{N!}{n_1!(N-n_1)!}\frac{(N-n_1)!}{n_2!(N-n_1-n_2)!}&\frac{(N-n_1-n_2)!}{n_3!(N-n_1-n_2-n_3)!}\cdots\\ &\frac{(N-n_1-n_2-\cdots-n_{K-1})!}{n_K!}\\ &=\frac{N!}{n_1!n_2!\cdots n_K!}\\ &=N!\Pi_{i=1}^K\frac{1}{n_i!}, \end{align*}
$\sum_{i=1}^Kn_i=N$.

No $\sqrt{\mathrm{NOT}}$ in PT-Symmetric Quantum Mechanics

In PT-symmetric quantum mechanics, the inner product is given by
\begin{equation}
\label{eq:pt-product}
\langle v_1|P|v_2\rangle
\end{equation}
where $P=\begin{bmatrix}
0 & 1\\
1 & 0
\end{bmatrix}$.
A PT-symmetric operator $H$ is a $2\times 2$ symmetric matrix that satisfies
$$\langle Hv_1|P|v_2\rangle=\langle v_1|P|Hv_2\rangle$$
which is equivalent to
$$\bar HP=PH$$
So, PT-symmetric operators are self-adjoint operators with respect to the inner product \eqref{eq:pt-product}. PT-symmetric operators take the form
$$\begin{bmatrix}
a & b\\
b & \bar a
\end{bmatrix}$$
In PT-symmetric quantum mechanics, $\mathrm{NOT}$ gate is given by
$$\mathrm{NOT}=\begin{bmatrix}
1 & 0\\
0 &-1
\end{bmatrix}$$
The reason for this is that in PT-symmetric quantum mechanics the qubits are
$$|0\rangle=\frac{1}{\sqrt{2}}\begin{bmatrix}
1\\
1
\end{bmatrix},\ |1\rangle=\frac{1}{\sqrt{2}}\begin{bmatrix}
1\\
-1
\end{bmatrix}$$
The eigenvectors of $\mathrm{NOT}$ corresponding to the eigenvalues $\pm 1$ are, respectively, $\begin{bmatrix}
1\\
0
\end{bmatrix}$ and $\begin{bmatrix}
0\\
1
\end{bmatrix}$ and their norms are zero with respect to the inner product \eqref{eq:pt-product}. This means that the spectral decomposition of $\mathrm{NOT}$ in terms of its eigenvectors does not exist in PT-symmetric quantum mechanics. This also hints us that $\sqrt{\mathrm{NOT}}$ does not likely exist. In PT-symmetric quantum mechanics, an operator $U$ is called $P$-unitary if $U^\dagger PU=P$ and $P$-antiunitary if $U^\dagger PU=-P$.

For the same physical reason, in PT-symmetric quantum mechanics, gates are required to be $P$-unitary or $P$-antiunitary. $\mathrm{NOT}$ is $P$-antiunitary. It can be easily seen that $\sqrt{\mathrm{NOT}}$ does not exist. If $\sqrt{\mathrm{NOT}}$ exists, then it is either $P$-unitary or $P$-antiunitary. If $\sqrt{\mathrm{NOT}}$ is $P$-unitary, then
\begin{align*} \mathrm{NOT}^\dagger P\mathrm{NOT}&=\sqrt{\mathrm{NOT}}^\dagger(\sqrt{\mathrm{NOT}}^\dagger P\sqrt{\mathrm{NOT}})\sqrt{\mathrm{NOT}}\\ &=\sqrt{\mathrm{NOT}}^\dagger P\sqrt{\mathrm{NOT}}\\ &=P \end{align*}
This contradicts to the fact that $\mathrm{NOT}$ is $P$-antiunitary. If $\sqrt{\mathrm{NOT}}$ is $P$-antiunitary, then
\begin{align*} \mathrm{NOT}^\dagger P\mathrm{NOT}&=\sqrt{\mathrm{NOT}}^\dagger(\sqrt{\mathrm{NOT}}^\dagger P\sqrt{\mathrm{NOT}})\sqrt{\mathrm{NOT}}\\ &=-\sqrt{\mathrm{NOT}}^\dagger P\sqrt{\mathrm{NOT}}\\ &=P \end{align*}
Again, this is a contradiction. Therefore, $\sqrt{\mathrm{NOT}}$ does not exist. As seen here, the standard hermitian quantum mechanics admits $\sqrt{\mathrm{NOT}}$ gate. This implies that the standard hermitian quantum mechanics and PT-symmetric quantum mechanics cannot be consistent with each other. While no one has yet come up with a physical implementation of $\sqrt{\mathrm{NOT}}$ gate, it is interesting to see that the physical viability of a quantum theory hangs on the physical realizability of a quantum gate.

Square Roots of Operators II

The determinant (and also trace) of a nilpotent matrix is always zero, so a nilpotent matrix cannot be invertible. However, if $N$ is nilpotent of index $m$, then $I+N$ and $I-N$ are invertible and the inverses are given by
\begin{align*} (I+N)^{-1}&=\sum_{k=0}^{m-1}(-N)^k=I-N+N^2-N^3+\cdots+(-N)^{m-1}\\ (I-N)^{-1}&=\sum_{k=0}^{m-1}N^k=I+N+N^2+N^3+\cdots+N^{m-1} \end{align*}
We have shown here that invertible operators have square roots. By the same token, we see that the square roots of $(I+N)^{-1}$ and $(I-N)^{-1}$ exist. But how do we find them? Let us denote them by $(I+N)^{-\frac{1}{2}}$ and $(I-N)^{-\frac{1}{2}}$, respectively. Then by the same manner we proved the existence of $\sqrt{N+1}$ here, we obtain
\begin{align*} (I+N)^{-\frac{1}{2}}&=I-\frac{1}{2}N-\frac{3}{8}N^2-\frac{11}{16}N^3+\cdots\\ (I-N)^{-\frac{1}{2}}&=I+\frac{1}{2}N+\frac{3}{8}N^2+\frac{5}{16}N^3+\cdots \end{align*}