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 + f(next state) * p 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 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.
Thanks for help!!! Sorry for my bad English.