# Half-normal distribution: Distribution of absolute difference between two points sampled from a normal distribution

I have a normally distributed random variable $X$. I sample two points $x_1$ and $x_2$, and I am interested in the absolute difference between these two sampled points: $d=|x_2-x_1|$.

I repeat this $N$ times collecting $N$ pairs of points, giving me absolute differences of $d_1, d_2, ... d_N$.

Is it possible to say anything about the distribution of $d$? Specifically, I would like to construct a confidence interval on $d$, i.e. "with $1-\alpha$ confidence, $d$ falls within this interval."

A sum of two normals is normal. The variance doubles. The mean is going to be zero. The absolute difference is going to be like an absolute value of a normal, i.e. the density function will be something like: $f(d)=\frac{1}{\sqrt{\pi}\sigma}e^{-\frac{d^2}{4\sigma^2}}$

Obviously, the domain is $d\in[0,\infty)$

As @A.Donda pointed out, it's a half-normal distribution, with properly a plugged variance.

You observe X, which means that you can estimate its variance $\hat\sigma^2$ by using usual estimator such as $\hat\sigma^2=\frac{1}{N-1}\sum_{i=1}^n (x_i-\bar x)^2$, where the mean estimator is usual $\bar x =\frac{1}{N}\sum_{i=1}^n x_i$

The variance of d can be easily computed using half-normal distribution properties: $\hat\sigma_X=2\hat\sigma^2(1-\frac{2}{\pi})$

• The distribution of the absolute value of a normally distributed RV is also known as half-normal distribution, which is a (scaled) $\chi_1$ distribution. See en.wikipedia.org/wiki/Half-normal_distribution Jul 24, 2015 at 1:24
• Something is wrong with this answer as $f(d)$ should be nil when $d$ is negative. Maybe you should add something like $1_{d > 0}$ to your answer. Jul 24, 2015 at 1:46
• @ThePawn, the domain is $[0,\infty]$ Jul 24, 2015 at 1:48
• That is why it would be clearer to write $f(d) = \frac{1}{\sqrt{2 \pi}} \exp(-\frac{d^2}{2 \sigma^2})1_{d > 0}$. Jul 24, 2015 at 1:52
• @ThePawn, right, but I hate this indicator function notation which mathematicians seem to love Jul 24, 2015 at 2:00

Comment: Reality check, using simulation, on @Aksakal's (+1) solution. With a million iterations we can expect about 2 or 3 place accuracy for the SD. Let $$\mu = 100, \sigma=2.$$

set.seed(2022)
d = replicate(10^6, abs(diff(rnorm(2, 100, 2))))
sd(d)
 1.703695   # aprx SD of d from simulation
sqrt(8*(1 - 2/pi))
 1.705005   # exact SD of d

hist(d, prob=T, col="skyblue2",
main="Half-normal Dist'n")
curve(exp(-x^2/16)/(2*sqrt(pi)), 