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.
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.
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.
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.
φ'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 φ².
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.
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.
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.
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.
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.
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.
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.
Nothing to hide behind.
An exchange rate.
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.
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.
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.
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.
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 a²", and because SD and variance have fused into one fuzzy thing in your head called "spread". So let's use units instead.
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 a², 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.
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.
"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.
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: "Z² 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.
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.
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.
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.
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.
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.
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.
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.