Value Functions & Bellman Equations
The core mathematics of RL — measuring how good states and actions are
State Value Function V(s)
The state value function
Where
Think of

| Property | Description |
|---|---|
| Policy-dependent | Different policies yield different value functions |
| Bounded | |
| Unique | For a fixed policy, there exists a unique value function |
Action Value Function Q(s, a)
The action value function
Q-values allow action selection without a model. Given
This is why Q-learning and DQN focus on learning Q-values directly.
V and Q Relationship
Bellman Expectation Equations
The Bellman equations express a recursive relationship: the value of a state depends on successor state values.
Derivation for V(s)
Starting from
By linearity and the law of total expectation:
Bellman Expectation Equation for Q
Bellman Backup Diagram
The backup diagram shows how value "flows back" from successor states. White nodes = states; black nodes = state-action pairs.
Bellman Optimality Equations
The optimal value functions
Bellman Optimality for V:*
Bellman Optimality for Q:*
The key difference from expectation equations: instead of averaging over actions, we take the maximum.
Relationship Between V* and Q*
Once we have
Policy Evaluation and Policy Improvement
Policy Evaluation
Compute
Policy Improvement
Given
Policy Improvement Theorem:
Policy Iteration
1. Initialize V(s), pi(s) arbitrarily
2. Repeat until policy stable:
a. Policy Evaluation: Compute V^pi
b. Policy Improvement: pi' = greedy(V^pi)
c. If pi' = pi, return (optimal); else pi <- pi'Value Iteration Algorithm
Value iteration combines evaluation and improvement into a single update:
Convergence
The Bellman optimality operator is a contraction mapping:
Convergence is geometric with rate
| Aspect | Value Iteration | Policy Iteration |
|---|---|---|
| Update | Single sweep | Full evaluation |
| Convergence | Asymptotic | Exact in finite steps |
| Per-iteration cost | Lower | Higher |

Summary Comparison
| Concept | Formula | Key Insight |
|---|---|---|
| Expected return from state under policy | ||
| Expected return from state-action under policy | ||
| Best achievable value from state | ||
| Best achievable value from state-action | ||
| Bellman Expectation | Average over actions | Evaluates a given policy |
| Bellman Optimality | Max over actions | Finds optimal policy |
Interview Questions
Q1: When would you prefer learning V(s) vs Q(s,a)?
Answer:
Prefer Q when:
- Model-free learning (unknown transitions)
- Need direct action selection:
- Off-policy learning (Q-learning works with any data)
Prefer V when:
- Model is known (derive Q from V cheaply)
- Large action spaces (V has lower memory)
- Actor-Critic methods (critic often estimates V)
Key tradeoff: Q enables model-free action selection but requires
Q2: Derive the Bellman equation and explain its computational benefit.
Answer:
From
Computational benefit: Instead of simulating infinite trajectories (Monte Carlo), Bellman transforms this into a system of
Q3: Why does value iteration converge?
Answer:
The Bellman optimality operator is a contraction:
By Banach fixed-point theorem, repeated application converges to the unique fixed point
Convergence rate: Error decreases as
Stopping criterion: When
Quick Reference Card
+============================================================================+
| VALUE FUNCTIONS CHEAT SHEET |
+============================================================================+
| VALUE FUNCTIONS |
| V^pi(s) = E_pi[G_t | S_t = s] Q^pi(s,a) = E_pi[G_t | S_t=s, A_t=a] |
| V*(s) = max_a Q*(s,a) Q*(s,a) = R + gamma max_a' Q*(s',a') |
+----------------------------------------------------------------------------+
| BELLMAN EQUATIONS |
| Expectation: Average over actions Optimality: Max over actions |
| V = sum_a pi(a|s) [R + gamma V'] V* = max_a [R + gamma V*'] |
+----------------------------------------------------------------------------+
| ALGORITHMS |
| Policy Iteration: Evaluate -> Improve -> Repeat (exact convergence) |
| Value Iteration: V_k+1 = max_a [R + gamma V_k] (asymptotic convergence) |
+----------------------------------------------------------------------------+
| CONVERGENCE: ||V_k - V*|| <= gamma^k ||V_0 - V*|| |
| gamma=0.9: ~44 iters for 100x reduction | gamma=0.99: ~460 iters |
+============================================================================+Key Takeaways
Value functions quantify long-term reward —
for states, for state-action pairs. They convert the complex problem of sequential decision-making into a tractable optimization. Bellman equations provide recursive structure — The value of a state depends only on immediate rewards and values of successor states. This enables dynamic programming solutions.
Expectation vs. Optimality — Bellman expectation equations average over a policy; Bellman optimality equations maximize. This distinction separates policy evaluation from policy optimization.
Value iteration is a contraction — Convergence is guaranteed with rate
. Lower discount factors mean faster convergence but more myopic policies. Q-values enable model-free learning — By learning
directly, algorithms like Q-learning can find optimal policies without knowing transition probabilities.
These concepts form the mathematical foundation for both tabular RL methods and modern deep RL approaches like DQN, A3C, and PPO.