Hellinger distance between normal distributions (source code)

= Hellinger distance between normal distributions
{c}
{title2=$d_{\mathrm{Hell}}(\mathcal N(\theta_1,\sigma_1^2),\mathcal N(\theta_2,\sigma_2^2))$}

With the convention $d_{\mathrm{Hell}}^2=\frac12\int(\sqrt p-\sqrt q)^2$, the <Hellinger distance> between two <normal distributions> with $\sigma_1,\sigma_2>0$ is
$$
d_{\mathrm{Hell}}^2=1-\sqrt{\frac{2\sigma_1\sigma_2}{\sigma_1^2+\sigma_2^2}}
\exp\left[-\frac{(\theta_1-\theta_2)^2}{4(\sigma_1^2+\sigma_2^2)}\right].
$$
To prove it, integrate the geometric mean of their <probability density functions>. <Completing the square> makes that geometric mean the density of a <normal distribution> times the displayed prefactor and exponential. For example, writing $S=\sigma_1^2+\sigma_2^2$, that <normal distribution> has mean $(\theta_1\sigma_2^2+\theta_2\sigma_1^2)/S$ and <variance> $2\sigma_1^2\sigma_2^2/S$. The identity $d_{\mathrm{Hell}}^2=1-\int\sqrt{pq}$ then proves the formula.

For equal unit <variances>, this becomes $1-e^{-(\theta_1-\theta_2)^2/8}$. More generally, put $B=\sqrt{2\sigma_1\sigma_2/S}\leq1$ and $x=(\theta_1-\theta_2)^2/(4S)$. Then $1-Be^{-x}=(1-B)+B(1-e^{-x})$, $1-B=(\sigma_1-\sigma_2)^2/[S(1+B)]$, and $1-e^{-x}\leq x$, proving
$$
d_{\mathrm{Hell}}^2\leq\frac{(\sigma_1-\sigma_2)^2+(\theta_1-\theta_2)^2}{\sigma_1^2+\sigma_2^2}.
$$