◈ probability mapProb · Ch 13/16
Probability from the coin flip up · chapter 13

13Reshaping a Random Variable

Twice in the last chapter we got a density by differentiating a survival curve, and we never once substituted anything into a formula. Do that once and it looks like a trick that got lucky. Do it twice and it is a method that nobody has named yet. This chapter names it, and then turns it into the only machine you will ever need for this job. Here is the question, asked out loud for the first time in this book. You have a random variable X and you know its density. You build a new variable out of it, Y = g(X) — square it, scale it, shift it, flip it. What is the density of Y? Your instinct has an answer ready, and your instinct is wrong, in a way that is genuinely worth your attention. We are going to break it twice. The crude break takes one line. The second break is the one that matters, because the answer you reach for next passes every test you own and is still wrong. That is the honest position you are in, and it is what makes the machine welcome instead of imposed. The fix routes through the CDF, and the chain rule then hands you a factor called the Jacobian. Nobody bolted it on for tidiness. It is an exchange rate between an inch of y and an inch of x, and you have been computing exchange rates like it since you were ten years old, under the name converting units. By the end, three things you were taught as separate rituals will have collapsed into one sentence: standardizing is this machine at one setting, chi-squared is this machine turned twice, and the reason a wider bell must be a shorter one is a theorem about every density there is.

01The move you keep making by hand

You have already done this twice, and nobody has ever shown you the general rule. In Chapter 10 you took a normal variable, subtracted its mean, divided by its SD, and read the answer off Φ. That was a transform. In Chapter 12 you took a survival curve, differentiated it, and got a density out, and that was a transform too. Both times you did it by hand, one specific case at a time, and both times it worked. So here is what's strange. Given a density for X, and given any function g, what is the density of Y = g(X)? Nobody ever asks it, so look at the moves you already own and see the shape of the hole.

Ch10 · standardize Ch12 · survival→density Ch12 · min of 3 clocks Ch13 · g(x) = x² click a row below to replay it
click a row — replay that move
moves made: 0 · general machines: 0
AHA: three renames, zero general rule.
What you're looking at — the same question, four different names
green tick = a move you already ran, by hand
gold = the specific g inside that move's Y = g(X)
dashed row 4 = Ch13's version of the same question

Rows 1–3 are moves you already made — Ch10's z-map, Ch12's survival-to-density slope, Ch12's minimum of three clocks. Click each: it replays, then renames itself Y = g(X) with that move's g lit gold. The "general rule" column never fills — you solved every g by hand, one at a time. Row 4 is g(x) = x², due this chapter. Click it: nothing reveals, it only shakes. That empty row is why Chapter 13 exists.

Fig. 1. A ledger of every reshaping move you've made so far. Click rows 1–3 to replay Ch10's standardize, Ch12's survival-to-density slope, and Ch12's minimum of three clocks — each renames itself Y = g(X) with a different g, and the "general rule" column stays "— none —" because you solved every one by hand. Row 4, g(x) = x², is Chapter 13's question — click it and it only shakes.

Every row on that ledger is the same question with a different g. The z-map is g(x) = (x−μ)/σ. The Chapter 12 move is g hiding inside a derivative. And the empty row at the bottom, g(x) = x², is the one you have no method for at all. Before we build the method, I have to take you back and fix something that has been quietly rotting since Chapter 8. It is the real disease in this chapter, and every error we are about to make is a symptom of it.

Somewhere in the last three chapters a definition quietly went missing. Chapter 8 told you that a random variable is a function. Not a curve, but a function from outcomes to numbers, written X : Ω → ℝ, and that was the whole definition. Then Chapters 10, 11 and 12 taught you to say "X is normal" and "T is exponential" while pointing at a picture. X stopped being a function and became its own density. So when I write Y = X², your model permits exactly one move: square the picture. That's not carelessness. It is the only move that mental model has. So let's go back to the outcomes and look at what g actually touches.

x 1 2 3 4 5 6 y 1 4 9 16 25 36 Ω P X g which one can g reach?
click a die — watch it travel
Y = g∘X · same Ω · same P · new labels ⇒ mass conserved
Ω (left) is the raw outcomes — six die faces. X just reads off a NUMBER for each one; that number is all g ever sees
g is a function of NUMBERS, not events — try making it touch Ω, P, or which ω happens and it bounces; only the axis LABEL is fair game
hide the arrows and you're left staring at the bare x/y grid Ch10–12 called "X is normal" — with no Ω anywhere left to square
Fig. 2. Click any die to send it ω→X→g→Y; then try the four "did g touch this?" toggles — only LABEL lands, the rest bounce off red. Hide the arrows and the x/y grid you've been calling "X is normal" turns out to have no Ω behind it at all.

Here is the answer before the picture: g touches the label, and nothing else. There is Ω on the left, a rack of real outcomes, and that is where all the randomness in this room lives. One arrow, X, sends each outcome to a number. Now add a second arrow, g, from that number to another number, and drag an outcome: it travels the whole way in one motion. Now check what that second arrow changed. Not Ω. Not P. Not which outcome actually happens. Only the number on the axis. The randomness sits upstream of g and is completely indifferent to it. So Y = g(X) is the composition g∘X, and a function of a function is still a function on the same domain. It is a random variable on the identical Ω with the identical P: nothing was re-randomised, and the experiment was never re-run. All we did was re-rule the axis, and that is why the mass cannot go anywhere. Hold onto that, because it is the load-bearing wall of the whole chapter.

02Two wrong answers, one of them invisible

Now let's break it, and the crudest break comes first, so that we can throw that one away fast. Put the standard bell on screen with a live area readout, and square it, exactly the way your eroded model wanted to.

0 AREA 1.000 +0.000
p = 1.00 · φ(x)^1.00
VALID DENSITY — AREA = 1
∫φ(x)²dx = 1/(2√π) ≈ 0.282
What you're looking at — squaring φ makes a shorter, narrower curve, never a valid density
dashed ghost = the untouched φ(x); its area is exactly 1, always
shaded curve = φ(x) raised to the dial's power p, live
green → red the instant the shaded area drifts off 1.000

φ's height isn't free — it's pinned so the curve encloses area 1. Squaring reshapes the curve without repaying that area, so feeding g straight to the density stops describing a random variable long before you reach φ².

Fig. 3. The dashed curve is φ(x): area exactly 1, always. Drag the power dial and the shaded curve rides that same power — it comes out shorter and narrower, never taller, so the shaded area you're watching visibly shrinks: 1.000 → 0.51 → 0.282. The instant it leaves the tolerance band around 1 the readout turns red and the verdict flips to NOT A DISTRIBUTION. That's why you can't feed g the density directly: its height isn't a free knob, it's pinned by area = 1.

Square the bell and the area readout slides off 1 and lands on 0.282. Look at what's on the screen: still bell-shaped, still positive, still symmetric, and not a distribution at all, because a density that doesn't enclose area 1 is not a density. One line, one dead answer. That number isn't magic either, since ∫φ(x)² dx = 1/(2√π) ≈ 0.282, which is what happens when you square a Gaussian and it gets narrower without getting taller. Good. Now you fix it, because you already know how, and you are right to reach for this. Obviously you don't square the density. You substitute the inverse: f_Y(y) = f_X(g⁻¹(y)). That is a genuinely reasonable move, and it is what most people write down. So let's run it honestly, on the friendliest density in mathematics.

