# How to compute $\mathbb{E}[\text{ReLU}(pX-qY)]$ and $\mathbb{E}[pX\mathbb{1}(pX-qY>0)]$ where $X\sim B(K, q), Y\sim B(K, p)$?

Let $$X$$ and $$Y$$ are two independent binomial random variables where $$X\sim B(K, q), Y\sim B(K, p)$$. I am wondering how to compute or estimate the following expectations: $$\ \mathbb{E}[|pX-qY|]\ \ \text{and}\ \ \mathbb{E}[\text{ReLU}(pX-qY)].$$

where ReLU($$x$$) = max($$x, 0$$) Furthermore, what does the distribution of $$pX-qY$$ look like?

Update: Actually I'm more interested in $$\mathbb{E}[pX\mathbb{1}(pX-qY>0)]\ \text{and}\ \mathbb{E}[qY\mathbb{1}(pX-qY>0)]$$, where $$\mathbb{1}$$ is the indicator function. We know that $$\mathbb{E}[pX\mathbb{1}(pX-qY>0)]-\mathbb{E}[qY\mathbb{1}(pX-qY>0)]=\mathbb{E}[\text{ReLU}(pX-qY)]$$ for which @PedroSebe has presented a nice idea below.

• Cross-posted at math.stackexchange.com/q/3580440/321264. – StubbornAtom Mar 14 at 7:46
• There doesn't seem to be a closed form. – gunes Mar 14 at 9:05
• @gunes Thanks! I have modified the question a bit. – luw Mar 14 at 14:47

Although there is no closed form, if $$K$$ is big enough we can use Central Limit Theorem to approximate $$X\sim\mathcal{N}(Kq,Kq(1-q))$$ and $$Y\sim\mathcal{N}(Kp,Kp(1-p))$$. It follows that $$pX-qY$$ has asymptotically normal distribution with mean zero and variance given by:

$$\sigma^2=p^2\cdot Kq(1-q)+q^2\cdot Kp(1-p) \\=Kpq\left[p(1-q)+q(1-p)\right]\\=Kpq(p+q-2pq)$$

Then, using a property of the normal distribution, we get: $$\mathbb{E}[|pX-qY|]=\sqrt{\frac{2}{\pi}}\sigma=\sqrt{\frac{2Kpq}{\pi}(p+q-2pq)}$$

Now, for the ReLU, let us denote $$Z=pX-qY$$, for clarity. Then:

$$\mathbb{E}[\text{ReLU}(Z)]=\mathbb{E}[Z|Z>0]\cdot\mathbb{P}[Z>0]$$

Since $$\text{ReLU}(Z)=0$$ if $$Z<0$$ and $$=Z$$ otherwise. Then, using the fact that our distribution is symmetric around zero, we have:

$$\mathbb{E}[\text{ReLU}(Z)]=\frac{1}{2}\mathbb{E}[|pX-qY|]=\sqrt{\frac{Kpq}{2\pi}(p+q-2pq)}$$

• Thank you for your answer! Actually I'm more interested in $\mathbb{E}[pX\mathbb{1}(pX-qY>0)]\ \text{and}\ \mathbb{E}[qY\mathbb{1}(pX-qY>0)]$. (I have updated my question a bit.) Do you have any advice for this? – luw Mar 15 at 6:31