# Summation rule for conditional probability

Both $$A$$ and $$B$$ are random variables. G is a random variable depends on A,B. The expectation is: $$\text{E}[G|A,B] = \sum_{g\in G} g P(G=g|A,B)$$. I would like to know if

$$\sum_{a} \big[P(A=a|B)-1\big]\text{E}[G|A,B] = \text{E}[G|B]- \text{E}[G|A,B]$$

holds?

Or, suppose A is an $$N$$ categorical variable, $$\sum_{a} \big[P(A=a|B)-1\big]\text{E}[G|A,B] = \text{E}[G|B]- N\text{E}[G|A,B]$$

• This is not clear. On the left, $B$ is just a dummy summation variable...so how can it appear after summation? For that matter, it's not at all clear what you are summing over. – lulu May 22 at 17:07
• @lulu Tks for your comment. I updated my question. Would you pls take a look? – spacegoing May 23 at 1:12
• Summations should have a summation index and a clear set of limits over which we sum, such as $\sum_{i=1}^{\infty} P[X=i]$. I do not now what your equations mean, or what $A, B, f$ are. Is $f$ a random variable? Is $A$ an event? How does it make sense to sum over events? – Michael May 23 at 1:19
• @Michael Tks for your comment. I updated it again. Hope it is more clear now? Pls tell me if u have further questions – spacegoing May 23 at 1:28
• The short answer is no. The left-hand-side is likely $-\infty$ while the right-hand-side is likely finite. But we don't really know for sure because there are not clear limits on your sum. If I asked you to evaluate $\sum_a 1$, or $\sum_a a^2$, what would it be? On the other hand, $\sum_{a=1}^{\infty} a$ or $\sum_{a=1}^{10} a^2$ make sense. – Michael May 23 at 4:56