Take X uniform on [0,1], so f_X = 1 everywhere on the unit interval, and square it: Y = X². The inverse is g⁻¹(y) = √y, so the recipe says f_Y(y) = f_X(√y) = 1. Flat, right across [0,1]. Check the area yourself.

f_Y(y) = ? ? ? = 1 f_Y(y) 1 0 0 1 y the checks you own support [0,1] positive ∫ = —.———
three empty slots. fill slot 1.
What you're looking at — your own answer, and every instrument you own agreeing with it
the slab — the density you just assembled. X is uniform on [0,1] (every value equally likely, so its density fX is a flat 1). Y = g(X) = X². You fed g⁻¹ (the inverse: the function that undoes g) into fX, and got fY(y) = fX(√y) = 1.
the checks — a density must live only where Y can land, must never go negative, and its total area ∫ must be exactly 1. All three are computed here, on your slab, from 2500 slices across y ∈ [−0.5, 2].
the line that stays — put a pin in it. Nothing on this page can settle it either way.
∫ = 1 is a test, not a mechanism. A test can only ever fail an answer — it can never confirm one. You just ran the only tests you have, and they had nothing to say.
Fig. 4. Fill the slots yourself: take fX, compose, and pick the function that undoes y = x². The machine assembles fY(y) = fX(√y) = 1 and draws it — a flat slab on [0,1]. Then every check you own runs: right support, never negative, and an area of exactly 1.000, summed here from 2500 slices. Green, green, green. You have no instrument that can touch this answer. Keep the gold line.

Area 1.000, exactly: right support, positive everywhere, integrates to one, and every instrument you own says pass. And you are still wrong. I'm going to leave you standing right there, because that is the honest position you are actually in. You have a plausible answer. You have a check. Your check passed. In four figures' time we will simulate this thing, and the histogram will not be flat. So notice what just happened to your instrument, because this is the real lesson and it isn't "don't be crude". The area audit is necessary, and it killed the squared bell in one line. But it is not sufficient, and it let this one walk straight through. A check that only fires sometimes was never going to save you, and only the mechanism will.

03A density is a price per inch

A density's number is a fact about the outcome and the ruler you measured it with. That is the inch where everything breaks, and it is a definition you have been able to recite since Chapter 8 without ever once having to use it. A density is not a probability. You know that, and you can say P(X = x) = 0 in your sleep. And yet somewhere underneath you still believe that the number f(1.75) = 2.2 is a fact about the outcome 1.75 on its own. It isn't. Nobody has ever shown you a density's number change while the world stood still, so you have no reason to suspect a density is answerable to the axis at all. So let me show you one, with no calculus and no probability, using a conversion you have done since you were ten years old.

per metre 1.70–1.80 peak 2.2163 area = 0.0000 1.40 1.75 2.10
unit = metre · height ×1
tap “name it” to see the ratio’s name
What you're looking at — the same 40 people, measured with a shorter ruler
the gold curve — probability per unit of the axis; it sags 100× the instant the unit does
the blue band — the actual probability over 1.70–1.80 m; its printed area never moves
the row of 40 people — same heights, frozen the whole time — watch that nobody grows
Fig. 5. Same forty people, same tape measure — only the number stamped on it changes. Flip to centimetres and the axis relabels 100× larger while nobody's height moves a pixel; the curve that read 2.2163 per metre has to sag to 0.02216 per centimetre, because a centimetre is a hundred times smaller than a metre and a density is a price quoted per unit. The shaded band over 1.70–1.80 m (170–180 cm) is where you see it: the printed probability is one number, quoted once, and neither world touches it. Press “name it” — that divide-by-100 is dx/dy for y = 100x, and you have been computing it since the day you first traded metres for centimetres.

Adult heights in metres, and the peak of the density reads about 2.2. Per metre. Now flip the toggle to centimetres, and notice that not one human being changed height. But the axis is now 100× longer, the same mass is spread over 100× the room, and every density value divides by 100. In centimetres that same peak reads 0.022. Per centimetre. Flip the toggle back and forth with the same interval shaded, and read the shaded area off both worlds. Identical to the digit. The mass never moved. Only the price per inch did. And now let me deflate the scariest word in this chapter, because that factor of 1/100 is the Jacobian. Write it out: y = 100x, so dy/dx = 100, so dx/dy = 1/100. You have been computing Jacobians on homework since primary school and calling it converting units.

So let's write the sentence that is really the whole chapter. The probability sitting in a thin sliver is height × width, because probability is area, and that is Chapter 8 talking. That sliver is also a set of outcomes, and section one just told us g never touched those. So the same sliver, described in y, has to carry the same probability. Set the two descriptions equal and you have it, so drag the sliver and watch both sides at once.

x y x = 1.15 y = 1.32 0.1000 0.1000 x y level — equal mass
x 0.3333 × 0.300 = 0.1000
y 0.1449 × 0.690 = 0.1000
f⁊(y)|dy| = fₓ(x)|dx| — mass conserved
drag anywhere — try to make the two products disagree.
What you're looking at — one sliver of outcomes, weighed on two rulers
blue — the sliver counted on x: height fX(x) × width dx
green — the SAME sliver counted on y: height fY(y) × width dy
gold — the band where g(x)=x² carries it from x to y

g never touched which outcomes are in this sliver (Ch 3: same set, same probability), and probability in a sliver is just height × width (Ch 8: area is probability). So the two products above are the same number, always — that's fY(y)|dy| = fX(x)|dx|.

Aha: height and width can't move independently. Stretch the room (dy grows) and the density — probability per unit of the axis — has no choice but to shrink by exactly that factor, or the sliver would weigh more than the outcomes inside it.

Fig. 6. X is uniform on [1,4] with g(x)=x² carrying it to y on [1,16]. Drag the sliver right, toward where g steepens: dy grows from about 0.69 to 2.31 while fY(y) shrinks from about 0.1449 to 0.0433 — and their product sits at 0.1000 the entire way. Press weigh it and the beam never tips, because it was never weighing width or height. It was weighing outcomes.

Here is what that |dx| factor is for: a pmf never needs one, and a density always does. You just accepted it, and nothing like it appeared when you reshaped a die back in Chapter 8. A pmf stores mass at each label, so a transform simply carries each lump to its new spot. A density stores mass per inch, so when g changes the inch, the height has to pay. Watch the same squaring hit both worlds at once.

0 height = 1/6, always 1 2 3 4 5 6 4 0 1
predict first
Predict: will squaring change the heights?
What you're looking at — same g(x)=x², two different kinds of mass
blue = before squaring — six die lumps at 1..6, or the flat U[0,1] slab
coral = the die's lumps after squaring — same heights, new addresses
gold = the pdf's cliff, 1/(2√y) — the stretch factor the density had to pay
Toggle DISCRETE or CONTINUOUS, predict, then press SQUARE. A pmf is mass — you carry six lumps of 1/6 to their new addresses and nothing else happens. A pdf is mass PER INCH — the instant squaring changes the size of an inch, the height must move to keep the area at 1. That difference is the whole reason a Jacobian exists.
Fig. 7. Toggle DISCRETE or CONTINUOUS, predict whether squaring changes the heights, then press SQUARE. The die's six lumps slide to 1, 4, 9, 16, 25, 36 and every one keeps height exactly 1/6 — a pmf is mass, and mass is carried, not stretched. The U[0,1] slab has no such luck: it restretches into the 1/(2√y) cliff, because a pdf is mass per inch, and squaring just changed the inch. Same g(x)=x² on both sides — the only difference between the two panels is that one stretch factor, and it exists for exactly one reason.

