A terminal-state penalty can change the first command in a finite-horizon control calculation, even when the physical update law stays fixed. The reason is visible in a two-step problem: an early action changes the state from which every remaining cost will be paid. Working backward provides that future price before the trajectory is propagated forward. This article derives a small, entirely invented scalar example for robotics modeling; its numbers are dimensionless teaching inputs rather than measured actuator settings.

Define the horizon before choosing the gain

Let x denote one modeled state and u one unconstrained control input. At steps k=0 and k=1, impose x_(k+1)=2x_k+u_k. Begin at x_0=7 and stop after x_2. Score the trajectory with J=x_0²+u_0²+x_1²+u_1²+2x_2². There is no input at step 2. The coefficient 2 on the final state is a soft penalty: paying for a nonzero endpoint remains allowed. Nothing in this definition requires x_2 to equal zero.

For this specified problem, the two unknown inputs are real numbers without bounds. The stage weights on state and input both equal 1. Fixing these assumptions matters because adding a command limit changes the optimization. A hardware interpretation would also require dimensional scaling for state, command, and their weights. Here, the positive input-square term makes each backward minimization strictly convex, so its chosen input is unique.

Price the last remaining decision first

Write the minimum remaining cost as V_k(x)=P_k x². With no decisions left, V_2(x)=2x², hence P_2=2. At step 1 the quantity to minimize is x²+u²+2(2x+u)². Expanding gives 9x²+8xu+3u². Completing the square changes this to (11/3)x²+3(u+4x/3)². Therefore the last optimal command is u=-(4/3)x, and the remaining value coefficient is P_1=11/3.

That coefficient includes more than the next state's immediate square. For any state supplied at step 1, it prices the best attainable combination of the step 1 state cost, the step 1 command cost, and the terminal state cost. At x_1=3, its value is 33. Direct evaluation will shortly recover exactly the same number, giving a useful independent check on both the algebra and the horizon indexing.

Carry that value back one more step

At step 0, minimize x²+u²+(11/3)(2x+u)². The coefficient of u² is 14/3. The minimizing gain is K_0=11/7 under the convention u=-Kx. Substitution gives P_0=29/7. The full expression equals (29/7)x²+(14/3)(u+11x/7)². Since the square cannot be negative, this identity certifies the global minimum for that step without searching a grid of trial commands.

The corresponding scalar formulas for a general update x_next=ax+bu, stage weights q and r, and next value P are K=abP/(r+b²P) and P_current=q+a²P-a²b²P²/(r+b²P). They apply here with a=2,b=1,q=r=1. The recursion starts with the terminal weight and moves backward; state propagation then runs forward. Mixing those two directions can accidentally attach P_k to the wrong command.

Reconstruct the trajectory and its ledger

Use the first gain at x_0=7: u_0=-(11/7)7=-11. The next state is x_1=14-11=3. Now use the second gain, obtaining u_1=-(4/3)3=-4 and x_2=6-4=2. The five cost contributions are 49,121,9,16,8. Their total is 203. The value-function check yields P_0 x_0²=(29/7)49=203. The final three entries sum to 33, agreeing with P_1 x_1²=(11/3)9.

This optimum leaves a terminal state of 2 because zero terminal error has a competing command cost. Forcing x_2=0 would define another problem. Likewise, the command magnitudes 11 and 4 do not establish anything about a real motor's available torque, voltage, or travel. They are meaningful only inside this declared nondimensional model.

Change only the ending price

Remove the terminal penalty while retaining both stage costs and both updates. Then P_2=0, K_1=0, P_1=1, K_0=1, and P_0=3. From the same initial state 7, the optimal commands become -7 and 0. The states become 7 and 14 after the two updates, and the revised cost is 49+49+49=147. That 147 must not be compared with 203 as if the scoring rule were unchanged: the former deliberately ignores the endpoint.

Evaluated under the original terminal-weight 2 objective, the revised trajectory costs 147+2(14²)=539. This calculation isolates the effect of the terminal term. An apparently reasonable last-step command of zero is optimal for one declared objective and expensive for the other. The distinction is about the future cost represented in the gain, rather than an arbitrary preference for more aggressive control.

What the finite horizon does not promise

The two computed gains differ despite constant dynamics and stage weights. Remaining time and terminal conditions are enough to produce time-dependent feedback. A two-step optimum alone does not prove stability for an indefinitely continued controller. Reapplying a moving horizon, choosing a terminal controller, introducing disturbances, or estimating an unobserved state each adds assumptions absent here. None follows automatically from this cost ledger.

For a reproducible analytical check, retain the update, horizon, terminal coefficient, sign convention, backward values, forward states, and every scored term together. Then changing a weight produces an auditable new calculation. Stanford's discrete formulation supplies the general reference; MIT's finite-horizon discussion explains the terminal-boundary perspective. The particular scalar trajectory and square-completion checks above were constructed independently for this article.

There is also a trajectory-wide error certificate. For any trial inputs starting at 7, the original cost equals 203+(14/3)(u_0+11)²+3(u_1+4x_1/3)², with x_1=14+u_0. The intermediate value terms cancel when the two completed squares are added. For example, choose u_0=-10 and then the optimal last input u_1=-16/3. The second square vanishes but the first contributes 14/3, giving J=623/3. Directly summing 49+100+16+256/9+128/9 gives the same result. This shows exactly how an early deviation can incur excess cost even when the remaining command is optimized afterward.

Sources checked October 24, 2026:

https://ee363.stanford.edu/archive/lectures/dlqr.pdf

https://underactuated.mit.edu/lqr.html

Concept illustration: A motor and coupled shaft on industrial equipment provide robotics context for this analytical model. The image does not depict the article's numerical example, a verified experiment, a product specification, or deployment evidence.