Another stackoverflow question provides the following logic to get from an expected value for Xg(X) where random variable has a Poisson distribution:
\begin{align} E[X g(X)] &= \sum_{x=0}^\infty x g(x) f_X(x) \\ &= \sum_{x=1}^\infty x g(x) f_X(x) & \text{Step 2: addend is zero when $x=0$} \\ &= \sum_{x=1}^\infty x g(x) e^{-\lambda} \frac{\lambda^x}{x!} & \text{Step 3: plug in PMF of Poisson distr.} \\ &= \lambda\sum_{x=1}^\infty g(x) e^{-\lambda} \frac{\lambda^{x-1}}{(x-1)!} & \text{Step 4: rearrange terms} \\ &= \lambda \sum_{x=0}^\infty g(x+1) e^{-\lambda} \frac{\lambda^x}{x!}. & \text{Step 5: shift indexing} \end{align}
What is the logic for getting from Step 3 to Step 4? How can you reindex the f(x) portion, but not the g(x) portion, and where does the lambda constant come from?
(Please note, new user here, so I apparently cannot comment on their original posting for clarification.)
Answer posted in comments:
It's merely that x/x!=1/(x−1)! Once you do that, it is also nice to factor out λ^x as λ⋅λ^(x−1) since that's yields again the distribution of a Poisson RV (albeit shifted). The reindexing is only occurring in step 5. – stochasticboy321
(Commenting to mark this as "answered")