f_Y(y)|dy| = f_X(x)|dx|. That is mass conservation across a relabel, and I want to be precise about how cheaply we got it. Nothing new was assumed anywhere: it is "the same set has the same probability" from Chapter 3, times "area is probability" from Chapter 8, and that is the entire ingredient list. Rearrange it and the exchange rate is already staring at you: f_Y = f_X · |dx/dy|. But we didn't derive that rigorously — we read it off a picture, and slivers are not a proof. So let's go and get it properly, and the route we take is going to explain itself.

04Route through the thing with no units

Send the thing that carries no length at all, and a change of ruler has nothing to charge. The density can't travel, because it is priced per x-inch, and g changed the length of every inch. Fine. So don't send the density. Look at F_Y(y) = P(Y ≤ y) instead, which is the probability of an event, which is a set of outcomes, and a probability is a pure number between 0 and 1. There is no "per metre" written anywhere on it. So a change of ruler has nothing to charge it. Every textbook tells you to route through the CDF and calls it a procedure. That's the reason.

And there's a second thing here that sounds like symbol-pushing and isn't. When we "translate the event", we are not claiming that two different events happen to have equal probability. {Y ≤ y} and its X-description are the same collection of outcomes, written down twice. Nobody needs persuading that one set has one probability. So let's put the set on the screen instead of the symbols.

STEP 1 · write the event {Y≤y}: the gold outcomes in the rack Ω g⁻¹(y) = 0.50 X 0 1 Y ∈ [0,2] → F(y) 0 1 2 ⨯ refused
F [unitless] f [per x-inch]
Y≤y lights 5 of 10 outcomes
What you're looking at — the ROUTE: write the set, translate it, evaluate F, then differentiate
gold — the outcomes with Y≤y, lit in the Ω rack AND on the X-axis: one set, two labels
green tag — F is a probability: a bare number in [0,1], nothing "per inch" to charge
red tag — f is a probability PER x-inch; send it across a re-ruled axis and the price is wrong
1 write 2 translate 3 evaluate 4 differentiate Ch 12 · you did this to get λe−λt
Fig. 8. the route. Slide y and the same outcomes light up in the Ω rack and on the X-axis — one set, wearing two labels, not two claims. Evaluate sweeps the flat density up to that edge and reads off F(y) = y/2, a bare number. Slope traces that number's rate of change: a constant 0.5, per y-inch. Hit "try sending f instead" and watch it refuse — f is priced per x-inch, and Y = 2X just doubled the inch. That's the whole reason the CDF route works when the density route doesn't: F carries no units to begin with, so a change of ruler has nothing to charge it.

Slide the y-threshold and watch a subset of Ω light up: those are exactly the outcomes with Y ≤ y. Now find the same lit outcomes on the x-axis, where they form an interval whose right-hand edge sits at g⁻¹(y). Two pictures, one lit set. That's the justification, and it's a matter of looking rather than a matter of being persuaded. So here is THE ROUTE, and it is the thing you should carry out of this chapter. Write the event {Y ≤ y}. Translate it into an X-event. Evaluate it with F_X. Differentiate in y. Four steps, and you have already walked them once: in Chapter 12 the exponential density came out of differentiating an accumulated probability, never by substituting into a formula. That habit was the general machine all along, so now let's find out why it works.

Time to run it. I'm going to pick the most boring density in existence on purpose, because I want you to see the factor with nothing standing in front of it. Take X uniform on [0,1], so f_X = 1, and let Y = X². Every value of X was equally likely, and squaring on [0,1] is smooth, gentle and increasing, and it maps [0,1] onto [0,1] without folding anything over. So: is Y uniform too? Commit before you press.

4 1 0 1
X ~ U[0,1] · height 1 · area 1.000
Height 1. Width 1. Area 1.
Nothing to hide behind.
Press one. Nothing moves until you do.
width 0.100 of x · same mass, new room.
fY(y) = 1/(2√y) — a price, not a chance.
Not a correction.
An exchange rate.
BEAT 1 / 6
Beat 1 — the most boring density in existence
blue = the flat slab fX = 1, and later your flat prediction, ghosted
coral = the same dots after squaring, and the histogram they build
gold = fY(y) = 1/(2√y) — the price the Jacobian quotes
X ~ U[0,1]: pick a number between 0 and 1, every value equally likely. Its density fX is the flat slab — height 1, width 1, area 1. The most boring density in existence, and that is deliberate: fX = 1 everywhere, so whatever survives the change of variables IS the Jacobian, naked, with no shape to hide behind. (Density = probability per unit of the axis: mass per inch of room. It is not a probability.)
Fig. 9. The dots did not change. The room changed. Take X ~ U[0,1] — the flattest thing there is — and square it. Nobody leaves, nobody arrives, so every interval keeps its mass exactly; the only thing squaring did was change how much room that mass occupies. Density is mass per room, so the whole difference between the two worlds is one exchange rate, old room ÷ new room = |dx/dy|. That is the Jacobian, and it was never bolted on.

That spike at zero was never special to squaring, and the exchange rate tells you why. Read |dx/dy| as one over the slope of g. Where g climbs steeply, one y-inch eats many x-inches and the density thins out. Where g flattens, a wide band of x pours into a single y-inch and the density piles up. The cliff at zero was simply g going flat there, so now you can call a spike before you ever compute it.

f_Y = 1/|g'| y x f_X = 1 (flat) g'=0 spike you
predict: click left of the y-axis
Drag the gold dot ● along g (or ◄► keys). Watch the red slope and the gold height trade places.
What you're looking at — the density height is one-over-the-slope
blue = the map y = g(x). Steep here, gentle there — the slope g'(x) is the whole story.
red = g's slope at the probe (the tangent). Big slope = g races through that y.
gold = the resulting density f_Y = 1/|g'| laid down the y-axis. With f_X = 1, the height is the Jacobian.
AHA|dx/dy| = 1/|g'(x)|. So f_Y spikes exactly where g goes flat (g'→0) and thins where g runs steep. You never compute to find a spike again — you point at g's flattest spot. eˣ never flattens, so it never spikes; x² is flat at 0; x³ is flat in the middle.
Fig. 10. 21 · steep g thins, flat g piles up. Drag the gold dot along g: the red slope and the gold density height are reciprocals — f_Y = 1/|g'|, the Jacobian with f_X = 1. Where g is steep (slope > 1.3) the height drops toward 0.25; where g is gentle it piles up; where g goes truly flat (g'→0) the height runs to and the density spikes. So predict first: click the y-axis where you think it spikes, then Reveal — the spike snaps onto g's flattest point. For that flat spot is at the bottom (x = 0, the y = 0 cliff); for it sits in the middle; for the slope is never zero, so it only thins and never spikes. The aha: |dx/dy| = 1/|g'(x)| was one-over-the-slope all along — you find a spike by pointing at where g is flat, no computation required.

