Markov Decision Processes

Imagine a robot navigating a warehouse. At every moment it chooses whether to turn, accelerate, or stop. Meanwhile, shelves, other robots, and battery levels change around it. To act well, the robot needs a precise language. It must describe "what state am I in," "what can I do," "what happens next," and "how good was that." The Markov Decision Process, or MDP, is exactly this language. It is the mathematical skeleton underneath essentially every reinforcement learning algorithm. This includes tabular Q-learning and the deep networks that play Go or align large language models. The reason MDPs matter goes beyond notation. Once a problem is written as an MDP, an enormous body of theory becomes available. This includes existence of optimal policies and algorithms that provably converge to them. It also includes precise statements of how much computation and memory those algorithms need. Real systems — recommendation engines, robotic controllers, inventory managers, dialogue agents — are modeled as MDPs (or close relatives). This lets this machinery be applied instead of reinvented from scratch for each application. This article builds the MDP tuple piece by piece: states, actions, transition dynamics, rewards, and discounting. It explains what the Markov property buys us. It shows why this is the load-bearing assumption of the entire framework. It also shows how this assumption turns a seemingly intractable planning problem into one solvable by dynamic programming. We derive the Bellman equations. We present policy evaluation, policy iteration, and value iteration with full pseudocode. We also prove why they converge. By the end, you will be able to formalize a decision problem as an MDP. You will write down its Bellman equations from first principles. You will also run dynamic programming to compute optimal behavior. This is the foundation on which Policies and Value Functions and later the The Exploration-Exploitation Dilemma are built.

Key takeaways
  • An MDP is the tuple (S,A,P,R,γ)(\mathcal{S}, \mathcal{A}, P, R, \gamma): states, actions, transition dynamics, reward function, and discount factor.
  • The Markov property says the next state depends only on the current state and action, not on history — this makes planning tractable.
  • Bellman equations recursively relate the value of a state to the values of its successors, giving a fixed-point characterization of optimal behavior.
  • Policy evaluation, policy iteration, and value iteration are dynamic programming algorithms that compute value functions and optimal policies exactly, given a known model.
  • Convergence follows because the Bellman optimality operator is a γ\gamma-contraction in the max-norm, guaranteeing a unique fixed point reached at geometric rate.
  • MDPs are the formal problem statement that all of reinforcement learning — model-based or model-free — is trying to solve.
The core insight

An MDP formalizes sequential decision-making under uncertainty as a state-action-reward system obeying the Markov property, turning "act optimally over time" into a well-defined fixed-point problem solvable by dynamic programming.

The idea

A Markov Decision Process is a tuple

M=(S,A,P,R,γ)\mathcal{M} = (\mathcal{S}, \mathcal{A}, P, R, \gamma)

