I'm trying to understand the result 2 on this page by way of example. It says for a discrete random variable $X$, with PMF $f(x)$, that the PMF of the transformed random variable $Y=r(X)$ we get a PMF
$$g(y)=\sum_{x\in r^{-1}\{y\}}f(x)$$
Here's the problem for which I'm trying to apply this result.
Suppose that $X$ is uniformly distributed on the integers $0$ to $9$. What is the mean of $Y=5X$?
For starters, I know that
$$f(x)=\begin{cases}\frac1{10}&\text{for }x\in\{0,\ldots,9\}\\0&\text{otherwise}\end{cases}$$
and since $Y=r(X)=5X$, we have $X=r^{-1}(Y)=\frac Y5$. But then the theorem suggests that the new variable's PMF would be
$$g(y)=\sum_{x\in r^{-1}\{y\}}f(x)=\sum_{x=0}^9f(x)$$
The sum evaluates to $1$, so I'm convinced I'm misunderstanding something important.
What does it mean to sum over all $x\in r^{-1}\{y\}$? Is it not true that $r^{-1}\{y\}=\{0,\ldots,9\}$?
I've thought about this in another way using the CDF for $X$. Letting $F(X)$ denote the CDF for $X$ and $G(Y)$ the CDF for $Y$,
$$G(y)=\mathbb P(Y\le y)=\mathbb P(5X\le y)=\mathbb P\left(X\le\dfrac y5\right)=F\left(\dfrac y5\right)$$
I know that
$$F(x)=\begin{cases}0&\text{for }x<0\\\frac n{10}&\text{for }n-1\le x<n,~n\in\{0,\ldots,9\}\\1&\text{for }9\le x\end{cases}$$
which would yield
$$F\left(\dfrac y5\right)=\begin{cases}0&\text{for }y<0\\\frac n{10}&\text{for }5n-5\le y<5n,~n\in\{0,\ldots,9\}\\1&\text{for }45\le y\end{cases}$$
and so, if I'm not mistaken, the PMF for $Y$ is
$$g(y)=\begin{cases}\frac1{10}&\text{for }y\in\{0,5,\ldots,45\}\\0&\text{otherwise}\end{cases}$$
If this is correct, then
how do I arrive at this result using the theorem from the provided link?
The support of $X$, which I denote $\mathcal{X}$, is $\{0, 1, \dots, 9\}$.
The image of $\mathcal{X}$ induced by $r$ is $r(\mathcal{X}) = \{0, 5, \dots, 45\}$. These are the elements $y$ that are being referred to. Let's let $Y = \{0, 5, \dots, 45\}$.
The inverse image of $Y$ is given by $r^{-1}(Y) = \{0, 1, \dots, 9\}$, which is simply $\mathcal{X}$.
Here's how the definition $$g(y) = \sum_{x \in r^{-1}(\{y\})}f(x)$$ works. Notice that $\{y\}$ is a singleton set - i.e., $y$ is only one value.
Fix $y$. We know that $y$ can be any one of the values $\{0, 5, \dots, 45\}$.
Thus, for example, $$g(0) = \sum_{x \in r^{-1}(\{0\})}f(x)\text{.}$$
What is the inverse image of $\{0\}$ induced by $r$? It is just $\{0\}$. Hence, $$g(0) = \sum_{x \in r^{-1}(\{0\})}f(x)=f(0)\text{.}$$ Next, $$g(5) = \sum_{x \in r^{-1}(\{5\})}f(x) = f(1)$$ since $r^{-1}(\{5\}) = 1$.
Keep doing this for every one of the ten values in $Y$.