# A problem related to the comparison of two integer-valued random variables

Consider an urn containing red, blue and green balls (the situation is the same illustrated in this post).

Let $$X$$ be the non-negative, integer-valued random variable defined as the number of trials (of one ball at a time, with replacement) in correspondence of which we get at least one red ball, and at least one blue ball (event $$E_X$$), and $$Y$$ the non-negative, integer-valued random variable defined as the number of trials in correspondence of which we get at least one red ball, and at least one blue ball, and at least one green ball (event $$E_Y$$).

How to evalute $$P(Y-X\geq 1)$$?

My attempt:

I tried this: $$P(Y-X\geq 1)=1-P(Y-X<1)=1-P(Y, but then I met this problem: How can it be $$Y? The event $$E_Y$$ can occur only if the event $$E_X$$ has already occurred, and this should have happened at least one trial before the occurrence of the event $$E_Y$$. Does this mean that $$P(Y-X\geq 1)=1$$? Also this is not convincing, because it can happen that the event $$E_X$$ occurred, but the event $$E_Y$$ not (yet).

• Suppose the first ball drawn is green, the second is red, and the third is blue. Then $X=Y=3$. So no, it is not the case that $P(Y-X\geq 1)=1$. More generally, $X<Y$ if the first green ball drawn comes when a red ball and a blue ball have already been drawn, and otherwise $X=Y$. I would suggest that math.stackexchange.com is a better place than mathoverflow for sorting out this kind of difficulty. – James Martin Dec 4 '18 at 10:45
• @JamesMartin I see. Thank you for your answer. Any suggestion how to evaluate $P(Y-X\geq 1)$ ? – Andrea Prunotto Dec 4 '18 at 11:46

As in the linked answer, for each $$j=1,2,3$$, let $$p_j$$ denote the probability of getting a red, blue, green ball (respectively) in one trial. For $$x=0,1,\dots$$ and $$j=1,2,3$$, let $$N_{x,j}$$ denote the number of trials with outcome $$j$$ among the first $$x$$ trials.
Note that $$X\ge2$$. For $$x=2,3,\dots$$ $$$$P(X=x where $$$$p_{x,1}:=P(N_{x-1,1}>0,N_{x-1,2}=0,N_{x-1,3}=0,N_{x,2}>0)=p_1^{x-1}p_2$$$$ and $$$$p_{x,2}:=P(N_{x-1,1}=0,N_{x-1,2}>0,N_{x-1,3}=0,N_{x,1}>0)=p_2^{x-1}p_1.$$$$ Hence, $$$$P(Y-X\ge1)=\sum_{x=2}^\infty P(X=x with strict inequalities if $$p_3>0$$.
Added in response to comment by the OP: More generally, for $$x=2,3,\dots$$ and $$k=0,1,\dots$$, $$$$P(X=x,Y>x+k)=(p_1^{x-1}p_2+p_2^{x-1}p_1)(1-p_3)^k,$$$$ whence $$$$P(Y-X>k)=\sum_{x=2}^\infty P(X=x,Y>x+k)=\Big(\frac{p_1p_2}{1-p_1}+\frac{p_1p_2}{1-p_2}\Big)(1-p_3)^k$$$$ and hence $$$$E(Y-X)=\sum_{k=0}^\infty P(Y-X>k)=\Big(\frac{p_1p_2}{1-p_1}+\frac{p_1p_2}{1-p_2}\Big)\frac1{p_3},$$$$ which agrees with the expressions for $$EX$$ and $$EY$$ in the linked post.
• I wonder if it possible to put somehow together this post and the linked one: the aim would be to find $E[Y-X]=\sum_{k=?}^{\infty}P(Y-K>k)=E[Y]-E[X]$, where the latter terms are the ones you showed in the previous post. The relation $E[Y-X]=E[Y]-E[X]$ should hold for the linearity of the expected value. What do you think? – Andrea Prunotto Dec 5 '18 at 5:39
• By the way, it is really surprising to me that $P(Y-X\geq 1)$ does not depend on $p_3$, i .e. on the number of green balls! – Andrea Prunotto Dec 5 '18 at 6:03
• (i) I have added the expression for $P(Y-X>k)$ and the corresponding expression for $E(Y-X)$. (ii) I would not say that $P(Y-X\ge1)$ does not depend on $p_3$, since it depends on $p_1,p_2$, whereas $p_3=1-p_1-p_2$. – Iosif Pinelis Dec 5 '18 at 16:41