# Given uniform distributions of X and Y and the mean 0 and standard deviation 1 for both, what’s the probability of 2X>Y [closed]

I saw this question online as a prep question for stats/data science interviews. I’m familiar with the concept of uniform distributions and joint probability distributions, but I wasn’t able to make sense of this question, I’m wondering if I am interpreting it incorrectly or if this is a concept I’m unfamiliar with. If anyone could help explain what the question is asking it would be very appreciated!

• A uniform distribution doesn't have mean and SD parameters? Are you sure about this? May 15, 2020 at 5:11
• Mean and standard deviations are identifying the range of the Uniform distribution. May 15, 2020 at 5:58
• "Uniform" is a red herring. It suffices that both means be zero, both distributions be symmetric, both variables be independent, and for there to be no chance that $2X=Y$ Under these assumptions--which obviously hold in the continuous Uniform case--the distribution of $2X-Y$ is symmetric with mean zero, immediately giving the answer.
– whuber
May 15, 2020 at 13:32

As to what the question is asking: you have two random variables, $$X$$ and $$Y$$. Both are uniformly distributed in some interval, each with mean 0 and standard deviation 1. (From this information, we can calculate the interval in which $$X$$ and $$Y$$ actually live.)

We thus draw $$X$$ and $$Y$$ randomly and independently from their uniform distribution. Now, it might happen that $$2X>Y$$, or it might not - this event is again random.

And the question asks how high the probability for this event is.

One often useful first step is to simulate, just to get an idea of the likely result. As per Ben's answer, $$X, Y \sim U[-a,a]$$ with $$a=\sqrt{3}$$ (though it doesn't matter at all, see below). Here is a simulation in R:

nn <- 1e5
aa <- sqrt(3)
xx <- runif(nn,-aa,aa)
yy <- runif(nn,-aa,aa)
sum(2*xx>yy)/nn
# [1] 0.49964


This looks very much like $$\frac{1}{2}$$ might be a possible answer for that probability.

Here is a possible graphical approach. $$X$$ and $$Y$$ are uniformly distributed in the square with corners at $$(-a,-a)$$, $$(a,-a)$$, $$(a,a)$$ and $$(-a,a)$$.

Draw a line through that square, with equation $$y=2x$$. The points below that line are exactly the ones that satisfy your condition $$2X>Y$$. Thus, the probability we are looking for is the proportion of the square's area below the line.

And since the line exactly bisects your square, we see that the probability is $$\frac{1}{2}$$.

Finally, since it doesn't matter at all what numbers we put on the axes as long as everything is centered around zero, we see that it doesn't matter what the standard deviations are. Or even what the constant is in $$cX>Y$$. And it even works for other bivariate distributions whose density is point symmetric around zero (like a bivariate normal distribution with equal marginal variances and possibly non-zero covariance, where the underlying density would not be a square but an infinite elliptical cloud). The probability always comes out to $$\frac{1}{2}$$.

R code:

aa <- sqrt(3)
cc <- 2

plot(c(-aa,aa),c(-aa,aa),type="n",xlab="X",ylab="Y",las=1)
polygon(c(-aa,aa,aa,-aa),c(-aa,-aa,aa,aa),col="grey",border=NA)
abline(h=0,lty=2)
abline(v=0,lty=2)
abline(a=0,b=cc,col="red",lwd=2)
polygon(c(-aa/cc,aa,aa,aa/cc),c(-aa,-aa,aa,aa),col="red",density=20,border=NA)

• A lovely illustration of the intuition of the result (+1).
– Ben
May 15, 2020 at 8:52

This question actually does not require specification of the standard deviation, since the answer is the same for any IID uniform random variables with zero mean. Moreover, the result holds for any event based on cutting the domain into two equal parts via a straight line segment through the origin (hat tip to Stephen Kolassa for pointing this out). Assuming you are talking about the continuous uniform distribution, in order to have a mean of zero they should have bounds:

$$X,Y \sim \text{IID U}(-a, a).$$

(In the case where they have unit variance you can show that $$a=\sqrt{3}$$. This result is easily obtained by using the formulae for the mean and variance of the continuous uniform distribution and solving the two equations in two unknowns.) So, for any value $$c>0$$ you then have:

\begin{aligned} \mathbb{P}(cX > Y) &= \mathbb{P}(X > Y/c) \\[12pt] &= \int \mathbb{P}(X > y/c) \cdot f_Y(y) \ dy \\[6pt] &= \int \Bigg( \int \mathbb{I}(x > y/c) f_X(x) \ dx \Bigg) f_Y(y) \ dy \\[6pt] &= \int \limits_{-a}^{a} \Bigg( \ \int \limits_{y/c}^{a} f_X(x) \ dx \Bigg) f_Y(y) \ dy \\[6pt] &= \frac{1}{4 a^2} \int \limits_{-a}^{a} \int \limits_{y/c}^{a} \ dx \ dy \\[6pt] &= \frac{1}{4 a^2} \int \limits_{-a}^{a} \Big( a - \frac{y}{c} \Big) \ dy \\[6pt] &= \frac{1}{4 a^2} \Bigg[ a y - \frac{y^2}{2c} \Bigg]_{-a}^{a} \\[6pt] &= \frac{1}{4 a^2} \Bigg[ \bigg( a^2 - \frac{a^2}{2c} \bigg) - \bigg( -a^2 - \frac{a^2}{2c} \bigg) \Bigg] \\[6pt] &= \frac{1}{4 a^2} \Bigg[ 2 a^2 \Bigg] \\[6pt] &= \frac{1}{2}. \\[6pt] \end{aligned}

(Note that this result holds also for $$c \leqslant 0$$ and the proof in this case is analogous. When $$c<0$$ we "flip" the inequality sign, but the result comes out the same.) The intuitive reason for this result is quite simple. The line $$cx=y$$ goes through the origin, and so it cuts the support of the random variables into two parts with equal area. Since both random variables are uniformly distributed over that support, the probability that $$cX>Y$$ must be one-half.