# How to find the pdf of the minimum of absolute differences of Uniform distributions.

Let $$X_1$$, $$X_2$$ and $$X_3$$ be independent random variables that are uniformly distributed over $$(0;b), b>0$$. What is the probability density function of $$z=\min(Y_1,Y_2)$$, where $$Y_1=|X_1-X_2|$$ and $$Y_2=|X_1-X_3|$$.

Problems such as these can be both tedious and difficult to do by hand, but can be solved in just one or two lines with the help of automated tools. For this example, the joint pdf of $$(X_1,X_2,X_3)$$ is say $$f(x_1,x_2,x_3)$$:

Problem: find the pdf of $$Z = min[ |X_1-X_2|, |X_1-X_3|]$$

Solution: First, derive the cdf of $$Z$$, namely $$P(Z:

where I am using the Prob function from the mathStatica add-on to Mathematica to do the tedious work for me (I am one of the developers of the former).

The pdf of $$Z$$ is, of course, just the derivative of the cdf wrt $$z$$, i.e.:

$$\begin{cases}\frac{2 (b-z)^2}{b^3} & \frac{b}{2} < z < b \\ \frac{2 \left(2 b^2-6 b z+5 z^2\right)}{b^3} & 0 < z \leq \frac{b}{2} \\ 0& otherwise \end{cases}$$ All done.

Here is a plot of the solution (the pdf of $$Z$$, say when $$b = 4$$) plotted in red $$---$$ I have also overlaid a Monte Carlo check (in blue), just to make sure no mistakes have crept in: