Why is the probability mass function of a transformed discrete random variable summed over the inverse values of the function? Let $X$ be a random discrete variable with probability mass function (pmf) of $p_X(x) = P(X = x)$. Let $Y = g(X)$ (from $\mathbb{R}$ to $\mathbb{R}$). Then, why is it that: $$p_Y(y) = \sum_{x \in g^{-1}(y)}p_X(x)$$
 A: Let $X \in \{1,2,3,4,5,6\}$ be six sided dice and binary $Y\in\{0,1\}$ with $Y=1$ if and only if $X$ is even. 
$g^{-1}(y)$ is the inverse image which is the set of all the values for $X$ such that $g(x) = y$ wiki definition of inverse image.
Then $g^{-1}(y)\lvert_{y=1} = \{x \lvert x \ is \ even \} = \{2,4,6\}$ is the event that $X$ is even and this is by definition of $Y$ the event that $Y=1$. The events are the same so the probability is the same. The probability that $X \in \{2,4,6\}$ is off course
$$P_X(2) + P_X({4}) + P_X(6) = \sum_{x \in \{2,4,6\}}P_X(x) = \sum_{x \in g^{-1}(1)}P_X(x) = P_Y(y)$$.
So to summarize: You want to find the probability $P_Y(y)$ for a given value $y$ of the stochastic variable $Y$ that is defined as a function $Y=g(X)$. For $Y$ to take the value $y$ it must be the case that $X$ has taken some value $x$ such that $g(x) = y$ and the set of all the values that can bring the particular value $y$ about is $g^{-1}(y)$ by definition of the inverse image.
A: Because $Y =y$ iff $g(X)=y$ iff $X \in g^{-1}(\{y\})$. 
