# Where is the error?

I am trying to compute expectation of $$X\mathbb I_{[X+Y\le a]}$$ where $$a$$ is a fixed positive integer, $$X$$ is discrete uniform random variable taking values from $$1$$ to $$a$$, and $$Y$$ another random variable of unknown distribution, independent of $$X$$. I need it as part of a proof I am doing. My calculations are as follows: \begin{align} E(X\mathbb I_{[X+Y\le a]})&=E(E(X\mathbb I_{[X+Y\le a]}|X+Y\le a))&&(\text{By tower property})\\ &=E(E(X|X+Y\le a))\\ &=E(E(X|X\le a-Y))\\ &=E\left(\dfrac{a-Y+1}{2}\right)&&(\because X|X\le b\sim \mathrm{dunif}(1,2,\dots,b))\\ &=\dfrac{a+1}{2}-\dfrac12E(Y) \end{align} Now my problem is that, the random variable of which I want to calculate expectation is non-negative, but the expectation that I am getting is negative if $$E(Y)>a+1$$, which is possible. So what is the problem in my calculations?? Also, how do I sort that problem out?

• Is $Y$ positive ? Negative ? What is the support ? Feb 14 '21 at 11:10
• Support of $Y$ is a subset of $\mathbb N$, only that is known. Feb 14 '21 at 11:11
• After a few mistakes of my own I've added the correct answer: you mistakenly forget that $a-Y$ can be negative. Feb 14 '21 at 17:37

Focus on the computation of $$\mathbf{E}\left[X\mid X \leq a - Y\right]$$ You have 2 possibilities:
• If $$Y=y > a$$ then $$\mathbf{E}\left[X\mid X\leq a - y\right] = 0$$ as $$X$$ has zero mass outside its support.
• If $$Y = y < a$$ then $$\mathbf{E}\left[X\mid X\leq a - y\right] = \sum_{x=1}^ax\,p(x\mid a,y) = \frac{1}{a-y}\sum_{x=1}^{a-y}x = \dfrac{a - y +1}{2}$$ because the conditional probability simplifies to $$p(x\mid a,y) = \dfrac{\mathbf{P}(X=x, X\leq a-y)}{\mathbf{P}(X \leq a - y)} = \frac{a}{a(a-y)}\mathbb{I}_{x \leq a - y} = \frac{1}{a-y}\mathbb{I}_{x \leq a - y}$$ Therefore the expectation over $$Y$$ becomes $$\sum_{y=1}^{a-1}p_Y(y)\frac{a-y+1}{2} = \frac{a+1}{2}\mathbf{P}(Y This is positive because the second term is bounded as $$\sum_{y=1}^{a-1}y\,p_Y(y) \leq (a-1)\mathbf{P}(Y which yields that your quantity is bigger than $$\mathbf{P}(Y 0$$