Bellman comparison with nonnegative rewards and superunit discount Created 2026-10-06 Updated 2026-10-14
For nonnegative rewards, a nonnegative value satisfying the maximizing Bellman equation dominates every competing policy, even for . Iterate the one-step inequality, discard the nonnegative terminal value, then apply the monotone convergence theorem to the accumulated reward.
Bellman equation Created 2026-09-24 Updated 2026-10-14
A Bellman equation expresses the dynamic programming principle as a recurrence relation for a value function: optimize the current reward plus the best attainable continuation. Let be a dynamic programming state, the allowed actions at time , the immediate reward, and the next dynamic programming state. With terminal time and terminal reward , the deterministic finite-horizon Bellman equation is
Here measures total reward from time through the terminal reward. Start with and evaluate backwards; the terminal condition anchors the recurrence relation. For finite nonempty action sets, finite rewards, and finite terminal rewards, a maximum exists at each step. If an optimum need not be attained, use a supremum. A minimization problem instead uses a minimum or infimum. The 0-1 knapsack problem above is the same comparison between an immediate item value plus a continuation and the continuation after skipping. See Bertsekas, MIT lecture 2: the backwards recursion.
In a Markov decision process, the next dynamic programming state is random. If denotes the expected immediate reward and is a discount factor, the finite-horizon Bellman equation becomes
The conditional expectation averages over the next dynamic programming state before choosing the current action; that action cannot use a future outcome that has not yet been observed. For a finite state space with transition probabilities , the continuation term is . Taking gives the undiscounted finite-horizon problem. With a discount factor , rewards steps ahead carry a factor , including the terminal reward. A maximizing action for each specifies a Markov policy, which contains decisions rather than just optimal scores.
For an infinite horizon with a finite state space, finite nonempty action sets, time-independent transition probabilities, bounded rewards , and a discount factor , the optimal value function satisfies
In this setting the maximizing dynamic programming operator is a contraction mapping in the supremum norm, so the Banach fixed-point theorem gives a unique bounded fixed point and convergence of repeated application to it. See Bertsekas, MIT lecture 15: bounded discounted problems. These hypotheses matter: with one state, one action, zero reward, and , the Bellman equation is merely , so every finite constant is a fixed point, although the actual total-reward value function is zero. The average-reward Bellman equation and Hamilton-Jacobi-Bellman equation address other settings with their own conditions.
A backward scalar or matrix recurrence for the quadratic coefficients in a value function for a linear-quadratic optimal control problem. It results from completing the control square in the Bellman equation. Multiplicative noise modifies the quadratic coefficients through its second moments.
Dynamic programming Created 2026-09-24 Updated 2026-10-20
Dynamic programming solves a mathematical optimization problem by choosing reusable subproblems, recording their value functions, and combining already solved cases through a recurrence relation. Its attraction is that many possible decision histories can share one continuation calculation. A dynamic programming state must retain everything needed to determine the allowed future choices and their rewards. The 0-1 knapsack problem, for example, needs both the available capacity and which items remain available; capacity alone would lose the restriction that each item can be used at most once.
Two ideas explain when this works. Optimal substructure makes an optimal continuation valid inside a larger optimal solution. When subproblems overlap, storing each answer avoids repeated work: memoization computes entries as needed, while a table fills them in dependency order. Start from known base cases. For a problem indexed by increasing size, compute smaller cases first; for a finite sequence of future decisions, work backwards from the terminal reward, as in the Bellman equation. See Bertsekas, MIT lecture 2: optimality and state augmentation.
Consider a 0-1 knapsack problem with item weights , item values , and capacity . Define the value function to be the largest total item value obtainable from the first items with total weight at most . Here and specify the dynamic programming state. All weights and capacities are nonnegative integers. The empty selection supplies the base case . The recurrence relation is
The two candidates skip or take item . Both use the previous row, so taking item cannot take that same item again. The condition prevents a negative remaining capacity; no entry with is needed. The optimal substructure is concrete: after taking item , its companions must solve the smaller 0-1 knapsack problem on the first items with capacity . Otherwise replacing them by a better feasible selection would improve the whole selection. Compare [ref]; those notes index the remaining items in the opposite direction.
The full computation is small enough to see at once:
For example, and . Choosing the feasible item with largest individual value takes weight , earns , and leaves capacity , which cannot fit another item. This greedy algorithm misses the two-item selection of weights and , whose value is . This example tests the largest-individual-value rule; choosing by value divided by weight happens to find the optimum here.
Figure 1.
A knapsack table builds the optimal value from smaller subproblems
. The value function of this 0-1 knapsack problem is computed row by row. Outlined entries show the reconstruction of an optimal selection: skip weight 4, take weight 3, then take weight 2. The total weight is 5 and total value is 7. Details.
The number is the optimal value, while the choices attaining it form a control policy. To reconstruct one optimal selection, start at . Equality with allows skipping item . At , taking item gives , so continue to . Take item and finish at . In a tie, either maximizing choice suffices to recover one optimum. Recording choices during the calculation or comparing stored entries afterwards recovers the control policy; a final optimal value alone does not describe the selection.
Figure 2.
Knapsack dependencies and one optimal reconstruction
. Each node is a dynamic programming state labeled by its value function. Arrows point to the earlier-row entries used in the recurrence relation, forming a Directed acyclic graph. Dashed arrows skip an item; blue arrows take it. The orange graph path reconstructs the optimal selection with value 7. Compute in the opposite direction to the arrows, beginning at the zero base row. Details.
For items and integer capacity , the table uses time complexity and space complexity , counting arithmetic operations and stored numbers using Big O notation. This is pseudo-polynomial time: when weights and capacity use the binary numeral system, the capacity needs only digits. A capacity near creates about columns despite needing only about digits. Thus this algorithm is practical for moderate capacities but does not establish polynomial time in the encoded input length. See MIT 6.006 recitation 19: knapsack and input size. For the optimal value alone, one array reduces space complexity to : for each item, update capacities in descending order, from down to . Ascending order would read entries already updated for that item and could reuse it. Reconstruction then requires extra information or recomputation.
The link between the knapsack problem and dynamic programming is already explicit in a 1957 paper by Richard Bellman at RAND: its abstract discusses an exact knapsack problem solution using functional equations and cites his 1957 book. See Bellman, Comment on Dantzig's Paper on Discrete Variable Extremum Problems (1957).
Dynamic programming operator Created 2026-10-14 Updated 2026-10-25
This one-step operator combines immediate cost with optimized discounted continuation. It is monotone. For nonnegative costs, iterating it from zero produces increasing finite-horizon values bounded above by the infinite-horizon value. If a nonnegative fixed point has a minimizing measurable selector, repeated conditional expectation and dropping the nonnegative terminal value show that the corresponding stationary policy costs no more than that fixed point. Thus the infinite-horizon value, when the Bellman equation holds, is the least nonnegative fixed point.
Dynamic programming state Created 2026-10-14 Updated 2026-10-20
A dynamic programming state is an element of a state space that summarizes all information needed for a remaining mathematical optimization problem. Histories can share a value function entry only when their allowed continuations and future rewards agree, or have the same conditional laws in a stochastic control problem. Time or the remaining item index may be part of the summary. If past decisions still affect feasibility or rewards, enlarge the dynamic programming state; forgetting those effects invalidates the Bellman equation.
Hamilton-Jacobi-Bellman equation Created 2026-10-03 Updated 2026-10-07
The Hamilton--Jacobi--Bellman equation is the continuous-time Bellman equation. For state dynamics , running cost and terminal cost , a smooth value function satisfies
Markov decision process Created 2026-10-14 Updated 2026-10-20
A Markov decision process specifies states, admissible actions, action-dependent transition probabilities and rewards. A policy chooses actions from observed information; a time-homogeneous problem uses transition and reward rules independent of the date. A Bellman equation optimizes current reward plus the conditional value of subsequent decisions. For nonnegative rewards, finite-horizon values increase as the horizon grows, while identification of their limit with the infinite-horizon value requires an approximation argument for admissible policies.
Temporal-difference learning uses sampled reward-plus-continuation predictions to approach a Bellman expectation equation. Policy evaluation must be distinguished from finding an optimal policy. Consider a finite Markov decision process, a fixed policy , bounded rewards and discount . Define
Separating the first reward from the remaining return gives
Here is expected immediate reward and is the transition matrix under the fixed policy. In matrix form, . The inverse exists because the geometric series converges in the supremum norm.
Define the Bellman expectation operator . A stochastic matrix averages component differences, so
The Banach fixed-point theorem gives a unique fixed point and convergence of exact repeated backups. This establishes why the equation has a well-defined solution in the stated discounted setting; it does not require the intelligent agent to know its transition matrix.
The model-free alternative observes and forms
Other tabular entries remain unchanged. Under the same policy and Markov assumptions, conditioning on the current value estimates gives
Thus the sample error has the correct mean direction for correcting the current Bellman mismatch. The defining idea is bootstrapping: a later prediction supplies part of the earlier prediction's target, so learning need not wait for a final outcome.[ref]
In tabular temporal-difference policy evaluation, convergence requires appropriate sampling and step sizes, not merely writing the update. Standard sufficient conditions include bounded rewards, infinitely many visits to each relevant state and, along visits to each state, with . Diminishing steps allow continuing correction while limiting accumulated sampling noise. Constant steps generally track a noisy estimate instead of converging exactly. The target's dependence on the present values also means that this is not ordinary gradient descent on an independent, fixed supervised label. These tabular guarantees should not be transferred automatically to nonlinear function approximation or off-policy training.
For an exact illustrative problem, alternate deterministically between states and , receive reward on leaving and on leaving , and take . Then
Starting from zero with step size , the first transition updates to ; the next updates to . At the exact solution, both transition errors are zero. These values are a model calculation, not neural measurements.
This solves evaluation of the specified policy. The optimal Bellman equation instead maximizes over possible actions. An intelligent agent can combine policy evaluation with policy iteration or an actor-critic improvement mechanism. Estimating the value of a poor fixed policy does not by itself make that policy optimal. Episodic tasks use terminal-state value zero; undiscounted continuing tasks require additional conditions or a different formulation.
A proposed neural implementation uses a representation of the situation to drive a value-predicting population, with a reward prediction error modulating recently active synapses. An eligibility trace can preserve a record of prior activity so delayed errors influence earlier states. Temporal representation is indispensable: if the population does not distinguish when a reward is expected, it cannot generate the appropriate omission signal at that time.
Primate recordings during acquisition of successive delayed-response tasks found that dopamine-neuron reward responses were more prominent during learning than after performance was established, while significant cues elicited phasic responses. This supports prediction-sensitive signalling but also allows attentional and motivational contributions.[ref] The temporal-difference interpretation explains how a reward response can diminish as reward becomes predicted and a response can develop at an informative cue; a worse-than-expected omission gives a negative error. The physiological interpretation is a quantitative hypothesis, not an identification of every dopamine signal with a single critic variable.[ref]
Causal evidence comes from reward-timed stimulation of dopamine neurons in rat blocking and extinction tasks. Artificial activation, intended to supply a positive prediction-error-like event, increased subsequent cue-driven reward seeking. This strengthens the teaching-signal interpretation beyond response correlation. It does not show that all components of the Bellman computation reside in dopamine neurons or that the entire algorithm is unique.[ref]
The mathematical bridge is precise: the mean TD error is the sampled Bellman mismatch, and appropriate repeated updates solve tabular policy evaluation. Neural evidence supports prediction-sensitive plasticity signals, while state representation, timing, function approximation and action improvement remain distinct parts of the implementation.
Let represent the information at decision time and conditional expectation given it. is the largest conditional expected utility from the remaining consumption opportunities with current wealth ; it may depend on the information state as well as . The controls and are chosen using current information. In the usual allocation interpretation and , and next wealth is . Other borrowing/short-selling rules require explicitly replacing this admissible set while preserving solvency.
The Bellman equation follows by separating current utility from future utility: after any current decision the best continuation has conditional value , and maximizing over the current admissible decisions gives the stated recursion. At the last opportunity all wealth is consumed, because utility is increasing, giving .
There are two printed qualifications. Strict convexity is not needed for this recursion, but it conflicts with the concave power utility in part (ii) and does not support the interior maximizing first-order conditions in part (iii). Also the displayed recursion starting at includes consumption at times , whereas the preceding sum starts at one. The same recursion represents that sum when begun at time one; alternatively relabel the consumption dates. Below the policy is given for the recursion's remaining horizon, so this indexing discrepancy does not leave the optimization unspecified.
The standard positive-cost interpretation requires and . These signs are not printed. Without them the claim of a unique positive fixed point is false: gives , with no positive fixed point. The following derivation gives the intended result under those cost assumptions; may be any finite constant.
Let be the value with stages remaining. Starting from , the Bellman equation is
If , the minimized expression is a quadratic in with positive leading coefficient . Its derivative vanishes at , and completing the square gives
Induction establishes the value form and the control . Only zero mean and variance of the independent noise were needed.
The Riccati recurrence fixed-point equation becomes
The product of its roots is , so exactly one is positive:
For , , while is positive below and negative above it. Monotonicity of prevents overshooting the fixed point. Thus increases to if , decreases to it if , and is constant if . Continuity identifies the limit uniquely.
Iteration of the second recurrence gives . Subtract the same expression with every replaced by . The early finite part vanishes geometrically, and the later part is bounded by times the fixed factor. Taking , then , proves
The average-cost Bellman equation is
If a constant and bounded relative cost function solve this equation and a stationary control attains the infimum in each state, that control is optimal and its long-run expected average cost is . Indeed the Bellman inequality telescopes along any controlled trajectory; dividing by the number of steps removes the bounded endpoint terms and gives a lower bound . The attaining policy makes the inequalities equalities. An unbounded requires the corresponding endpoint/transversality justification, which the question permits for this example.
To maximize occupation of zero, minimize and try with . For , the expected increment of is , minimized at ; for , it is , minimized at . At zero its expected next value is , independent of . Thus away from zero and at zero. Solving gives
An optimal control always biases a nonzero position towards zero: on positive integers, on negative integers, and any allowed at zero.
As an independent occupation check, fix the choice at zero. The stationary positive tail begins at and has common ratio ; the negative tail begins at with the same ratio. Summing these geometric tails gives , reproducing the boxed optimum. The chain has period two, but its time-averaged occupation still converges to this stationary proportion.
Completing the square gives
Since is positive-definite, the unique minimizer is and the minimum is .
The Bellman equation is and
Suppose , where . Zero noise mean gives the expected quadratic . Complete the square again, with and . This yields the discrete Riccati recurrence
The matrices are positive definite. The minimum of the nonnegative stage-plus-future quadratic is nonnegative, so each is symmetric positive semidefinite. Starting from , the constants obey
Induction proves , with optimal feedback control .
Assume the riskless gross return , as required by the positive-wealth model, and a finite moment . Define
This maximum exists: the control interval is compact and dominated convergence gives continuity, using the integrable bound for .
The terminal value is . If , the Bellman equation and independence of the next return give
Backward induction therefore proves
Any maximizing proportion can be used each day; allowing adapted choices cannot exceed the Bellman bound. For , , exactly agreeing with part (b). If and at least one day remains, the allowed choice already gives infinite expected utility, so the value is infinite rather than a finite coefficient. This is the necessary moment qualification to the finite optimization formula.
Put . The Bellman equation is . For the quadratic candidate , the quantity minimized is
For , completing the square gives . Matching the and constant terms requires
The first equation is . Its admissible nonnegative root is , and . Hence .
A suitable discounted verification theorem is: if a nonnegative candidate satisfies the Bellman equation, a stationary minimizing selector has finite cost and its discounted expected terminal candidate tends to zero, and the same terminal limit holds for every finite-cost competing policy, then that selector is optimal and the candidate is the value function. Iterating the Bellman inequality proves the lower bound for each competing cost; iterating equality along the selector proves attainment. Here finite cost implies , so . Under the selector , the second moments are bounded by a geometric recursion, giving finite cost and the same terminal limit. Thus . Infinite-cost policies cannot improve the value.
For , the two coordinates decouple and have the same discount, so . The total value is .
For , the discount is and the state cost is . Introduce the orthogonal transformation , , with controls , . The cost becomes . Each transformed noise has mean zero and variance one; they need not be independent unless the original noises are Gaussian, and no such independence is needed here. The unpenalized difference coordinate has optimal control . For the sum coordinate, the quadratic coefficient solves
so , , and the constant is . Therefore
The sum state is mean-square stable under this feedback; the uncontrolled difference state may wander, but its value function and state cost are both zero. The same verification argument applies to the penalized sum coordinate.
A control policy specifies each control as a nonanticipating measurable function of the observed history, possibly with additional randomization. It may depend on time and the entire past; a stationary Markov policy uses only the current state. We use the standard admissibility assumptions allowing measurable choices and concatenation of continuation policies.
The dynamic programming operator is monotone: implies . Nonnegative costs give , so induction gives . Thus increases pointwise to an extended nonnegative limit . Backward induction identifies with the infimum of expected costs for the first periods: condition on the first control and next state, then optimize the continuation. Every infinite-horizon policy has at least that finite-horizon cost, so
For the Bellman equation, any infinite-horizon policy, conditional on its first action and next state, has continuation cost at least . Its total cost is therefore at least ; infimizing gives . For the reverse inequality at a state with finite , choose a first action within of its infimum and concatenate continuation policies whose costs are within of at each next state . This produces a policy of cost at most . Such continuations are needed only at states of finite value, which have probability one under an action with finite continuation expectation. Let . If , the first inequality already gives . Therefore
Let , and use the permitted selector . Under the stationary policy , repeated conditional expectation gives
If is infinite the desired comparison is immediate; otherwise these nonnegative quantities have finite expectations and the displayed recursion is legitimate. Drop the terminal term and apply monotone convergence theorem as . The policy's infinite-horizon cost is at most , so
Thus the value is the least nonnegative Bellman fixed point. The argument works also for because costs and the dropped terminal term are nonnegative; it makes no unwarranted contraction or finite-value assumption.
The stage cost is . The finite-horizon Bellman equation is
Inductively write . Completing the square in gives the unique optimal first control
and
For , the recurrence map satisfies and
Thus increases and is bounded above by two. Its limit solves , or ; nonnegativity forces . In particular , and indeed this recurrence already identifies the limit.
For the proposed policy, induction on the state equation gives and . The stage cost is , so the infinite geometric series gives
This supplies an admissible policy attaining the lower bound:
The last formula is the requested closed-loop control: it uses the observed current state rather than an initial-state schedule.
Write . The Bellman equation implies for every available action. Under any competing policy, repeated conditioning gives
The last inequality uses . The monotone convergence theorem now gives , even when . If the comparison is immediate; otherwise the nonnegative conditional bounds justify each finite induction step. This proves Bellman comparison with nonnegative rewards and superunit discount without a vanishing-terminal-term assumption.
For the unit-bet policy in this gambler's ruin problem, put . The value satisfies
The characteristic equation has the repeated root , so . The boundary values give
To justify that this finite recurrence solution is the expected reward despite , let be the transition matrix on transient states . The matrix is diagonally similar, with diagonal factors , to the symmetric tridiagonal matrix with off-diagonal entries . Its eigenvalues are , , with absolute value below one. Thus its Neumann series converges and yields exactly the absorbed-payoff expectation and the unique recurrence solution.
When , at wealth bet once and then follow the unit-bet policy. Its expected value is , since . Therefore the unit-bet policy is not optimal.
Treat the white noise as innovations with conditional mean zero and conditional second moment , independent of the chosen past control. This is the convention needed for the dynamic programming calculation. The printed stage cost is , not one-half of both terms.
With terminal value , induction in the Bellman equation gives
If , completing the square yields
Thus for every horizon, in particular . The same completion gives the average-cost Bellman equation solution , up to an additive constant in .
For every policy in , conditional second moments satisfy . Iterating gives
The Bellman inequality implies . Dividing by and using the bound proves that every admissible policy has lower limiting average cost at least , even if its ordinary limit does not exist. The feedback belongs to because . It makes the Bellman inequality an equality, and its bounded terminal second moment proves its average cost tends to . Therefore it is optimal over .
Merely uncorrelated noise with the displayed unconditional moments would not ensure the conditional identities for arbitrary adapted controls. The innovation interpretation specifies the hypothesis used in the calculation.
Assume , a positive integer , decisions based only on already observed returns, and . The last is a sufficient well-posedness condition absent from the print; without moment assumptions the objectives may be infinite. Put . Multiplication by and subtraction of do not change the optimizer, so maximize subject to .
The Bellman equation for the value function is
The expectation uses a fresh independent return, since the action is chosen before it is observed. Zero wealth remains zero.