# Proving the Law of the Unconscious Statistician

The proof seems a little too easy. I am wondering if I misunderstood something.

Let $Y = g(X)$. Prove the $$\mathbb E(Y) = \sum_x g(x)f_x(x)$$ provided that the sum converges absolutely.

By definition: $\mathbb E(Y) = \sum_y yf_y(y)$. Since $g^{-1}(y) = \{x_1, x_2,\dots\}$ $$f_y(y) = \mathbb P(Y=y) = \sum_i \mathbb P(X=x_i)$$ where $g(x_i) = y$. Hence $$\mathbb E(Y) = \sum_y y \sum_i \mathbb P(x_i) = \sum_y \sum_i g(x_i) \mathbb P(x_i) = \sum_i g(x_i) \mathbb P(x_i) = \sum_x g(x)f_x(x)$$ My understanding is that you need to capture every single $x_i \in g^{-1}(y)$. Repeat the process for every $y$ and then add up the terms.

-
How come noone has answered here? – JohnK Nov 25 '13 at 21:38

We suppose $X$ has a discrete distribution on countable set $S$, and let $Q \subseteq \mathbb{R}$ denote the range of $g$. Then $Q$ is countable thus $Y$ has a discrete distribution. It follows that $$E(Y) = \sum_{y \in Q} y \cdot P(Y=y) = \sum_{y \in Q} y \sum_{x \in g^{-1}(y)} f(x) = \sum_{y \in Q} \sum_{x \in g^{-1}(y)}g(x)f(x) = \sum_{x \in S} g(x)f(x)$$