Every pull of a bandit's arm started the same way the last one did — there was no "situation" to carry from one pull to the next. What happens the moment an action doesn't just pay a reward, but also decides where you are for the next decision?
A row of four states, the last one a goal. Move left or right — each move costs , except the one that lands you on the goal, which pays . Unlike the bandit, your position now depends on every choice you've made so far, and every future choice depends on where those moves left you.
A Markov decision process is the tuple — states, actions, a transition rule, a reward function, and a discount factor. For a fixed policy , the value of a state is its expected discounted future reward, defined recursively by the Bellman equation:
- — the value of state under policy : its expected discounted future reward.
- — the current state, one of the situations the agent can be in.
- — the policy: which action it prescribes from state .
- — the reward function: the immediate reward for taking that action in that state.
- — the discount factor, shrinking the value of reward that takes longer to arrive.
- — the transition rule: the state landed in after taking that action.
- The same idea as the chain rule
This is the exact same idea as Part I's chain rule — the value of right now depends on the value of whatever comes next — just unrolled over an action-dependent sequence of states instead of a fixed chain of functions.
Every state's value is highest closest to the goal and lower further away — not because those states are inherently better, but because discounts reward that takes longer to arrive. The value function is entirely a consequence of the policy and the discount, not something separately assigned to each state.
With , under the policy "always move right":
- Start from the goal and work backward
(nothing left to earn). — one move from .
- Two states from the goal
. .
- A policy that never arrives
Under "always move left," any state above eventually gets stuck bouncing at the boundary forever, each bounce costing . Solving for a fixed point: subtract from both sides to get , i.e. , so — a genuinely worse value than even the very first state gets under "always right."
Reach the goal with a discounted return above 5 — wasted moves cost you.
Every value in this chapter came from a policy that was already fixed and handed to you — "always right" was simply given, not learned. The real question reinforcement learning exists to answer is the one this chapter sidesteps: which policy should an agent follow, when nobody tells it in advance? The next chapter is the first algorithm that actually learns the answer.