Ten evenly spaced dots, and even spacing is uniformity — that's the whole picture. Press SQUARE and watch: 0.1 → 0.01, 0.2 → 0.04, 0.3 → 0.09. The low dots collapse into a pile against zero, while 0.9 → 0.81 and 1.0 → 1.0 drift apart. Now count them: nobody left, nobody arrived, ten dots before and ten dots after. The dots did not change. The room changed. So measure the room. The interval [0.1, 0.2] has width 0.1, and it lands on [0.01, 0.04], which has width 0.03. Same mass, because they are the same outcomes, now packed into about a third of the room, so roughly 3.3 times the density. And [0.9, 1.0], also width 0.1, lands on [0.81, 1.0], width 0.19. Same mass again, spread over roughly double the room, so about half the density.

There is only one thing that ratio can be. f_Y = f_X × (old room ÷ new room) = f_X × |dx/dy|, and that factor is the Jacobian. Cash it out: with f_X = 1, the route gives F_Y(y) = P(X² ≤ y) = P(X ≤ √y) = √y, so f_Y(y) = 1/(2√y). It lands dead on the histogram, and the area checks out: ∫₀¹ dy/(2√y) = [√y]₀¹ = 1. The whole answer is the exchange rate, because with f_X = 1 there was nothing else left on the screen to see. Now the two things that will bother you, dealt with here where they can't hurt. First: f_Y(0.0001) = 50. A density of fifty. That is fine, because it never was a probability in the first place. It's a price per y-inch, and near zero the squaring crushes the axis so hard that the price runs to infinity while the total bill stays exactly 1. Second: dx/dy reads upside down, and every calculus reflex you own wants dy/dx. So ask it in words instead of symbols. f_Y is a price per y-inch. To quote a price per y-inch, what do you need to know? How many x-inches you get for one y-inch. That is dx/dy, and it reads upside down because you are pricing y in x's, the same way a shop pricing in dollars needs euros-per-dollar and not the other way round.

So look back at what the near-miss was. It wasn't close. It was missing the only thing on the screen, and it passed your area audit on the way out. The Jacobian is not a correction bolted onto a formula. It is the exchange rate between an inch of y and an inch of x. The chain rule was always the currency desk, and everything left in this chapter is that one sentence in a different accent.

05Turn it around, slide it, stretch it

First accent: turn g around. I want to deal with the absolute value now, because of what you have almost certainly been told about it. "Densities can't be negative, so we take the absolute value." That sentence is a lie of convenience. Believe it and you now think the formula contains a fudge, which means you will never quite trust it. Then a sign question gets hard — later in this chapter, in the chi-squared (figures 15–16) — and you guess. So let's earn the bars. Take the most violent decreasing map there is: Y = −X.

STEP 1 · the flip the event is about X, not −X 0 number line of −X head — not this y = −1.5 f_Y(y) = d/dy [ 1 − F_X(−y) ] = f_X(−y) ✓ positive −X ≤ y school algebra: press the button to flip it
flip it — press multiply by −1
The event {−X ≤ y} is about X, not −X. Multiply by −1 and the direction flips too.
What you're looking at — positivity falls OUT of the algebra, nobody imposes it
gold — the marker at y, then −y after the flip; drag the slider, the picture stays honest
blue — the chain-rule minus, born from differentiating −y itself
red — the outer minus, born from differentiating 1−F_X(•); also the "head" region we do NOT want
green — the two minuses cancelled: the density comes out positive on its own
Fig. 11. where |·| is born. Run Y=−X on a skewed density — Ch 12's exponential, mirrored. Multiply {−X≤y} by −1 and the inequality flips to {X≥−y}: school algebra, nothing more. The complement rule (Ch 4) turns that tail into 1−F_X(−y); differentiating brings two minus signs — one from the outer 1−(•••), one from the chain rule on −y — and they cancel to +1, so f_Y(y)=f_X(−y) comes out positive on its own, nobody imposed it. The general case runs the same trick with dx/dy negative: the formula's own minus sign fixes it, everywhere you probe. The bars |•| are shorthand for both cases, increasing and decreasing, in one line — we just did both.

You have now watched the route handle an increasing g and a decreasing one, and every step came from me. That is not the same as owning it. So here is a g you have not seen, and this time your hand drives all four moves. Write {Y ≤ y}, then turn it into an event about X. Hand it to F_X, and then differentiate. There is no formula to recall and nothing to memorise. If your f_Y lands on the histogram, you did not remember the answer: you rebuilt it.

Y = 1/XX ~ U[1, 2]
1  F_Y(y) = P( … )
2     = P( X … )
3  F_Y(y) = …
4  f_Y(y) = d/dy F_Y = …
pick a g you've never met
Start the CDF. Which event about the transform?
Step 1 of 4 — open the CDF
What you're doing — the same four moves, driven by you, on a g you'd never met
the route — open the CDF, rewrite the event about X, substitute F_X, differentiate. No formula to recall: each step is a choice you make.
the turn — if g is DECREASING (Y=1/X), {Y≤y} becomes {X ≥ 1/y}: the inequality flips. A wrong pick earns a nudge, never the answer.
the judge — your finished f_Y is drawn over a real 200,000-sample histogram of Y=g(X), and its area is measured. Data decides, not the author.
Fig. 12. You drive the route on a g you were never shown. Open the CDF, rewrite the event about X — for the decreasing Y=1/X that means {Y≤y} turns into {X ≥ 1/y}, and a wrong direction earns a nudge, not the answer — then substitute F_X and differentiate. Land f_Y = 1/y² on [½,1], 2y on [0,1], or 1/y on [1,e]; each drops onto a real 200,000-sample histogram of Y=g(X) with measured area 1.00. Same four moves, three g's: you reconstruct the answer, you never recall it.

Ask the event question and watch the inequality turn over. {−X ≤ y} is {X ≥ −y}, because multiplying an inequality by −1 flips the arrow, and that isn't probability, that's school algebra. So F_Y(y) = P(X ≥ −y) = 1 − F_X(−y), using the complement rule from Chapter 4. Differentiate and you get f_Y(y) = −f_X(−y)·(−1) = f_X(−y). Two minus signs, both earned, both visible. The density comes out positive without anyone imposing positivity on it. And notice we ran that on a skewed density, Chapter 12's exponential mirrored, so that positivity is a result you watched happen rather than a symmetry accident. Do it in general and f_Y = −f_X(x)·(dx/dy), where dx/dy is itself negative, so the product is positive on its own. Now write the bars: f_Y(y) = f_X(x)·|dx/dy|. They are shorthand for "increasing case or decreasing case", written in one line instead of two, and we just did both in the open.

Second accent, and this is the one you'll use most: Y = aX + b, a stretch by a followed by a shift by b. It's monotone either way, so section four's formula applies with no thinking at all. x = (y−b)/a, so dx/dy = 1/a, so |dx/dy| = 1/|a|. Substitute and you're done: f_Y(y) = (1/|a|)·f_X((y−b)/a). But I want you to watch that 1/|a| happen rather than take it from me, so here are two sliders and one guarantee that never moves.

