0

The following is an equation from my probability textbook:

$\displaystyle\sum_y\sum_{\{x\ |\ g(x)=y\}}g(x)p_X(x)=\sum_x g(x)p_X(x)$

Could someone please give me a step-by-step explanation of why this is true?

Siddhartha
  • 1,770
  • 18
  • 38

1 Answers1

0

Interpretation 1 (no need for probability): The right-hand side is a sum over all possible values of $x$. The left-hand side is also a sum over all possible values of $x$, but they are "grouped" by the value of $g(x)$ so that you sum over each group first, and then add up the group totals.

Interpretation 2: Leg $p_X$ be the probability mass function of $X$. The right-hand side is $E[g(X)]$ while the left-hand side is $\sum_y E[g(X) \cdot \mathbf{1}_{g(X)=y}]$. The equality follows by noting that $\sum_y \mathbf{1}_{g(x)=y}=1$ for any $x$.

angryavian
  • 89,882