An arm gives rewards 4, 2, 9 in its first three pulls. Compute the estimate Q3 using (a) the sample-average update with step 1/n, and (b) a constant step size α=0.5 starting from Q0=0. Why would you prefer (b) when the arm's reward distribution drifts over time?

Reinforcement learning, Multi-armed bandits
Level L2 Elementary. Length Short. Nature Mat Mathematical.

What's being asked

Whether you can use the incremental update Qn+1=Qn+step (R−Qn) and understand that a constant step size weights recent rewards more.

Key idea

The update is Qn+1=Qn+αn(Rn−Qn). With αn=1/n it is the exact sample mean. With constant α it is an exponentially weighted average that forgets old rewards.

Steps

  1. (a) With step 1/n: Q1=4. Then Q2=4+12(2−4)=3. Then Q3=3+13(9−3)=5.
  2. Check (a) against the mean: (4+2+9)/3=5. It matches, so no reward history needs to be stored.
  3. (b) With α=0.5 and Q0=0: Q1=0+0.5(4−0)=2, Q2=2+0.5(2−2)=2, Q3=2+0.5(9−2)=5.5.
  4. Unroll (b): Q3=(1−α)3Q0+α(1−α)2R1+α(1−α)R2+αR3=0+0.125×4+0.25×2+0.5×9=5.5. The weights decay geometrically with age.
  5. Conclude: if the true mean drifts (a non-stationary bandit), the sample average gives old rewards the same weight as new ones, while the constant step size tracks the change.

Common mistakes

How long your answer should be

5–6 lines of arithmetic and one sentence of explanation.

Last checked on 4 December 2026.

Read this

Previous in Reinforcement learning: An agent has four actions with estimated values Q=(1,3,2,0) and uses ε-greedy with ε=0.2, where the random choice is uniform over all four actions. What is the probability of each action, and what is the expected estimated value of the chosen action?
Next in Reinforcement learning: In TD(0), the current estimate is V(s)=0.5. The agent moves from s to s′ with reward r=1, and V(s′)=2. With γ=0.9 and α=0.1, what are the TD target, the TD error and the updated V(s)?