fY(y) = fX((y−b)/a) / |a| 0 w=3.20 h=0.399 area=1.000🔒 drag b — does width move? x=(y−b)/a → dx/dy=1/a → |dx/dy|=1/|a| — Fig. 9's Jacobian
drag a or b — watch which one sags
What you're looking at — the area is bolted to 1, so height pays rent for width
gray dashed = the untouched original (a=1, b=0); gold solid = the curve after Y=aX+b
drag b: the curve slides — width, height and area never move, because sliding can't touch shape
drag a: width scales by |a|, height divides by |a|; unlock the padlock and height stops paying — area climbs off 1
aha — Ch10 called this "a wider bell must be shorter," a fact about 1/(σ√2π). This is that same idea, promoted: true of every density there is.
Fig. 13. wider must be shorter — and now it's a theorem. The gray dashed curve is the untouched original (a=1, b=0); the gold curve is Y=aX+b. Drag b and the curve only slides — w, h and area sit frozen, and the indicator keeps confirming NO, no matter how many times you drag it. Drag a to 2 and width doubles while height is cut in half, live, because the padlocked area=1.000 forces it to. Click the padlock open and drag a again: now the curve stretches with no sag, and area climbs straight off 1 and turns red — the sag was never decoration, it was the only thing keeping this a distribution. Re-lock and it snaps back. Drag a negative and the curve mirrors, but w never flinches, because the formula reads |a|. Open the why 1/|a|? chip for the one-line derivation, and switch shape — the sag isn't a normal-curve quirk, it happens to the exponential and the lumpy hand-drawn density exactly the same way.

Drag b first. The whole curve slides, and the width readout doesn't twitch, and the peak height doesn't twitch either. Of course not, because nothing about a shape knows where the origin is. That matters, because you half-expected b to do something to the spread, and nobody ever says out loud that it can't. Now drag a to 2. The curve stretches to twice the width — and sags to half the height, live, all by itself, because the area is bolted to 1.000 and the readout is right there. Put the number on it: at a = 2 the stretch factor is 1/2, so every height on the curve is multiplied by 0.5. That sag is the 1/|a|. And now look at what you just promoted. In Chapter 10, "a wider bell must be a shorter one" was a fact about the normal's normalising constant. Here it is a theorem about every density in existence. Same phenomenon, much bigger house. Drag a negative and the curve mirrors while the width is unchanged, which is exactly why the formula says |a| and not a, and figure nine already told you why the bars are honest.

Now the error I want to kill permanently, and I'm not going to kill it with a rule, because rules are what you forget. You will be tempted to write SD = a²σ², because you half-remember "variance scales by ", and because SD and variance have fused into one fuzzy thing in your head called "spread". So let's use units instead.

0 0.5 new SD = ? m width = 0.18 m Var(Y) = a²σ² → unit m² (Ch 15) an area — m² is what it's always been
drop into the slot — a = 1.0
drop a candidate to test its units
What you're looking at — a length gets unit-checked, not rule-checked
gold segment = σ, a real LENGTH lying on the x-axis, tagged m
|a|σ → resolves to m — same unit as the axis, so it CAN be a width
a²σ² and aσ² → resolve to , an AREA — the segment flashes a grey square that can't lie on a 1-D axis
σ/|a| → unit m is fine, but it's the wrong move — that SHRINKS a stretch, it doesn't track it
computed once: σ = 0.180 m, so σ² = 0.0324 m² — squaring a length always makes an area, no matter what multiplies it.
Fig. 14. SD is a length. a²σ² is an area. An area is not a width — that's why SD scales by |a|, not a²: σ carries units of metres, a²σ² carries metres-squared, and a square can no more be a curve's width than a room can be a ruler. (Variance, Ch 15, WILL scale by a² — m² is what it always was.)

SD scales by |a| because SD is a length on the axis, and the units alone are enough to show it. σ is on the picture as a measured segment on the x-axis. Stretch by a, and the segment stretches by |a|. You can watch it happen, and it isn't a coincidence, because stretching every length on an axis by |a| is what stretching an axis means. Now read the units straight off the screen. σ is in metres, so a²σ² is in metres-squared, and that is an area, and an area is not a width. That's the whole argument. Variance gets formalised properly in Chapter 15, and it will scale by , and by then the units will already have told you why.

So now let's demote a ritual. You have been performing Z = (X−μ)/σ since Chapter 10 — subtract the mean, divide by the SD, look up Φ — as a rite with no mechanism attached, filed in your head under "the normal distribution". So watch what it actually is. Set a = 1/σ and b = −μ/σ, which is legal, because both are just numbers and σ > 0. Then aX + b = X/σ − μ/σ = (X−μ)/σ. That's the z-score, character for character. It was never a special trick. It is the affine case at one setting of two dials.

a b aX + b σ > 0 → just numbers f_Z(z) = f_X(σz + μ) · σ = 1/(σ√2π) · e^(−z²/2) · σ = (1/√2π)·e^(−z²/2) = φ(z) same σ — two directions
two dials, still live — set them
What you're looking at — one crank turn, two σ's, one cancellation
Z=(X−μ)/σ is just Y=aX+b at a=1/σ, b=−μ/σ — nothing new is derived, the old rule is evaluated at one setting
click either σ in the crank: the Jacobian σ (from |a|=σ) and the bell's own normalising σ (from Ch10's 1/(σ√2π)) are the same number — that's the tether
cancel them and only φ(z) is left — the ritual since Ch10 was always this machine at one dial setting
Fig. 15. Nothing here is new: the z-map Z=(X−μ)/σ is just the affine rule Y=aX+b, the same two dials from before, aimed at a=1/σ, b=−μ/σ. Set them, then turn the crank — two σ's appear, one the Jacobian, one the bell's own normalising constant. Click either: they're the same number. Cancel them and only φ(z) is left — the ritual you've run since Ch 10 was always this machine at one setting.

Turn the crank from figure ten. Since |a| = 1/σ, the factor 1/|a| is σ, so f_Z(z) = f_X(σz+μ)·σ. Put the normal in and watch the σ's annihilate: (1/(σ√(2π)))e^(−z²/2)·σ = φ(z). Stop on that, because it is not a coincidence and it is not luck. The σ that arrived as the Jacobian is the same σ sitting in Chapter 10's normalising constant. The bell's width-normaliser and this machine's exchange rate are one number, which is exactly why the answer comes out so suspiciously clean. Drag x on the left panel, watch z move on the right, and watch the two shaded areas stay identical to the digit. That's mass conservation, and it is now something you proved rather than something you were shown.

Which raises the question nobody ever asks out loud: does standardizing make things normal? Guess first, and then let's run the very same machine on something that isn't a bell.

Normal N(3,2²) Φ guess: 0.0228 truth: 0.0000 MATCHES -1 0 1 2 μ=0 · σ=1 ? predict, then STANDARDIZE ▶
mean 0, SD 1?
will it be a bell?
mean, SD?
a bell?
What you're looking at — the same affine crank, run on four different laws
the MAP always works — mean 0, SD 1, on any law with a mean and an SD
the SHAPE almost never survives — only the normal stays a bell
what's special was never the z-score — the normal family is closed under affine maps
Fig. 16. Pick a law off the shelf, predict both questions, then press STANDARDIZE. The lamp for mean 0, SD 1 goes green for every single law on the shelf — that half of "standardizing works" needs nothing but a mean and an SD. The lamp for shape goes green only for the normal: standardise Exp(λ) and the crank returns f_Z(z) = e^(−(z+1)) on z ≥ −1 — still skewed, its wall now sitting at −1, λ gone completely. Press reach for Φ and watch the error happen on purpose: Φ guesses the same 0.0228 for P(Z>2) no matter which law is loaded, but the true answer is roughly double that for the exponential and the chi-squared, and exactly zero for the uniform. Same crank, same two claims — only one of them was ever about the bell.