where S\mathcal{S} is the set of states, A\mathcal{A} is the set of actions, P(s′∣s,a)P(s' \mid s, a) is the transition dynamics giving the probability of landing in state s′s' after taking action aa in state ss, R(s,a,s′)R(s, a, s') (or a simpler R(s,a)R(s,a)) is the expected immediate reward, and γ∈[0,1]\gamma \in [0, 1] is the discount factor. An agent interacts with this process over a sequence of discrete time steps t=0,1,2,…t = 0, 1, 2, \dots: at each step it observes state StS_t, selects action AtA_t, receives reward Rt+1R_{t+1}, and transitions to St+1∼P(⋅∣St,At)S_{t+1} \sim P(\cdot \mid S_t, A_t). The crucial structural assumption is the Markov property, already familiar as a precondition for this framework: P(St+1,Rt+1∣St,At,St−1,At−1,… )=P(St+1,Rt+1∣St,At)P(S_{t+1}, R_{t+1} \mid S_t, A_t, S_{t-1}, A_{t-1}, \dots) = P(S_{t+1}, R_{t+1} \mid S_t, A_t). The state is a sufficient statistic for the future — everything relevant about the history is compressed into StS_t. This is not merely a simplifying convenience; it is what makes the value of a state well-defined independent of how the agent arrived there, which in turn is what allows recursive (dynamic programming) solutions rather than search over entire histories. A policy π\pi is a mapping from states to (distributions over) actions; it is the object an agent is ultimately trying to choose well, and it will be treated fully in Policies and Value Functions. Given a policy, the return Gt=∑k=0∞γkRt+k+1G_t = \sum_{k=0}^{\infty} \gamma^k R_{t+k+1} aggregates future rewards, discounted by γ\gamma — this quantity was introduced under Rewards and Returns and the MDP is precisely the generative model that produces the reward sequence being summed. The discount factor serves double duty: it encodes a preference for sooner reward over later reward, and — critically — it guarantees the return is a finite, well-defined random variable even in infinite-horizon tasks with bounded rewards, since ∑kγkRmax⁡=Rmax⁡/(1−γ)<∞\sum_k \gamma^k R_{\max} = R_{\max}/(1-\gamma) < \infty for γ<1\gamma < 1.

How it works

The payoff of formalizing a problem as an MDP is that value functions become computable via recursion. Define the state-value function under policy π\pi as the expected return starting from ss and following π\pi:

Vπ(s)=Eπ[Gt∣St=s]V^\pi(s) = \mathbb{E}_\pi\left[ G_t \mid S_t = s \right]

and the action-value function

Qπ(s,a)=Eπ[Gt∣St=s,At=a].Q^\pi(s,a) = \mathbb{E}_\pi\left[ G_t \mid S_t = s, A_t = a \right].

Because the return can be unrolled one step, Gt=Rt+1+γGt+1G_t = R_{t+1} + \gamma G_{t+1}, and because of the Markov property, VπV^\pi satisfies the Bellman expectation equation:

Vπ(s)=∑aπ(a∣s)∑s′P(s′∣s,a)[R(s,a,s′)+γVπ(s′)].V^\pi(s) = \sum_a \pi(a\mid s) \sum_{s'} P(s'\mid s,a) \Big[ R(s,a,s') + \gamma V^\pi(s') \Big].

An optimal policy π∗\pi^* achieves Vπ∗(s)≥Vπ(s)V^{\pi^*}(s) \ge V^\pi(s) for every state ss and every policy π\pi simultaneously (a nontrivial existence fact, justified below). Its value function V∗=Vπ∗V^* = V^{\pi^*} satisfies the Bellman optimality equation:

V∗(s)=max⁡a∑s′P(s′∣s,a)[R(s,a,s′)+γV∗(s′)].V^*(s) = \max_a \sum_{s'} P(s'\mid s,a)\Big[ R(s,a,s') + \gamma V^*(s') \Big].

This equation is not a formula to evaluate directly — V∗V^* appears on both sides — but a fixed-point condition. Three classical dynamic-programming algorithms exploit it, assuming the model (P,R)(P, R) is fully known.

1. Iterative policy evaluation computes VπV^\pi for a fixed policy by repeatedly applying the Bellman expectation equation as an update rule until it stabilizes.

2. Policy iteration alternates full policy evaluation with a greedy policy improvement step.

3. Value iteration collapses evaluation and improvement into a single sweep using the max directly. ```

# --- Iterative Policy Evaluation ---

# Input: MDP (S, A, P, R, gamma), policy pi, tolerance theta

# Output: V approximating V_pi initialize V(s) = 0 for all s in S repeat: delta = 0 for each s in S: v_old = V(s) V(s) = sum over a of pi(a|s) sum over s' of P(s'|s,a) (R(s,a,s') + gamma * V(s')) delta = max(delta, |v_old - V(s)|) until delta < theta return V ``` ```

# --- Policy Iteration ---

# Input: MDP (S, A, P, R, gamma)

# Output: optimal policy pi, optimal value V initialize pi(s) arbitrarily for all s in S initialize V(s) = 0 for all s in S loop:

# 1. Policy evaluation: compute V ~= V_pi (as above, using current pi) V = PolicyEvaluation(pi, V)

# 2. Policy improvement policy_stable = true for each s in S: old_action = pi(s) pi(s) = argmax over a of sum over s' of P(s'|s,a) (R(s,a,s') + gamma V(s')) if old_action != pi(s): policy_stable = false if policy_stable: return pi, V ``` ```

# --- Value Iteration ---

# Input: MDP (S, A, P, R, gamma), tolerance theta

# Output: optimal value V, optimal (greedy) policy pi initialize V(s) = 0 for all s in S repeat: delta = 0 for each s in S: v_old = V(s) V(s) = max over a of sum over s' of P(s'|s,a) (R(s,a,s') + gamma V(s')) delta = max(delta, |v_old - V(s)|) until delta < theta

# Extract greedy policy for each s in S: pi(s) = argmax over a of sum over s' of P(s'|s,a) (R(s,a,s') + gamma V(s')) return V, pi ```

Figure
The MDP interaction loop and the Bellman backup diagram
Agent policy π Environment P(s′|s,a), R action Aₜ state Sₜ₊₁, reward Rₜ₊₁ s a₁ a₂ a₃ s′ s′ s′ s′ s′ V*(s) = maxₐ Σ P(s′|s,a)[R + γV*(s′)] Bellman optimality backup Agent–environment loop

Complexity & correctness

Complexity. Let n=∣S∣n = |\mathcal{S}| and m=∣A∣m = |\mathcal{A}|. Each Bellman backup at a single state — computing the sum or max over actions and successor states — costs O(mn)O(m n) time in the worst case (dense transition matrices), or O(mb)O(m b) if each state has at most bb possible successors under any action ("branching factor"). One full sweep over all states therefore costs O(n2m)O(n^2 m) (dense) or O(nmb)O(n m b) (sparse). Memory is O(n)O(n) for the value table plus O(n2m)O(n^2 m) to store PP explicitly, or less if the model is given as a generative simulator rather than a table.

  • Policy evaluation to tolerance θ\theta takes O(log⁡(1/θ)log⁡(1/γ))O\left(\frac{\log(1/\theta)}{\log(1/\gamma)}\right) sweeps in the worst case (derived below), each O(n2m)O(n^2 m), so total O(n2m⋅log⁡(1/θ)log⁡(1/γ))O\left(n^2 m \cdot \frac{\log(1/\theta)}{\log(1/\gamma)}\right).
  • Policy iteration performs at most mnm^n possible deterministic policies in principle, but in practice terminates after a small number of improvement steps; each step requires one policy evaluation. A classical (non-trivial) result shows policy iteration terminates in a number of iterations that is polynomial in nn, mm, and 1/(1−γ)1/(1-\gamma) for a fixed discount, and always terminates finitely because the policy strictly improves at every non-terminal step and there are finitely many deterministic policies.
  • Value iteration requires no inner evaluation loop; each outer sweep is O(n2m)O(n^2 m), and the number of sweeps to reach tolerance θ\theta is again O(log⁡(1/θ)log⁡(1/γ))O\left(\frac{\log(1/\theta)}{\log(1/\gamma)}\right).

Correctness — the contraction argument. Define the Bellman optimality operator TT acting on any value function V:S→RV : \mathcal{S} \to \mathbb{R} by

(TV)(s)=max⁡a∑s′P(s′∣s,a)[R(s,a,s′)+γV(s′)].(TV)(s) = \max_a \sum_{s'} P(s'\mid s,a)\left[R(s,a,s') + \gamma V(s')\right].

Claim: TT is a contraction in the max-norm ∥V∥∞=max⁡s∣V(s)∣\|V\|_\infty = \max_s |V(s)|, with contraction factor γ\gamma:

∥TV1−TV2∥∞≤γ∥V1−V2∥∞.\|TV_1 - TV_2\|_\infty \le \gamma \|V_1 - V_2\|_\infty.

Proof sketch. Fix ss. Let a∗a^* be the maximizing action for TV1(s)TV_1(s). Then

(TV1)(s)−(TV2)(s)≤∑s′P(s′∣s,a∗) γ[V1(s′)−V2(s′)]≤γ∥V1−V2∥∞,(TV_1)(s) - (TV_2)(s) \le \sum_{s'} P(s'\mid s,a^*)\, \gamma\big[V_1(s') - V_2(s')\big] \le \gamma \|V_1 - V_2\|_\infty,

using that P(⋅∣s,a∗)P(\cdot \mid s, a^*) is a probability distribution so the weighted average is bounded by the max, and reward terms cancel since both use the same R(s,a∗,s′)R(s,a^*,s'). By symmetry, swapping V1,V2V_1, V_2, we get ∣(TV1)(s)−(TV2)(s)∣≤γ∥V1−V2∥∞|(TV_1)(s) - (TV_2)(s)| \le \gamma\|V_1-V_2\|_\infty for every ss, hence the same bound in max-norm. ■\blacksquare Since γ<1\gamma < 1, the Banach fixed-point theorem guarantees TT has a unique fixed point V∗V^*, and iterating Vk+1=TVkV_{k+1} = TV_k from any starting V0V_0 converges to it geometrically: ∥Vk−V∗∥∞≤γk∥V0−V∗∥∞\|V_k - V^*\|_\infty \le \gamma^k \|V_0 - V^*\|_\infty. This is exactly what value iteration does, which is why it converges regardless of initialization, and why the number of sweeps to reach error θ\theta scales as log⁡(1/θ)/log⁡(1/γ)\log(1/\theta) / \log(1/\gamma). The same contraction argument (with max⁡a\max_a replaced by ∑aπ(a∣s)\sum_a \pi(a\mid s)) shows the Bellman expectation operator TπT^\pi is also a γ\gamma-contraction, so iterative policy evaluation converges to VπV^\pi for the same reason.

Correctness of policy improvement. The policy improvement theorem states: if π′(s)=arg⁡max⁡aQπ(s,a)\pi'(s) = \arg\max_a Q^\pi(s,a) for all ss, then Vπ′(s)≥Vπ(s)V^{\pi'}(s) \ge V^\pi(s) for all ss, with strict inequality somewhere unless π\pi is already optimal. The proof unrolls the inequality Vπ(s)≤Qπ(s,π′(s))V^\pi(s) \le Q^\pi(s,\pi'(s)) repeatedly, substituting the Bellman equation at each step, which shows the return under π′\pi' dominates term by term. Because there are only finitely many deterministic policies (mnm^n of them) and each improvement step either strictly improves some state's value or leaves the policy unchanged (signaling optimality reached), policy iteration must terminate at the true optimum in finitely many steps — it cannot cycle.

Tradeoffs. Value iteration needs no nested evaluation loop but its single-sweep updates converge only asymptotically to V∗V^*; you must choose a tolerance θ\theta. Policy iteration converges in exact, finitely many outer steps but each step's inner evaluation is itself an iterative (or, if you solve the linear system directly, an O(n3)O(n^3)-cost) computation. Both require the full model (P,R)(P,R) — this is dynamic programming, not learning from samples, and it scales poorly when nn is astronomically large (e.g. Go's ∼10170\sim 10^{170} states), which is precisely the gap that model-free reinforcement learning and function approximation are built to close.

Worked example

Consider a tiny robot-navigation MDP with three states {s1,s2,s3}\{s_1, s_2, s_3\}, where s3s_3 is a terminal goal state (self-absorbing, reward 0 thereafter). Two actions: Wait (stay put, small cost) and Move (advance toward the goal, but may slip). Discount γ=0.9\gamma = 0.9.

FromActionToProbabilityReward
s1s_1Waits1s_11.0−1-1
s1s_1Moves2s_20.8−1-1
s1s_1Moves1s_10.2−1-1
s2s_2Waits2s_21.0−1-1
s2s_2Moves3s_30.9+10+10
s2s_2Moves2s_20.1−1-1
s3s_3anys3s_31.000

Initialize V0(s1)=V0(s2)=V0(s3)=0V_0(s_1) = V_0(s_2) = V_0(s_3) = 0. Run value-iteration sweeps:

Sweep 1.

V1(s1)=max⁡(1.0(−1+0.9⋅0)⏟Wait, 0.8(−1+0.9⋅0)+0.2(−1+0.9⋅0)⏟Move)=max⁡(−1,−1)=−1V_1(s_1) = \max\Big(\underbrace{1.0(-1+0.9\cdot 0)}_{\text{Wait}},\ \underbrace{0.8(-1+0.9\cdot 0) + 0.2(-1+0.9\cdot 0)}_{\text{Move}}\Big) = \max(-1, -1) = -1
V1(s2)=max⁡(−1, 0.9(10+0.9⋅0)+0.1(−1+0.9⋅0))=max⁡(−1, 8.9)=8.9V_1(s_2) = \max\Big(-1,\ 0.9(10 + 0.9\cdot 0) + 0.1(-1+0.9\cdot 0)\Big) = \max(-1,\ 8.9) = 8.9
V1(s3)=0V_1(s_3) = 0

Sweep 2.

V2(s1)=max⁡(−1+0.9(−1), 0.8(−1+0.9⋅8.9)+0.2(−1+0.9⋅(−1)))V_2(s_1) = \max\big(-1 + 0.9(-1),\ 0.8(-1+0.9\cdot 8.9) + 0.2(-1+0.9\cdot(-1))\big)
=max⁡(−1.9, 0.8(7.01)+0.2(−1.9))=max⁡(−1.9, 5.608−0.38)=max⁡(−1.9,5.228)=5.228= \max(-1.9,\ 0.8(7.01) + 0.2(-1.9)) = \max(-1.9,\ 5.608 - 0.38) = \max(-1.9, 5.228) = 5.228
V2(s2)=max⁡(−1+0.9(8.9), 0.9(10+0)+0.1(−1+0.9⋅8.9))=max⁡(7.01, 9+0.701)=max⁡(7.01,9.701)=9.701V_2(s_2) = \max(-1+0.9(8.9),\ 0.9(10+0) + 0.1(-1+0.9\cdot 8.9)) = \max(7.01,\ 9+0.701) = \max(7.01, 9.701) = 9.701

Sweep 3 (values continue climbing, differences shrinking by roughly a factor bounded by γ=0.9\gamma = 0.9 each sweep):

V3(s1)≈max⁡(−1.9(0.9)… )≈6.99,V3(s2)≈9.93V_3(s_1) \approx \max(-1.9(0.9)\dots) \approx 6.99,\qquad V_3(s_2) \approx 9.93

Continuing until δ<θ=0.01\delta < \theta = 0.01 yields approximately:

V∗(s1)≈7.72,V∗(s2)≈9.98,V∗(s3)=0.V^*(s_1) \approx 7.72,\qquad V^*(s_2) \approx 9.98,\qquad V^*(s_3) = 0.

Extracting the greedy policy: at s1s_1, Move has higher backed-up value than Wait once V(s2)V(s_2) is large enough (this flips after sweep 1, exactly when the chance of reaching the high-value s2s_2 outweighs the wasted step) — so π∗(s1)=Move\pi^*(s_1) = \text{Move}. At s2s_2, Move is optimal from the very first sweep since the 0.9 chance of the +10 terminal reward dominates. This matches intuition: always push toward the goal, never wait, because waiting only accrues cost with no chance of progress. The example also illustrates why value iteration's early sweeps can recommend the wrong action (at sweep 1, s1s_1 was a tie) before enough backed-up information propagates from the reward source — a concrete instance of the γk\gamma^k convergence bound in action.

Common pitfalls & traps

PitfallWhy it happensFix
Forgetting γ<1\gamma < 1 for infinite-horizon tasks with no terminal stateReturn ∑γkRk\sum \gamma^k R_{k} diverges if γ=1\gamma = 1 and rewards don't vanishUse γ<1\gamma < 1, or ensure episodic termination with γ=1\gamma = 1 only when episodes are guaranteed finite
Confusing R(s,a)R(s,a) with R(s,a,s′)R(s,a,s')Some texts define reward as a function of the pre-state and action only, others include the next state; formulas differ subtlyFix one convention per problem and be consistent when writing Bellman equations
Treating a non-Markov observation as if it were the true statePartial observability (hidden state) breaks the recursive Bellman structure silentlyAugment state with sufficient history/summary statistics, or model explicitly as a POMDP
Assuming policy iteration must be run to full convergence of the inner evaluationModified/optimistic policy iteration (few evaluation sweeps) still converges and is often cheaperUnderstand this is a valid tradeoff, not a bug — it interpolates toward value iteration
Sign/max-min errors when converting cost to rewardMinimizing cost is equivalent to maximizing negative reward, but people flip signs inconsistently in Bellman updatesPick one sign convention (usually maximize reward) and check it end-to-end
Using a synchronous "sweep" update in place synchronously vs. in-place (asynchronous) without realizing they have different guaranteesIn-place (Gauss-Seidel style) updates can converge faster but are analyzed differentlyKnow which update rule you implemented and cite the matching convergence guarantee

Pioneers & history

Origins · 1 minRichard Ernest Bellman and how this was discovered
RE
Richard Ernest Bellman
1920–1984 · Mid-20th-century American mathematician at RAND Corporation

Bellman developed dynamic programming while working on multistage decision problems for the U.S. military and later industrial optimization. He introduced the principle of optimality — an optimal policy has the property that, whatever the initial decision, the remaining decisions must be optimal with respect to the state resulting from that decision — which is the conceptual seed of the equation that bears his name.

History
1950
s: Richard Bellman formalizes dynamic programming and the principle of optimality at RAND Corporation.
1957
Bellman publishes "Dynamic Programming," and Ronald Howard later develops policy iteration for Markov decision processes.
1960
Ronald A. Howard publishes "Dynamic Programming and Markov Processes," cementing MDPs as a standalone framework.
1988–1998
Sutton, Barto, and colleagues connect MDPs to temporal-difference learning and reinforcement learning as a field.
2010
s: Deep reinforcement learning combines MDP theory with neural function approximation for large-scale control (Atari, Go, robotics).

Where this matters

MDPs underlie the control loops of robotics research, where a robot's joint angles, velocities, and sensor readings form the state and torque commands the actions. Recommendation systems at scale — deciding which content to show a user next — are frequently modeled as MDPs to account for the long-term effect of a recommendation on future engagement, not just immediate clicks. Inventory management and supply-chain optimization use finite or infinite-horizon MDPs solved by dynamic programming or approximate variants when the state space is large. Operations research applications such as elevator scheduling, network routing, and revenue management were classical MDP successes well before deep learning existed. In modern AI, the MDP formalism (or its extension, the POMDP, for partial observability) is the object every reinforcement learning algorithm is implicitly trying to solve — including the algorithms used to fine-tune large language models via reward signals, where the "state" is the generated text so far and the "action" is the next token. Anywhere a system must choose actions sequentially under uncertainty, balancing immediate and future consequences, an MDP is the formal skeleton underneath the engineering solution.

Ask the tutor: How does the Bellman equation change when the reward depends only on (s,a)(s,a) instead of (s,a,s′)(s,a,s'), and why does it not affect the contraction argument?

What is the difference between an MDP and a Markov chain?

A Markov chain is a passive stochastic process: it has states and transition probabilities but no actions or rewards, so its future is fully determined by dynamics alone. An MDP adds a decision-maker — actions that influence the transition probabilities — and a reward signal that defines what "good" behavior means. Fixing a policy in an MDP (i.e., choosing an action-selection rule for every state) collapses it back into an ordinary Markov chain, since the action distribution at each state becomes fixed and only the state transitions remain stochastic. This is precisely why policy evaluation works: evaluating VπV^\pi is really just computing expected discounted rewards over the Markov chain induced by π\pi.

Do MDPs require finite state and action spaces?

No. The classical dynamic programming algorithms (policy iteration, value iteration) are most cleanly stated and analyzed for finite S\mathcal{S} and A\mathcal{A}, where sweeps over all states are computationally realizable. However, the MDP formalism itself extends to countably infinite and continuous state/action spaces, with the same Bellman equations holding in expectation form. In continuous settings exact dynamic programming becomes intractable (you cannot enumerate uncountably many states), which motivates function approximation, discretization, and sampling-based methods — the bridge from tabular reinforcement learning to deep reinforcement learning.

What happens if the discount factor γ equals 1?

With γ=1\gamma = 1, the return is simply the undiscounted sum of future rewards, Gt=∑k≥0Rt+k+1G_t = \sum_{k\ge 0} R_{t+k+1}. This is fine for episodic tasks that are guaranteed to terminate in finite time (so the sum has finitely many nonzero terms), and is in fact the natural choice there — many chess or game-playing formulations use γ=1\gamma = 1. For continuing tasks with no terminal state, an undiscounted sum of nonzero rewards diverges, making the value function undefined and breaking the contraction argument that guarantees convergence of dynamic programming. In continuing tasks you either need γ<1\gamma < 1 or must switch to an average-reward formulation instead of discounted return.

Why is the Bellman equation called a "fixed-point" equation rather than a formula?

Because V∗V^* appears on both sides of V∗(s)=max⁡a∑s′P(s′∣s,a)[R+γV∗(s′)]V^*(s) = \max_a \sum_{s'} P(s'|s,a)[R + \gamma V^*(s')], it cannot be evaluated directly the way you'd evaluate an explicit closed-form expression. Instead, V∗V^* is defined as the unique function that remains unchanged when the Bellman optimality operator TT is applied to it, i.e., TV∗=V∗TV^* = V^*. Algorithms like value iteration find this fixed point iteratively, starting from an arbitrary guess and repeatedly applying TT, relying on the contraction-mapping guarantee that this process converges to the one function satisfying the equation, regardless of the starting guess.

How is an MDP different from what an RL agent actually has access to?

The MDP itself specifies the true dynamics (P,R)(P, R) of the environment, which are assumed fully known when doing dynamic programming as described in this article. A reinforcement learning agent, by contrast, typically does not know PP or RR in advance and must learn a good policy purely from sampled interaction — observed states, actions, and rewards. This distinction is the boundary between planning (dynamic programming with a known model) and learning (model-free methods like Q-learning, or model-based methods that first estimate PP and RR from data). The MDP is the underlying problem definition in both cases; what differs is whether the solver is handed the model or must discover it.

What is the relationship between the state-value function V and the action-value function Q?

They are related by Vπ(s)=∑aπ(a∣s)Qπ(s,a)V^\pi(s) = \sum_a \pi(a|s) Q^\pi(s,a) — the state value is the action value averaged over the policy's action distribution. Conversely, Qπ(s,a)=∑s′P(s′∣s,a)[R(s,a,s′)+γVπ(s′)]Q^\pi(s,a) = \sum_{s'} P(s'|s,a)[R(s,a,s') + \gamma V^\pi(s')] — the action value is the immediate reward plus the discounted value of wherever that action leads. For the optimal policy, V∗(s)=max⁡aQ∗(s,a)V^*(s) = \max_a Q^*(s,a), and greedy action selection with respect to Q∗Q^* recovers an optimal policy directly, without needing the transition model — this is exactly what makes QQ-learning, a model-free method, possible. This relationship will be developed fully in Policies and Value Functions.

Why can't we just search over all possible action sequences instead of using Bellman equations?

Brute-force search over action sequences of length HH with mm actions costs O(mH)O(m^H), which explodes exponentially and becomes hopeless even for modest horizons. The Bellman equation exploits the Markov property and the principle of optimality to avoid this: the optimal choice at every state depends only on the current state, not on the sequence of actions that led there, so optimal sub-solutions can be reused across many different histories that happen to land on the same state. This is exactly what dynamic programming means — computing V∗(s)V^*(s) once per state and reusing it, rather than recomputing value for every distinct trajectory, turning an exponential search into a polynomial-time computation (per sweep) over the state space.

Before this

Where this leads