I'm doing an exercise on expected value. In problems that calculate the expected value of the number of steps to do something, the formula f(state) = 1 + sum of (f(next state) * p(next state)) is often used. where state is the current state, the next state is the new state that can be obtained from the current state, p(next state) is the probability of a new state occurring from the current state. But I just memorized it and applied it like a parrot and always wondered how the formula was proven or built.
I've tried to find this recipe internet before, but I haven't been able to find anywhere that goes into detail about it.
Can someone explain it to me.
Thanks for help!!! Sorry for my bad English.