"Standardizing works" is two different claims wearing one word, and an exponential pulls the two apart. Standardise an Exp(λ), whose mean and SD are both 1/λ from Chapter 12. So Z = (T − 1/λ)/(1/λ) = λT − 1. Turn the crank and out comes f_Z(z) = e^(−(z+1)) on z ≥ −1. Read it: mean 0, SD 1, λ gone entirely — and it is every bit as skewed as it started. It's a shifted exponential, and Φ has nothing to say about it. So here is the honest split. Claim one: the affine map exists for any distribution with a mean and an SD, so you can standardise an exponential, a uniform, a chi-squared. Claim two: the shape survives, so one table answers everything, and that is true only for the normal. Fuse the two claims and you get a real, common error: someone standardises a skewed variable and reaches for Φ. What is special about the bell was never the z-score. It is that the family is closed under affine maps, and that is why one table was ever enough.

06When squaring folds

Now square something that is allowed to be negative, and everything appears to fall apart. You reach for g⁻¹(y) = √y, then you remember that (−3)² = 9 as well, and you conclude the machine broke. It didn't. Here's the thing to see first, because you'll think this is about squaring and it isn't. Nothing about squaring changed at all. The domain changed. Drag the support and watch it happen.

X Y=X² 0 1 0 1 support: [0.0, 1.0] x per y-bin: 1
drag the gold handle — push X's left support edge past 0
monotone on the support of X
What you're looking at — squaring didn't change, the domain did
gold handle = the left edge of X's support, L — drag it below 0
blue = bijection: one x owns its y-bin alone (support all ≥0)
red = the fold: −x and x now share one y-bin (support <0)
PREIMAGE mode: {x:x²≤y} always answers — g⁻¹(y) never can
Fig. 17. 14 · drag the support until it folds — then switch to preimage and watch {x:x²≤y} answer where g⁻¹(y) can't.

On [0,1] you are back in the case from figure eight, and everything is fine. Drag X's range leftward through [−0.2, 1] and out to all of . The moment negative x's exist, two dots start landing in the same y-bin. That's the fold, and you just watched exactly which assumption broke. It isn't "squaring is bad". It is that x ↦ x² stopped being one-to-one on the support of X. So let's say that out loud, because nobody ever does. Monotone is a property of g on the support of X, not a property of g in the abstract. If X can't be negative, squaring is monotone and figure eight's machinery is untouched, and you have already done exactly that.

And now the moment the whole chapter pays for itself. Go back and read THE ROUTE. It never said "take the inverse". It said translate the event. The inverse function was only ever a convenience for writing the monotone answer down. An inverse function and the preimage of a set are two different things hiding behind one arrow. x ↦ x² has no inverse on , and yet {x : x² ≤ 9} is perfectly well defined: it is [−3, 3]. So pick a y, and say the event out loud before writing anything: " is at most y" means "Z is between −√y and √y". That is not probability. That is what squaring does to a number, and you've known it since you solved x² ≤ 9 at school. The machine needed exactly one thing, a description of the event, and it still has one: F_Y(y) = P(−√y ≤ Z ≤ √y) = F_Z(√y) − F_Z(−√y). It never wobbled. That is why we built it out of events instead of formulas.

Now differentiate it, and here is the chapter's famous panic. There is a visible minus in front of F_Z(−√y), and another visible minus in the derivative of −√y, and I am about to tell you the answer is a sum. Every instinct says subtract. And this one is genuinely dangerous, because if you write [f_Z(√y) − f_Z(−√y)]/(2√y), the bell's symmetry hands you 0. Not an absurd answer that screams at you. Just zero. You would stare at it with no idea what went wrong, because nothing in your picture tells you what should happen to the mass coming from the left arm. So let's build the picture first, and let the algebra arrive afterwards as a confirmation.

STEP 1 · the picture, before any symbols who lands in the bin [1.00, 1.04]? −1 0 +1 z from z ≈ −1 from z ≈ +1 +0 +0 the one y-bin — both arms feed it subtracting claims f_Y ≡ 0 everywhere STEP 2 · the algebra, arriving as relief F_Y(y) = F_Z(√y) F_Z(−√y) d/dy[ F_Z(√y) ] = + f_Z(√y)/(2√y) d/dy[ F_Z(−√y) ] = f_Z(−√y)·(1/(2√y)) subtraction chain rule the sign (−1) × (−1) = +1 ⇒ d/dy[ −F_Z(−√y) ] = + f_Z(−√y)/(2√y) STEP 3 · the result — both terms plus f_Y(y) = [ f_Z(√y) + f_Z(−√y) ] / (2√y) 0 1 2 3 y → left arm +0.1210 right arm +0.1210 f_Y(1) = 0.2420 MINUS: [f_Z(√y) − f_Z(−√y)]/(2√y) = 0 STEP 4 · k branches, every term plus y x
both arms feed the one bin
Press it. Tracers leave both arms of the bell and run into the one bin. Nobody drains it.
What you're looking at — one y-bin, fed by two rivers and drained by none
blue — the standard bell over z. The tracers mark the route mass takes, not random draws.
gold — the two slabs near z = −1 and z = +1 (drawn wide; the real ones are ~0.02 of z), and the one bin they both feed
red — the wrong branch. Subtract and the bell cancels itself: 0.1210 − 0.1210 = 0, at every y
AHA — two minus signs are on the page and the answer is still a sum. A bin fed by two arms and drained by none can only add, so subtracting would claim the left arm's outcomes un-happen — and that is exactly why the − in front of F_Z(−√y) and the − inside d(−√y)/dy annihilate.
Fig. 18. two rivers, one lake. The bin y ∈ [1.00, 1.04] is fed from near z = +1 and from near z = −1, and nothing drains it — so its mass can only add. Press MINUS and watch the honest consequence: the left arm flows back out, the bin empties, and the density is flat zero everywhere — an answer that never looks absurd, which is what makes it dangerous. Then the algebra agrees: d/dy[F_Z(√y)] = f_Z(√y)/(2√y), and d/dy[−F_Z(−√y)] = −f_Z(−√y)·(−1/(2√y)) = +f_Z(−√y)/(2√y) — one minus from the subtraction, one from the chain rule, product +1. So f_Y(y) = [f_Z(√y) + f_Z(−√y)]/(2√y), and at y = 1 that is 0.2420, not 0. Turn the branch dial and the general law is already obvious: f_Y(y) = Σᵢ f_X(xᵢ)·|dx/dy|ᵢ, every term positive, because every branch delivers.

