# calculating P(X>=Y)

• Feb 3rd 2009, 09:50 PM
calculating P(X>=Y)
hello,

How do I calculate P(X>=Y) where X,y having the uniform density on {0,1...N}?
• Feb 3rd 2009, 11:02 PM
mr fantastic
Quote:

hello,

How do I calculate P(X>=Y) where X,y having the uniform density on {0,1...N}?

Just make a grid. Y is the vertical axis, X is the horizontal axis.

Every point has the same probability: $\displaystyle \Pr(X = x_i, Y = y_j) = \frac{1}{(N + 1)^2}$ since there are $\displaystyle (N+1)^2$ points.

There are $\displaystyle N + 1$ points along the diagonal Y = X.

So the number of points such that $\displaystyle X \geq Y$ is $\displaystyle \frac{(N+1)^2 - (N+1)}{2} + (N+1) = \frac{(N+1)N}{2} + N + 1 = \frac{(N+1)(N+2)}{2}$.

Therefore $\displaystyle \Pr(X \geq Y) = \frac{\frac{(N+1)(N+2)}{2}}{(N+1)^2} = \frac{N+2}{2(N+1)}$.
• Feb 4th 2009, 11:30 AM
awkward
Quote:

hello,

How do I calculate P(X>=Y) where X,y having the uniform density on {0,1...N}?

Mr. F has already given you a first-rate answer, but here's another way to proceed just for the fun of it.

By the formula for the probability of a union,

$\displaystyle P(X \geq Y) + P(Y \geq X) - P(X = Y) = P(X \geq Y \text{ or }Y \geq X) = 1$

Now $\displaystyle P(X = Y) = \frac{1}{N+1}$

and $\displaystyle P(X \geq Y) = P(Y \geq X)$ by symmetry, so

$\displaystyle 2 \; P(X \geq Y) + \frac{1}{N+1} = 1$.

Solve this equation for $\displaystyle P(X \geq Y)$.