I'm having trouble understanding some homework and would love it if any of you could be of any assistance. I have to prove that $$\mathbb{E} \left[ \sum_{k=1}^\infty \beta^{k-1}R_k \right]=\mathbb{E} \left[ \sum_{k=1}^TR_k \right] $$ And I'm not sure how to handle it so I'm trying to split it up in parts and one of the things that make the least sense is that $T$ is a geometric random variable with $P(T=k)=\beta^{k-1}(1-\beta)$.
I have never seen an upper bound being a random variable and can't find anything about it. I'm thinking that it might be possible to rewrite the right-side sum to an infinite sum like this: $$ \mathbb{E} \left[ \sum_{k=1}^TR_k \right] = \mathbb{E} \left[ \sum_{k=1}^\infty P(T=k)R_k \right]$$ Then by linearity we could move the expectation in and since $\mathbb{E} \left( P(T=k) \right)=\frac{\beta^{k-1}(1-\beta)}{1-\beta}$ (success probability is $1-\beta$) which would give us the same on both sides. But I feel like this isn't the case and I'm making Gauss turn in his grave. Every input is appreciated, thank you!
By the law of total expectation, we have
$$\begin{align} \mathbb{E} \left( \sum_{k=1}^TR_k \right) &= \Bbb E\left(\mathbb{E} \left( \sum_{k=1}^TR_k \middle | T\right) \right) \\&= \sum_{n\geqslant 1}\left[\mathbb{E} \left( \sum_{k=1}^TR_k \middle | T = n\right) \cdot \Bbb P(T= n)\right] \\&= \sum_{n\geqslant 1}\left[\mathbb{E} \left( \sum_{k=1}^nR_k \right) \cdot \Bbb P(T= n)\right] \\&= \sum_{n\geqslant 1} \left[ \left(\sum_{k=1}^n\mathbb{E}(R_k)\right) \cdot \beta^{n-1}(1-\beta)\right] \end{align}$$
If we now change the order of summations
$$\begin{align} \mathbb{E} \left( \sum_{k=1}^TR_k \right) &= \sum_{n\geqslant 1} \left[ \left(\sum_{k=1}^n\mathbb{E}(R_k)\right) \cdot \beta^{n-1}(1-\beta)\right] \\&= \sum_{k\geqslant 1} \Bbb E(R_k)\left(\sum_{n\geqslant k}\beta^{n-1}(1-\beta)\right) \\&= \sum_{k\geqslant 1} (1-\beta) \Bbb E(R_k)\left(\sum_{n\geqslant 0}\beta^{n+k-1}\right) \\&= \sum_{k\geqslant 1} \beta^{k-1}(1-\beta) \Bbb E(R_k)\left(\sum_{n\geqslant 0}\beta^{n}\right) \\&= \sum_{k\geqslant 1} \beta^{k-1}(1-\beta) \Bbb E(R_k)\frac1{1-\beta} \\&= \sum_{k\geqslant 1} \beta^{k-1}\Bbb E(R_k) \\&= \sum_{k\geqslant 1} \Bbb E\left(\beta^{k-1}R_k\right) = \Bbb E\left(\sum_{k\geqslant 1} \beta^{k-1}R_k\right). \end{align}$$