5.1.5 · D4Reinforcement Learning Foundations

Exercises — Bellman equations

1,949 words9 min readBack to topic

Symbols you will use everywhere on this page — earn them once here:


Level 1 — Recognition

L1.1 — Name the equation

Recall Solution

This is the Bellman expectation equation for , so .

  • — average over the actions the fixed policy might pick (an expectation, not a max).
  • — average over where the environment might send you.
  • — the reward paid on that one step.
  • — discounted value of wherever you land.

The give-away that it is (not ) is the : we are following a policy, not choosing the best.

L1.2 — Spot the missing discount

Recall Solution

The Discount Factor is missing on the future term. Correct form: . Without it, an infinite stream of rewards sums to .


Level 2 — Application

L2.1 — One-step from a table

Recall Solution

Apply the expectation equation. Each action contributes :

L2.2 — One TD target (Bellman optimality as a sample)

Recall Solution

The optimality equation replaces the expectation by one observed sample and uses a max over next actions: This is the bootstrapped estimate that Q-Learning chases.

L2.3 — from values

Recall Solution

is the policy-weighted average of the values (this is the bridge in the parent's derivation):


Level 3 — Analysis

L3.1 — Self-loop fixed point

Recall Solution

The next state is , so appears on both sides: Move it over: . What it looks like: an infinite geometric sum . Look at the figure — the reward stack shrinks by each layer and converges.

Figure — Bellman equations

L3.2 — The 2×2 grid from the parent, finished

Recall Solution

From the parent's simplification: Substitute : Analysis: is slightly worse than because two of its four moves waste a step bouncing off a wall.

Figure — Bellman equations

L3.3 — Why (degenerate case)

Recall Solution

For : . As the denominator , so . That divergence is exactly why strictly — the boundary breaks the infinite-horizon sum.


Level 4 — Synthesis

L4.1 — Full Q-learning update

Recall Solution

Step 1 — target (Bellman optimality, sampled): . Step 2 — TD error (the Bootstrapping correction): . Step 3 — nudge toward it: This is Temporal Difference Learning in one line: move current estimate a fraction toward the Bellman target.

L4.2 — Build a optimality equation

Recall Solution

Optimality uses the max over next actions:

L4.3 — Two-state linear system

Recall Solution

Two coupled equations: Substitute the first into the second: , so , . Then , and . This is a tiny instance of Dynamic Programming solving the Bellman system exactly.


Level 5 — Mastery

L5.1 — Iterate to the fixed point

Recall Solution

Fixed point: . The iterates climb toward , halving the gap each step — this is value iteration (Dynamic Programming) converging as a contraction.

Figure — Bellman equations

L5.2 — Optimal vs. random policy gap

Recall Solution

Terminal means no future value, so each action's value is just its reward. (a) (greedy picks ). (b) (uniform averages good and bad). (c) Gap . This gap is exactly what Policy Gradient Methods and value-based methods work to close by shifting probability toward .

L5.3 — Prove the geometric bound

Recall Solution

Every value function on this MDP lives inside — a fact used to prove Bellman updates are contractions on a Markov Decision Process.


Recall Quick self-quiz

The symbol that distinguishes from ::: (optimality) versus (expectation) Fixed-point value of a self-loop with reward , discount ::: The TD target in Q-learning ::: Value of a terminal state ::: Tightest bound on given :::