4
$\begingroup$

Given two random variables X and Y with some distribution D, is it possible to choose a D such that Z = X - Y is uniform? Is there a standard distribution D that would satisfy this?

$\endgroup$
  • 2
    $\begingroup$ @ReinstateMonica nice duplicate find! Though it's only a duplicate if the OP is looking for IID random variables (which I found unclear from their question, so I answered it both ways). $\endgroup$ – josliber Feb 23 at 3:32
6
$\begingroup$

Consider the following example:

$$ X\sim\text{Unif}(0, 1) \\ Y = 1-X $$

$X$ and $Y$ are identically distributed as the standard uniform distribution, and $X-Y = 2X-1$, so $X-Y\sim\text{Unif}(-1, 1)$.

Note that this example relied on $X$ and $Y$ being dependent, identically distributed random variables. It is impossible for two independent, identically distributed random variables $X$ and $Y$ to have a difference that follows a uniform distribution. Clearly for $X-Y$ to be uniform we would need $X$ and $Y$ to be bounded, continuous random variables (assume bounds $\underline{x}$ and $\overline{x}$). However, since $X$ and $Y$ are continuous, their difference will have density 0 at its bounds $\overline{x}-\underline{x}$ and $\underline{x}-\overline{x}$, leading us to conclude that $X-Y$ does not follow a uniform distribution.

$\endgroup$
  • 3
    $\begingroup$ What if $X \sim \operatorname{Unif}(0,1)$ and $Y$ is the constant 0? They are independent, and their difference is uniformly distributed. $\endgroup$ – Federico Poloni Feb 23 at 10:47
  • $\begingroup$ @FedericoPoloni Excellent catch! I've removed the claims about independent, not identically distributed RVs. $\endgroup$ – josliber Feb 23 at 13:34
3
$\begingroup$

Independent and identically distributed. If you ask for IID $X$ and $Y$, as others have noted this is not possible. See the answers to this question.

If you are happy to drop either independence between $X$ and $Y$ or them having the same distribution, then there's hope.

Same distribution. If you allow for dependent but identically distributed variables, then you can build the joint distribution of $X$ and $Y$ so that the marginal distributions $p_Y(y)=\int p_{X,Y}(x,y)\,dx$ and $p_X(x)=\int p_{X,Y}(x,y)\,dy$ are the same and the integral over diagonal lines $p_Z(z)=\int p_{X,Y}(y+z,y)\,dy$ is constant in an interval. One such example is: $$p_{X,Y}(x,y)=\begin{cases}\frac12 & \text{if $|x|+|y|<1$}\\0 & \text{otherwise}\end{cases}.$$ The marginal distribution of $X$ is $p_X(x) = 1 - |x|$ for $x\in[-1,1]$, which is the same as that of $Y$, while $Z \sim \mathcal{U}(-1,1)$. A simple way to build such distributions for $X$ and $Y$ is to choose $Z \sim \mathcal{U}(-a,a)$ and $W$ distributed according to a distribution $D'$, then $X=W+Z/2$ and $Y=W-Z/2$ have the chosen properties (their difference is uniform and they are distributed according to a common distribution $D$ whose pdf is the convolution of the pdf of $D'$ and a rect). For example for Gaussian $W$, we could obtain something like the following joint and marginal densities:

joint and marginal pdf

Independent. If $X$ and $Y$ are independent, then $Z$'s pdf must be the convolution of that of $X$ and $-Y$. As noted by josliber, $X$ and $Y$ cannot be both continuous variables otherwise the convolution of their pdfs would be continuous and would need to approach $0$ at the boundaries of the support of $Z$. This limit can be overcome if the pdf of either variable is not a function but a distribution (in the mathematical sense). For example the convolution of a rect (pdf of a uniform distribution) and an appropriately chosen train of Dirac's deltas (pdf of a discrete variable) can be a rect. One such example is when $Y \sim \mathcal{U}(-a,a)$ and $X = b + 2\,a\,N$ with $N \sim \mathcal{U}\{c,d\}$ (discrete uniform distribution).

$\endgroup$
  • 2
    $\begingroup$ +1 for the Independent section, which adds something new $\endgroup$ – Henry Feb 23 at 13:41

Not the answer you're looking for? Browse other questions tagged or ask your own question.