What is the a posteriori ditributions of Gaussian prior variables under distance constraints? I have two real random variables with Gaussian priors, $x_1 \sim \mathcal{N}(\bar{x}_1,v_1)$ and $x_2 \sim \mathcal{N}(\bar{x}_2,v_2)$. Now I have an observation that the distance between $x_1$ and $x_2$ is $D$, i.e.,
$$(x_1-x_2)^2=D^2.$$
My quesition is: what is the a posteriori distributions of $x_1$ and $x_2$ under this distance constraint?
 A: You now know that $x_2=x_1\pm D$. If you knew which sign it is, the posterior distribution of $x_1$ would be proportional to
$$
\exp\left(-\frac12\frac{\left(x_1-\bar x_1\right)^2}{v_1}\right)\cdot\exp\left(-\frac12\frac{\left(x_1\pm D-\bar x_2\right)^2}{v_2}\right)
\\
\propto\exp\left(-\frac12\frac{\left(x_1-\bar x_\pm\right)^2}v\right)
$$
with $\frac1v=\frac1{v_1}+\frac1{v_2}$ and $\bar x_\pm=v\left(\frac{\bar x_1}{v_1}+\frac{\bar x_2\mp D}{v_2}\right)$, so you’d have $x_1\sim\mathcal N(v,\bar x_\pm)$. Since you don’t know which sign it is, you get a mixture of these two normal distributions, and the ratio of the coefficients is the ratio of the constant factors dropped above,
$$
\exp\left(-\frac12\frac{\bar x_1^2}{v_1}\right)\exp\left(-\frac12\frac{\left(\bar x_2\mp D\right)^2}{v_2}\right)\exp\left(\frac12\frac{\bar x_\pm^2}v\right)\;.
$$
The terms constant and quadratic in $D$ cancel in the ratio, and what remains is the ratio of the terms linear in $D$, which is just the square of the value with the positive sign:
$$
\exp\left(2\frac{\bar x_2D}{v_2}\right)\exp\left(-2v\left(\frac{\bar x_1}{v_1}+\frac{\bar x_2}{v_2}\right)\frac D{v_2}\right)
=\exp\left(2D\left(\bar x_2-\bar x_1\right)\right)\;.
$$
That makes sense: If the means are equal, you get a mixture with equal coefficients $\frac12$, and if the means differ, the component that has the “right” sign for the difference has greater weight.