Two rivers, one lake. Shade a thin y-bin, say [1.00, 1.04], and ask which outcomes land in it. The ones near z = +1, and the ones near z = −1. Both arms feed the same bin, and nobody drains it. Mass arriving from two places adds. You cannot subtract an arrival — to subtract would be to claim the left arm's outcomes somehow un-happen, which is nonsense about a set of outcomes. The picture answered before any algebra, and it answered using section one's principle. Now the algebra, which arrives as a relief instead of a surprise. d/dy[F_Z(√y)] = f_Z(√y)·(1/(2√y)), and d/dy[−F_Z(−√y)] = −f_Z(−√y)·(−1/(2√y)) = +f_Z(−√y)/(2√y). Two minus signs, one from the subtraction and one from the chain rule, and they annihilate. So f_Y(y) = [f_Z(√y) + f_Z(−√y)]/(2√y), with both terms plus. And that gives the general law for free, and it's now obvious rather than announced: when g folds, sum over the branches, so f_Y(y) = Σᵢ f_X(xᵢ)·|dx/dy|ᵢ. Each branch brings its own mass at its own exchange rate, and every term is positive, because every branch delivers. And notice the absolute values from figure nine doing exactly the job we built them for: one settled case-split per branch, and no new signs to fear.

So put the standard bell into that formula, give the crank one turn, and a famous distribution falls straight out.

STEP 1 · two branches φ(√y)/(2√y) and φ(−√y)/(2√y) — two terms →∞ ×2 0 1 2 y → y=0.64 · |dx/dy|=0.63 area ≈ 1.000
two branches feed the same y-bin
Fig. 18 gave f_Y(y)=φ(√y)/(2√y)+φ(−√y)/(2√y) — each term is one branch's own contribution to the same y.
What you're looking at — two branches, and the symmetry that fuses them
blue — the branch from x=+√y
coral — the branch from x=−√y
gold — the two branches fused; only happens because φ(−√y)=φ(√y)
green dashed — Fig. 9's uniform-square 1/(2√y), the same cliff without a bell
f_Y(y) = 1/√(2πy)·e^(−y/2) for y>0 — the χ²(1) density; the 2 was φ's, not χ²'s
Fig. 19. χ²(1) in one turn of the crank. Fig. 18's two-branch formula f_Y(y)=φ(√y)/(2√y)+φ(−√y)/(2√y) meets a symmetric φ: the branches are equal, so they fuse to 2φ(√y)/(2√y), the 2's cancel, and out drops f_Y(y)=1/√(2πy)·e^(−y/2) — the χ²(1) density, piling up at 0 exactly the way Fig. 9's uniform-square did, for the same reason: 1/(2√y) → ∞. Swap in a skewed source and the branches refuse to fuse — the 2 was φ's property, never χ²'s.

I told you the fusing 2 belonged to the bell's symmetry, not to χ². A claim like that should not be taken on trust, so let us break the symmetry and look. Square an X that straddles zero without being a mirror image of itself. Now the two branches climb to different heights, and both stay in the sum. There is no 2 to cancel. Push y out far enough and one branch runs off the edge of the support and simply vanishes.

Two branches that refuse to fuse X ~ U[−1,2] · square it · one arm runs off the edge on X: the two source points ±√y edge −1 −√y +√y 0 2 x on Y: f_Y(y) = the two stems, stacked ×2 1 2 y y=0.49 · |dx/dy|=0.714 area = 1.000
y = 0.49
both arms live · f_Y = 0.476
What you're looking at — kill the mirror symmetry and the fold shows its true shape
blue arm — the source at x=+√y; it reaches all the way out to y=4 (since +√y stays inside the support up to x=2)
coral arm — the source at x=−√y; it dies at y=1, the instant −√y crosses the left edge x=−1 and runs off the support
gold — the kink at y=1: a whole arm dried up, so f_Y halves from 1/(3√y) to 1/(6√y). Symmetric mode shows the ×2 instead: two EQUAL arms fusing into one doubled curve
area holds at 1.000 — mass is conserved (it is just f_X·(b−a)); dragging y only moves the probe, never the total
Fig. 20. Square an asymmetric X ~ U[−1,2] and drag y. Two stems rise from the source points +√y (blue) and −√y (coral); below, f_Y(y) is drawn as those two stems stacked. For y<1 both arms live and f_Y=1/(3√y) — at y=0.49 the readout shows 0.476. Push past y=1 and the coral arm slides off the left edge x=−1: its stem drops to zero, the coral layer vanishes, and the density visibly halves from 0.333 to 0.167 — a kink you can see, because a whole river dried up. Flip to symmetric U[−1,1] and the two arms are equal and die together, fusing with the tell-tale ×2. The area holds at 1.000 throughout. The aha: the 2 in χ² was never χ²'s — it was the bell's mirror making two equal branches look like one doubled. Break the mirror and the fold shows its true shape: two unequal rivers, one drying up the moment its source runs off the support.

f_X = φ, which is symmetric, so φ(−√y) = φ(√y) and the two branches are the same number. They fuse: 2φ(√y)/(2√y) = φ(√y)/√y = (1/√(2πy))·e^(−y/2) for y > 0. That is chi-squared with one degree of freedom, χ²(1), and you just built it out of a bell in a single move. Now the pile-up at zero, which we promised you eight figures ago. Overlay this on the uniform-square curve 1/(2√y) and it's the same cliff, same cause. |dx/dy| = 1/(2√y) blows up at 0 because squaring crushes an inch near zero into nothing, so the price per y-inch runs to infinity. Nothing exotic is happening, and you met it first inside a uniform, where it couldn't be blamed on the bell. The height diverges but the bill doesn't, and that's a fact about 1/√y, not about probability. Near zero √y shrinks slowly, so 1/√y blows up only mildly, which keeps the area near 0 finite: ∫₀^ε dy/(2√y) = √ε. Put a number in: with the cut-off at 0.01, that near-zero area comes out at 0.1, so a tenth of the whole distribution sits under a spike of unbounded height. Check the readout, and it reads 1.000. One honest flag before we move on. That fusing 2 belongs to φ's symmetry and not to χ². Square something skewed and the two branches stay two, both stay in the answer, and the machine still works.

07Where this was always headed

Time to pay a debt. Chapter 12 told you, in as many words, that the capital Γ is what lets r go fractional. Then it parked that idea and walked away. So let's cash it in now. Take Gamma(r, λ), whose density is λ^r y^(r−1) e^(−λy) / Γ(r), and set r = 1/2 and λ = 1/2.

Gamma(r, λ) density:  λ^r · y^(r−1) · e^(−λy) / Γ(r)
1 · y^0 · e^(−y) / Γ(1)  =  e^(−y)
χ²(1) [Fig. 19]:  y^(−1/2) · e^(−y/2) / √(2π)
set r = ½ and λ = ½ to compare shapes
√(2π) = √2·√π — the same constant, arriving from two families you met as strangers.
r
λ
Γ(1/2) =
What you're looking at — one √π forced twice, and the statistic it explains
blue — r shapes the curve, λ sets its rate, y is the axis value, Γ is what lets r go fractional. Forcing r=λ=½ pins Γ(1/2)=√π, the same √π hiding inside every normal's √(2π) since Ch 10.
green — (O−E)/√E is a z-score: Ch 11's fingerprint says a count with expected value E has SD √E. Square each one and add — that's this chapter's two operations.
gold dashed — the map's weak link: χ²(k)=Gamma(k/2,½) by “adding k” of them. Solid for integer r; still just a claim, not a proof, when k/2 is fractional.
what we have NOT proved

