Visual walkthrough — Generator and discriminator dynamics
Step 1 — What is a probability density curve?
WHAT. Before any GAN math, we need one picture: a density curve. Imagine every possible data point (say, a number on a horizontal line). Over that line we draw a curve. Where the curve is tall, data of that kind is common; where it is low, that kind of data is rare.
WHY this tool. GANs compare two populations of things — real samples and fake samples. To talk about "how common is this exact value in the real set vs the fake set" we need a height-at-each-point function. That is exactly a density. We call the real one and the fake one .
One thing that makes a density special. A density is not just any height function: the total area under its curve is exactly , That says "all the real data, taken together, is 100% of the real data" — the curve simply spreads that one whole unit of certainty across the axis. This normalization is why we may call these curves densities and read heights as relative commonness rather than arbitrary numbers.
PICTURE. Two bell-shaped humps on the same axis, each enclosing area . The blue hump = the real data. The orange hump = whatever the Generator currently spits out. The subscript just means "generated".

At each there are only two numbers that matter: the blue height and the orange height. Everything below flows from comparing them.
Step 2 — What the Discriminator is being asked
WHAT. The Discriminator is a function that eats a point and returns one number between 0 and 1. We read it as "the probability that this came from the real pile."
WHY between 0 and 1. A number you can honestly call a probability lives in : = "definitely fake", = "definitely real", = "no idea". Anything outside that range would not be interpretable as a chance.
PICTURE. A short green curve hovering between the floor (0) and ceiling (1). Its job is to sit high where blue dominates and low where orange dominates.

Recall
If , what is claiming about that point? ::: "There is a 90% chance this point came from the real data."
Step 3 — The scoring rule: reward for being confidently right
WHAT. We need to score the Discriminator so we know which is best. The GAN score at a single point is
WHY the . Look at the shape of : it is near 0 and climbs slowly toward 0 as its input approaches 1. So punishes hard when says "fake" ( near 0) about a real-heavy point, but gives only a gentle reward for being right. That asymmetry is the pressure that forces honesty. (This is the same binary cross-entropy you have met before, just written with a sign because we maximize instead of minimize.)
WHY two terms. The first term pays for shouting "real!" exactly where real mass () piles up. The second pays for shouting "fake!" where fake mass () piles up. Weighting each reward by the mass present means points nobody visits barely affect the score.
PICTURE. The curve from to , with the steep cliff near 0 marked in red.

Step 4 — Optimise each point on its own
WHAT. Here is the key liberation. Notice at one point appears only in that point's bracket — it does not tangle with at any other point. So maximizing the whole integral = maximizing each bracket separately. We drop the integral and stare at a single point.
WHY we're allowed. If I can make every individual bracket as big as possible, their sum is automatically as big as possible. No point's best choice hurts another's. This is why the problem, which looked infinite-dimensional, collapses to a one-variable puzzle.
PICTURE. Freeze one vertical slice at a chosen . Read off the two fixed heights there — call them (blue) and (orange). They are just numbers now. The only free knob is , sliding between 0 and 1.

Our one-point puzzle:
Step 5 — Find the top of the hill (the derivative tool)
WHAT. We want the that makes largest. The tool for "top of a smooth hill" is the derivative: it measures the slope. At the very top the slope is flat — zero.
WHY the derivative and not guessing. rises then falls (we'll confirm the shape), so its peak is the single spot where the tangent line is horizontal. Setting slope pins that spot exactly, no trial and error.
Differentiate term by term. The slope of is ; the slope of is (the minus from the inside shrinking as grows):
PICTURE. The hill over , its rounded peak marked, the flat tangent line drawn at the top, and the two competing "pulls" shown as opposing arrows.

Step 6 — Solve the balance equation
WHAT. Set the two pulls equal and untangle .
Cross-multiply (each side's top times the other side's bottom):
Divide by the total height :
WHY it makes sense. The best guess at a point is simply the blue share of the total height. If real mass is 3 units and fake mass is 1 unit, — "three out of four things here are real, so bet 0.75 on real." It is pure book-keeping of the two heights.
PICTURE. A stacked bar at : blue part on top of orange part ; a ruler shows the blue fraction equals the green dot .

Recall
Why does no other beat ? ::: Because everywhere, so the hill is strictly concave — one peak, and the flat-slope point is it.
Step 7 — The degenerate corners (the cases the parent skipped)
WHAT. The tidy formula assumed both and were positive. What if one is zero? These are real situations: a point the Generator never produces, or a region real data never visits.
- Only real mass here (): . The green curve pins to the ceiling — "if the Generator literally never makes this, any sighting is certainly real."
- Only fake mass here (): . Floor. "Real data never comes here, so it's certainly a fake."
- Empty region (): the point-score is for every . is undefined here and it does not matter — nobody, real or fake, ever lands here, so no score is at stake. We may set by convention.
WHY handle these. Near the tails of the humps the heights genuinely fall to (numerically) zero. Without these cases the reader hits a and panics; here we've shown it's harmless.
PICTURE. Three mini-panels: real-only tail (green glued to 1), fake-only tail (green glued to 0), and the flat "no-man's-land" gap where is a free-floating dashed line.

Step 8 — The equilibrium: when the Generator wins
WHAT. Now let the Generator succeed completely, so its curve matches real data: , i.e. orange lies exactly on blue. Plug in :
WHY this is the finish line. A flat means the best-possible Discriminator is reduced to a coin flip everywhere. It cannot do better than guessing — the two piles are indistinguishable. This is the Nash equilibrium of the two-player game and the goal of GAN training. (When the Generator instead cheats by matching only one hump, you get mode collapse; the fix in Wasserstein GAN changes the score in Step 3 to avoid the flat-gradient trap.)
PICTURE. Blue and orange humps perfectly overlapping into one purple curve; the green line collapsing to a dead-flat 0.5.

The one-picture summary

The whole derivation on one canvas: two density humps (blue real, orange fake); at any slice the green is just the blue fraction of the stacked heights; where they overlap, that fraction is .
Recall Feynman retelling (say it out loud)
Picture two overlapping hills of stuff — one hill is real data, one is the fakes, and each hill holds exactly one whole unit of stuff (area ). Pick any spot on the ground. Ask: of the stuff piled here, what fraction is real? That fraction — real height divided by (real + fake) height — is the smartest possible guess for "is this real?", and that guess is the optimal Discriminator, . Where only real stuff sits, the guess is 1; where only fakes sit, it's 0; where nobody sits, it doesn't matter. And when the Generator gets so good the fake hill lands exactly on the real hill, every spot is half real, half fake — the guess is 0.5 everywhere, a pure coin flip. That flatline is the moment the Generator has won.