Visual walkthrough — Discount factor and returns
We are going to answer one question, slowly and visually:
"An agent will collect rewards forever. How do we turn that endless list into one number that says how good the future is — and why doesn't that number explode to infinity?"
Step 1 — Draw the reward timeline
WHAT. Picture a horizontal track. The agent sits at time step . It acts, and one step later a reward lands. The very first reward is written — the little subscript just means "the reward that arrives after the action at time ". The next is , then , and so on with no end.
WHY. Before we add anything up, we need to see the objects we are adding. Each reward is a box sitting on the timeline. The whole page is about combining these boxes into one number.
PICTURE. Look at the amber boxes below — they march off to the right forever.

Step 2 — Why we can't just add them all
WHAT. Suppose we tried the naive thing: total future reward . If each reward is, say, and there are infinitely many, the sum grows past any number you name.
WHY. A quantity that equals is useless for comparing plans — every plan scores infinity, so no plan is better than another. We need a rule that makes the pile finite without throwing information away. That rule is discounting.
PICTURE. The staircase below climbs forever — that is the naive sum, and it never levels off.

Step 3 — Introduce the shrink factor
WHAT. We attach a number (Greek "gamma"), chosen between and , to the future. The reward steps out is multiplied by used times, i.e. by :
Read the annotations right under each term: the first reward is untouched (), the next is shrunk once, the next shrunk twice, and so on.
WHY and not some other shrink? Because we want every extra step of waiting to cost the same fraction. "Wait one more step ⇒ multiply by once more" is the simplest fair rule, and — crucially — it makes the sum a geometric series, the one infinite sum we know how to collapse (see Geometric series). Any other decay would break that clean trick.
PICTURE. The boxes now shrink as you go right; the tall infinite staircase becomes a curve that flattens.

Step 4 — Sum the weights: the geometric-series trick
WHAT. Assume for a moment every reward equals . Then the return is just the sum of the weights — call that sum . In plain words, is the total of all the shrink factors added together: Now that has a name and a meaning, multiply the whole line by and line the two rows up:
Subtract the second row from the first. Everything in the tail cancels and only the lonely survives:
WHY this move? Shifting by one step and subtracting is the only algebra where an infinite tail annihilates itself. It works only because , which forces so the far tail truly vanishes.
PICTURE. The figure shows the two shifted staircases; the shaded overlap is the part that cancels, leaving a single block of height over a base of .

Step 5 — Bound a real return with worst-case rewards
WHAT. Real rewards aren't all ; they wobble. Suppose they never exceed in size, i.e. . Then
Read left to right: first the absolute value slides inside the sum. The rule that lets us do this is the triangle inequality: the size of a sum is never bigger than the sum of the sizes, (adding numbers with mixed signs can only make things cancel, never grow larger than adding their magnitudes). Since each is positive, , so the stay outside. Then each is pushed up to its worst case , and finally Step 4 collapses the weights.
WHY. This is the payoff of the whole page: no matter how nasty the reward stream, the return is trapped below . A trapped number is a finite number — the problem from Step 2 is cured.
PICTURE. The jagged real rewards are all capped by a flat ceiling; the discounted-and-capped area is finite.

Step 6 — Peel one box off: the recursive form
WHAT. Take the definition and factor a single out of everything past the first term:
The bracket is exactly the return starting one step later — that's the definition of . So the return talks about itself.
WHY. This turns an infinite sum into a two-piece rule: "immediate reward, plus a discounted copy of the same problem shifted forward." That self-reference is the seed of every Bellman equation — see Value functions and Bellman equations and Temporal Difference learning.
PICTURE. The first amber box is snipped off; everything to its right is boxed as "the same problem, one step later, shrunk by ".

Step 7 — Every edge case, drawn
WHAT. The formula must survive extremes. Four dials:
- → myopic. Every for is ; only survives. .
- → far-sighted. Weights barely shrink; the ceiling blows up. Safe only in guaranteed-to-end (episodic) tasks.
- Negative future rewards. never changes a reward's sign — it only scales its magnitude. So if the future holds penalties, each penalty is shrunk toward zero, but it stays negative; a bigger shrinks it less, so more of the penalty survives and the return becomes more negative, not larger. scales the size of what's there, good or bad.
- Terminal step / episode ends. Say the last reward arrives at step . After it there is nothing to collect, so the return from that final step onward is . That is the seed value the recursion in Step 6 needs to start counting backwards.
WHY. A reader who meets any of these in the wild must already have seen it. Each corner behaves differently, so each gets drawn.
PICTURE. Four mini-panels: flat-after-first (), barely-decaying (), a stream with negative boxes, and a stream that stops at a wall.

Step 8 — Two worked returns, verified visually
WHAT. Plug numbers in.
WHY. One example exercises the closed form (Step 4), the other exercises the recursion (Step 6) with the terminal zero (Step 7). Getting the same two ways is the whole derivation checking itself.
PICTURE. Left: the discounted boxes summing to the dashed line at . Right: the three boxes and their discounted heights adding to .

The one-picture summary
Everything above, compressed: an infinite row of rewards, each shrunk by one more factor of , whose total area is provably capped by — and which folds into itself as .

Recall Feynman retelling — say it out loud
The agent stands at "now" and stares at an endless line of reward boxes stretching into the future. If it valued them all equally the line would be infinitely tall and useless. So it distrusts distance: each step further off, it multiplies the box by , a number a bit under . Far boxes shrink toward nothing. Because the shrink is the same fraction each step, the whole infinite line is a geometric series — shift it by one, subtract, and the endless tail eats itself, leaving . Cap every reward at and the total is trapped under : finite. Finally, snip off the first box and notice the rest is the same picture, one step later, shrunk once — so , the recursion that grows up into every Bellman equation.
Recall Quick self-check
Why must for the tail to cancel? ::: Because only when ; otherwise the far tail never vanishes and the subtraction leaves an infinite leftover. What is if ? ::: Just — every later term is multiplied by . What terminal value does the recursion need to start? ::: after the final reward.
Related: Markov Decision Process · Reward hypothesis · Geometric series · 5.1.06 Discount factor and returns (Hinglish)