Integer-r addition — whole Gamma streams stacking end to end — is owned, Ch 12's derivation. Fractional-r addition, the dashed arrow above, needs the moment-generating function: that's Ch 18. Until then it's a claim we check, not a theorem we've earned.

And fitting the expected counts E from the data itself spends a constraint — the final degrees of freedom will turn out to be k−1, not k. Parked for later.

Fig. 21. The handshake: set r=½, λ=½ in the Gamma density, fill Γ(1/2) from the menu, and watch it fuse with χ²(1) — forcing Γ(1/2)=√π. Then the map (Z²→χ²(1)→χ²(k), one arrow still dashed) and the statistic, built backwards from a “?” into a z-score, squared and summed.

You get (1/2)^(1/2)·y^(−1/2)·e^(−y/2)/Γ(1/2). For that to be the χ²(1) we just derived, Γ(1/2) must be √π. It is, and it evaluates to about 1.772. So look at what just happened there. The first fractional r in this entire book was not chosen for fun. It was forced, by squaring a bell. And the √π it needs is the same √π that has been sitting in the normal's normalising constant since Chapter 10. Two families you met as strangers turn out to share a constant, and the reason is on the screen. So the map reads: Z → square → χ²(1) = Gamma(½, ½) → add kχ²(k) = Gamma(k/2, ½).

Now I have to change voice, because the last arrow on that map is not something we proved. We own "integer r's add" from Chapter 12's stream — wait for r₁ events, then r₂ more, one timeline, the restart property. We do not own fractional r's adding. That is a real gap, and I'm naming it rather than stepping over it. Summing independent variables needs joint distributions (Chapter 14) or the MGF (Chapter 18). Until then, χ²(k) for k ≥ 2 is a claim we will check by simulation, not a theorem we have earned. If I asserted it in the same confident voice I used for everything we derived, I'd be teaching you that our proofs and our assertions sound identical. That would quietly destroy the value of every proof in this book.

And now the payoff that reframes this whole chapter backwards. You have met χ² before, as a table and a ritual, and the statistic is Σ(O−E)²/E. It looks like an arbitrary recipe with a strange denominator. Why divide by E? Nobody ever says, and it reads like a fudge, but it is not one. For a count with expected value E, the SD is √E — that's Chapter 11's mean = variance = λ fingerprint, which you have owned for two chapters. Expect 100 events and the SD is 10, so a count of 120 sits two SDs out. So (O−E)/√E is literally a z-score. The recipe is standardise, square, add, and those are this chapter's two examples. The z-map and the squaring were never two illustrative demos of the change-of-variables machine. They are the two halves of the statistic, and you have been building it for nine figures without being told. One last honest thing, parked rather than hidden: the k−1 in "degrees of freedom" is there because fitting the expected counts spends a constraint. Real idea, named here, earned later.

So let's finish with a receipt rather than a formula, and let's settle that unproved claim while we're at it. One array, z = randn(200000), and that is the entire random world of this chapter. Every number from here on is that same array wearing a different label, and we never call the generator again. The rule is the chapter.

z = randn(200000) randn calls: 1 y = z**2 2.5 0 right SHAPE, wrong HEIGHT ⇒ you forgot the Jacobian measured 3 times above · never asserted
χ²(1) density lands on the bars
What you're looking at — one frozen array, relabelled four ways, never re-drawn
coral bars — a real histogram, built fresh each tab from the SAME z: squared, or scaled+shifted, or reshaped into 4 columns and summed
green curve — the predicted density, evaluated at every bar — lands when it's the right law
red dashed curve — a wrong candidate on purpose: the old near-miss, or the Jacobian deleted
randn(200000) ran exactly ONCE, fenced at the top — the counter never moves. Every tab below reslices or reshapes that one array; nothing was re-drawn to make a law come out right. Promote the χ²(4) arrow to a theorem? No — checked is not proved. Ch 18 earns it with the MGF; this is the honest middle ground: you ran the test yourself, and it passed.
Fig. 22. One array. z = randn(200000), drawn once, fenced at the top, counter pinned at 1 for the whole session. Every tab below is a relabelling of that same z, never a new draw: square it and the bars land on χ²(1)—then summon the old near-miss and watch it miss the histogram outright. Shift and scale it and (1/σ)φ((x−μ)/σ) lands; delete the 1/σ and the curve floats exactly σ times too high, measured, not asserted. Reshape it into 4 columns and sum the squares, and the χ²(4) arrow Fig. 21 drew dashed lands too—checked, not proved. Mass was never re-randomised, so conservation was never assumed. It was arithmetic.

Square the array, histogram it, and (1/√(2πy))e^(−y/2) lands on the bars. Then the demolition, in two lines. Overlay the near-miss φ(√y) beside it — that is what your old recipe f_X(g⁻¹(y)) hands you here, the same move that walked past every test you had back in figure four. It misses the histogram completely. Your old answer, killed by data, at the end of the road it started on. Next, x = μ + σz, which is the z-map run backwards, and (1/σ)φ((x−μ)/σ) lands on it. Here the Jacobian is visible as the height: delete the 1/σ and the curve floats above the bars by exactly a factor of σ. Comment it out and watch it fail, because that is the error you will actually make one day. Then reshape the same array into k = 4 columns and sum the squares: Gamma(2, ½) lands. That's the claim we refused to prove, now checked, exactly as promised — and you did the checking, which is the move that will serve you for the rest of your working life. When you can't prove it yet, test it.

And take the diagnostic with you, because it will outlive this chapter. If your transformed histogram has the right shape but the wrong height, you forgot the Jacobian. That is the fingerprint of the single most common error in applied probability, and you can now spot it by eye, in anyone's code, including your own. Here's the map.

Ch 13 idle Y Σ → Ch 14 U Be Bi N Po Ex Γ
Click a transform below — it runs through the Ch13 machine. Then click the grey Σ for the door out.
What you're looking at — Ch 13 isn't a new distribution, it's a machine bolted onto every one you own
gold = the Ch 13 machine — click a transform to feed a distribution through it
blue = the spine so far: Bernoulli → Binomial → Normal / Poisson → Exponential → Gamma
green ring = closure held (still the same family) · orange ring = closure broke
dashed grey = outside the spine — Uniform (a guest) and Σ, the door to Ch 14
Fig. 23. Every earlier chapter added a distribution; Ch 13 added a verb. Click a transform to send Normal, Exponential, Gamma or Uniform through the machine — then click the grey Σ: this machine only ever re-rules ONE axis, and that's exactly why χ²(k)=ΣZᵢ² was the one claim this chapter checked instead of proved.

What you're carrying out of here is a machine instead of a table, and it has one moving part. Point it at any Y = g(X) and you won't reach for a formula. You'll chase the event. That route does not care whether g increases, decreases or folds. It never needed an inverse function — only a preimage — and that is exactly why it survives where every memorised formula dies. Three rituals got demoted in front of you. And now the door out, which you can see for yourself. Everything in this chapter has been one variable. The machine re-rules an axis, so it has no way to talk about two things moving together. That's why χ²(k) = ΣZᵢ² was the first thing we couldn't prove: adding needs two variables in the same room. Chapter 14 puts them there.

iolinked.com
Written by Ajai Raj