Derive the Bellman expectation equation for . How does the Bellman optimality equation for differ, and why can the first be solved as a linear system but not the second?
Reinforcement learning, Bellman equations
Level L3 Intermediate. Length Medium. Nature Mat Mathematical.
What's being asked
Whether you can derive the recursive form of the value function from the definition of the return, and explain where the max comes in.
Key idea
Because , The optimality equation replaces the average over with a max over actions: .
Steps
- Start from and the recursion .
- Condition on the first action and the next state: . By the Markov property the inner expectation is .
- Stack the values of all states into a vector. Let be the vector of expected one-step rewards under , and the matrix with . Then , so . The inverse exists because is a stochastic matrix and , so all eigenvalues of have modulus below 1.
- Write the optimality equation, and the action-value versions: and .
- Explain that the max makes the optimality equation non-linear, so it is solved iteratively (value iteration, policy iteration) or from samples (Q-learning), not by one matrix inversion.
Common mistakes
- Putting a max in the expectation equation, or in the optimality equation.
- Dropping the sum over , which silently assumes deterministic transitions.
- Mixing up the uses: the expectation equation is for evaluating a given policy; the optimality equation is for control.
How long your answer should be
Half a page: the derivation in 3–4 lines, then the two equations side by side.
Last checked on 4 December 2026.
Read this
Previous in Reinforcement learning: How do you derive the REINFORCE policy-gradient estimator, and why does subtracting a baseline not introduce bias?
Next in Reinforcement learning: Compare Monte Carlo and TD(0) value estimation in terms of bias and variance. Given eight episodes, one (A, 0, B, 0), six (B, 1) and one (B, 0), with , what do batch Monte Carlo and batch TD(0) give for and ?