Session 7: Functions of One Random Variable, Sampling, and the Value of a Measurement

Movement II: One Random Variable

EE 520: Random Processes (Fall 2026). Instructor: John Lipor.

Launch

Every homework simulation so far has quietly called a library sampler: a line like np.random. laplace or np.random.exponential returns a number, and you have trusted it. What actually happened inside that call? By the end of today you could have written the sampler yourself, from a single uniform random number and a formula you will derive. Getting there means answering the more basic question first: if XX is random and you push it through a function to form Y=g(X)Y = g(X), what is the distribution of YY? Every instrument is such a function (a sensor maps a physical quantity to a voltage, a detector maps a field amplitude to a power), so this is the mathematics of modeling measurement itself. We will find the density of Y=g(X)Y = g(X), discover why the formula carries a derivative, turn that machinery around to build samplers, and close by computing something that sounds impossible: the value of a measurement before you take it.

Development

The density of a monotone function of a random variable

The reliable tool for a function of a random variable is the CDF, because it turns a statement about YY into a statement about XX, where we know the distribution. For Y=g(X)Y = g(X), FY(y)=ℙ(Y≤y)=ℙ(g(X)≤y),\begin{equation} \label{eq:cdfpushforward} F_Y(y) = \mathbb{P}(Y \le y) = \mathbb{P}\!\left(g(X) \le y\right), \end{equation} and now everything depends on solving the inequality g(X)≤yg(X) \le y for XX. When gg is strictly increasing this is immediate: g(X)≤yg(X) \le y exactly when X≤g−1(y)X \le g^{-1}(y), so FY(y)=FX(g−1(y))F_Y(y) = F_X\!\left(g^{-1}(y)\right), and differentiating gives the density. This is worth stating as a theorem.

Theorem 1 (Monotone change of variables). Let XX be a continuous random variable with density fXf_X, and let gg be strictly monotone and differentiable on the support of XX, with inverse g−1g^{-1}. Then Y=g(X)Y = g(X) has density fY(y)=fX(g−1(y))|ddyg−1(y)|\begin{equation} \label{eq:cov} f_Y(y) = f_X\!\left(g^{-1}(y)\right) \, \left\lvert \frac{d}{dy}\, g^{-1}(y) \right\rvert \end{equation} for yy in the range of gg, and fY(y)=0f_Y(y) = 0 otherwise.

Proof. Take gg strictly increasing first. Then g−1g^{-1} is increasing, and from [eq:cdfpushforward], FY(y)=ℙ(X≤g−1(y))=FX(g−1(y)).\begin{equation} F_Y(y) = \mathbb{P}\!\left(X \le g^{-1}(y)\right) = F_X\!\left(g^{-1}(y)\right). \end{equation} Differentiate in yy by the chain rule: fY(y)=FY′(y)=fX(g−1(y))ddyg−1(y),\begin{equation} f_Y(y) = F_Y'(y) = f_X\!\left(g^{-1}(y)\right) \, \frac{d}{dy}\, g^{-1}(y), \end{equation} and the derivative is positive, so it equals its own absolute value. If instead gg is strictly decreasing, then g(X)≤yg(X) \le y means X≥g−1(y)X \ge g^{-1}(y), so FY(y)=1−FX(g−1(y))F_Y(y) = 1 - F_X\!\left(g^{-1}(y)\right); differentiating introduces a minus sign, and ddyg−1(y)<0\tfrac{d}{dy} g^{-1}(y) < 0 in this case, so the two signs cancel and the result is again [eq:cov] with the absolute value. The absolute value unifies both cases. ◻

Why is there a derivative in the formula?. A density is a rate, probability per unit length, and gg stretches lengths. A sliver of width dxdx at xx carries mass fX(x)dxf_X(x)\,dx; the map gg sends it to a sliver at y=g(x)y = g(x) whose width is |g′(x)|dx\left\lvert g'(x) \right\rvert\,dx, wider or narrower depending on the local slope of gg. Probability mass is conserved (the same points, relabeled), but it is now spread over a different length, so the density must be rescaled by the reciprocal of that stretch factor, which is exactly |dg−1/dy|\left\lvert dg^{-1}/dy \right\rvert. The derivative is not a technicality; it is the bookkeeping that keeps total probability equal to one after gg distorts the axis.

Figure 1 makes this concrete, using the example we are about to work in full. Follow sliver A of width 0.20.2 on the xx-axis up to the curve and across to the yy-axis. Where gg is flat it lands in a narrower interval (width 0.160.16), so the same mass piles up taller. Sliver B has the same width in xx, but gg is steep there and it lands in an interval of width 0.440.44, so its mass is spread thinner. Each sliver carries the same probability on both axes (about 0.1350.135 for A and 0.1310.131 for B); only its width, and hence its height, changes.

The change of variables as conservation of mass, for g(x)=x2g(x) = x^2 applied to a Rayleigh envelope with σ2=1/2\sigma^2 = 1/2. Each labeled sliver has the same probability under fXf_X (bottom) and under fYf_Y (left); the local slope of gg sets how much its width changes, and the density height changes by the reciprocal factor.

Worked derivation: from envelope to power

Here is Theorem 1 doing real work. A narrowband wireless channel delivers a complex gain whose magnitude, the envelope, is the Rayleigh random variable X≥0X \ge 0 with CDF and density FX(r)=1−e−r2/(2σ2),fX(r)=rσ2e−r2/(2σ2),r≥0.\begin{equation} F_X(r) = 1 - e^{-r^2/(2\sigma^2)}, \qquad f_X(r) = \frac{r}{\sigma^2}\, e^{-r^2/(2\sigma^2)}, \qquad r \ge 0 . \end{equation} The receiver does not act on the envelope but on the instantaneous power it delivers, Y=X2Y = X^2. What is the distribution of YY?

On the support r≥0r \ge 0 the map g(r)=r2g(r) = r^2 is strictly increasing, and that monotonicity is exactly the hypothesis of Theorem 1, which is why we may use it here and could not for rr ranging over all of ℝ\mathbb{R}. Its inverse and derivative are g−1(y)=y,ddyg−1(y)=12y,y≥0.\begin{equation} g^{-1}(y) = \sqrt{y}, \qquad \frac{d}{dy}\, g^{-1}(y) = \frac{1}{2\sqrt{y}}, \qquad y \ge 0 . \end{equation} Substituting into [eq:cov], fY(y)=fX(y)⋅12y=yσ2e−y/(2σ2)⋅12y=12σ2e−y/(2σ2),y≥0.\begin{equation} f_Y(y) = f_X\!\left(\sqrt{y}\right) \cdot \frac{1}{2\sqrt{y}} = \frac{\sqrt{y}}{\sigma^2}\, e^{-y/(2\sigma^2)} \cdot \frac{1}{2\sqrt{y}} = \frac{1}{2\sigma^2}\, e^{-y/(2\sigma^2)}, \qquad y \ge 0 . \end{equation} The y\sqrt{y} from the density and the 1/y1/\sqrt{y} from the derivative cancel, and what remains is an exponential density with rate 1/(2σ2)1/(2\sigma^2), hence mean 2σ22\sigma^2. In words: a Rayleigh envelope produces exponential power. This pairing is not a coincidence of this problem; it reappears in every fading-channel course you will take, and it is worth committing to memory.

Now compute an outage probability (the chance the delivered power falls below a threshold tt) two ways, to make a methodological point. The first way transforms the event back to the envelope domain and uses the CDF we already had: ℙ(Y<t)=ℙ(X2<t)=ℙ(X<t)=FX(t)=1−e−t/(2σ2).\begin{equation} \mathbb{P}(Y < t) = \mathbb{P}\!\left(X^2 < t\right) = \mathbb{P}\!\left(X < \sqrt{t}\right) = F_X\!\left(\sqrt{t}\right) = 1 - e^{-t/(2\sigma^2)} . \end{equation} The second way integrates the density we just derived: ℙ(Y<t)=∫0t12σ2e−y/(2σ2)dy=1−e−t/(2σ2).\begin{equation} \mathbb{P}(Y < t) = \int_0^t \frac{1}{2\sigma^2}\, e^{-y/(2\sigma^2)}\, dy = 1 - e^{-t/(2\sigma^2)} . \end{equation} Same answer, of course, but the first route never needed fYf_Y at all: it rewrote the question about YY as a question about XX and read off a CDF we were handed. That is the general lesson.

Transform the event, not the density. Whenever you can, rewrite a probability about Y=g(X)Y = g(X) as a probability about XX and evaluate it with FXF_X. Deriving the full density fYf_Y is more work and more error-prone (it is where the stray derivative gets dropped), and you often do not need it. Reach for the change-of-variables density formula only when you actually need the density of YY as a function. Otherwise, transform the event.

Pitfall. Two errors sink most change-of-variables computations. The first is dropping the derivative: writing fY(y)=fX(g−1(y))f_Y(y) = f_X(g^{-1}(y)) and forgetting the factor |dg−1/dy|\left\lvert dg^{-1}/dy \right\rvert. Catch it by dimensional analysis: fYf_Y must have units of 1/[y]1/[y], and only the derivative factor supplies the [x]/[y][x]/[y] conversion, so an answer missing it is dimensionally wrong before it is numerically wrong, and “it integrates to one” is not a real check unless you actually verify it. The second is applying [eq:cov] to a non-monotone gg: the formula requires strict monotonicity on the support so that g−1g^{-1} is single-valued, and we will simply never need the general case. When gg is not monotone, return to the CDF and solve g(X)≤yg(X) \le y by hand.

The same maneuver, applied to the map P=10PdB/10P = 10^{P_{\mathrm{dB}}/10} with a Gaussian PdBP_{\mathrm{dB}}, produces the log-normal shadowing model that describes slow signal fading behind obstacles. That map is monotone too, so Theorem 1 applies verbatim: you will carry out the derivation, and the corresponding two-way outage computation, in HW3.

A modern payoff

Theorem 1 is not a museum piece. The change-of-variables formula is the entire probabilistic content of normalizing flows, a family of modern generative models that build a complicated density by pushing a simple one (a Gaussian) through a learned invertible map and accounting for the stretch with exactly the derivative factor in [eq:cov]. The idea is the one you just learned. Its differentiable-sampling cousin is the reparameterization trick behind variational autoencoders: instead of sampling X∼𝒩(μ,σ2)X \sim {\mathcal N}(\mu, \sigma^2) directly, write X=μ+σZ,Z∼𝒩(0,1),\begin{equation} X = \mu + \sigma Z, \qquad Z \sim {\mathcal N}(0,1), \end{equation} so that the randomness sits in a fixed ZZ and the parameters μ,σ\mu, \sigma enter through a smooth, differentiable map (in a VAE, μ\mu and σ\sigma are themselves outputs of a network, so gradients flow through them to its weights). A student who can say why there is a derivative in the density formula owns these ideas; a student who cannot will use those tools as incantations.

Inverse-CDF sampling: building a random variable from a uniform

We now run the machinery backwards. A computer’s random-number generator produces U∼Uniform[0,1]U \sim \mathrm{Uniform}[0,1] and essentially nothing else; every other distribution must be manufactured from it. The change-of-variables idea tells us how.

Proposition 1 (Inverse-CDF sampling). Let FF be a continuous, strictly increasing CDF with inverse F−1F^{-1}, and let U∼Uniform[0,1]U \sim \mathrm{Uniform}[0,1]. Then the random variable X=F−1(U)X = F^{-1}(U) has CDF FF.

Proof. Using that FF is increasing (so F−1(U)≤x⇔U≤F(x)F^{-1}(U) \le x \iff U \le F(x)) and that UU is uniform (so ℙ(U≤u)=u\mathbb{P}(U \le u) = u for u∈[0,1]u \in [0,1]), ℙ(F−1(U)≤x)=ℙ(U≤F(x))=F(x).\begin{equation} \mathbb{P}\!\left(F^{-1}(U) \le x\right) = \mathbb{P}\!\left(U \le F(x)\right) = F(x). \end{equation} Thus X=F−1(U)X = F^{-1}(U) has exactly the CDF FF, as claimed. ◻

The recipe. To draw a sample from any distribution with an invertible CDF FF: draw U∼Uniform[0,1]U \sim \mathrm{Uniform}[0,1], then return X=F−1(U)X = F^{-1}(U). Feeding uniform draws through F−1F^{-1} reproduces FF exactly. This one line is the secret inside a great many library samplers.

Make it concrete with the exponential, whose draws you have been making since Session 6. Its CDF is F(x)=1−e−λxF(x) = 1 - e^{-\lambda x}. Set U=F(x)U = F(x) and solve for xx: U=1−e−λx⇒e−λx=1−U⇒x=−ln⁡(1−U)λ.\begin{equation} U = 1 - e^{-\lambda x} \;\Longrightarrow\; e^{-\lambda x} = 1 - U \;\Longrightarrow\; x = -\frac{\ln(1 - U)}{\lambda}. \end{equation} Two lines, and the mystery is gone: np.random.exponential is −ln⁡(1−U)/λ-\ln(1-U)/\lambda with a uniform UU underneath. (One often sees −ln⁡(U)/λ-\ln(U)/\lambda instead; since UU and 1−U1 - U have the same uniform distribution, either is correct.)

Remark 1. Inverse sampling plus a uniform generator is the whole secret of a great many library samplers. When FF has no closed-form inverse, other constructions (rejection sampling, among them) take over, but those are beyond our scope, and a single uniform through F−1F^{-1} suffices for every sampler this course needs.

The envelope-to-power example gave you a Rayleigh XX; HW3 asks you to close the loop and build the Rayleigh sampler your simulator has quietly been using, by inverting its CDF exactly as we just inverted the exponential’s.

A second sampler: the Gumbel, and what it really is

Session 6 met the Gumbel as the limit of the last of many exponential alarms. Apply the inverse-CDF recipe to the standard Gumbel CDF F(x)=exp⁡(−e−x)F(x) = \exp(-e^{-x}). Set U=F(x)U = F(x) and solve for xx: U=exp⁡(−e−x)⇒−ln⁡U=e−x⇒x=−ln⁡(−lnU).\begin{equation} U = \exp\!\left(-e^{-x}\right) \;\Longrightarrow\; -\ln U = e^{-x} \;\Longrightarrow\; x = -\ln\!\left(-\ln U\right). \end{equation} So G=−ln⁡(−ln⁡U)G = -\ln(-\ln U) is a standard Gumbel draw. Look at the inner piece: −ln⁡U-\ln U is exactly the exponential sampler we just built (with λ=1\lambda = 1, and with UU in place of 1−U1 - U, which is equally valid). So a Gumbel is the negative logarithm of an exponential: G=−ln⁡E,E∼Exponential(1).\begin{equation} G = -\ln E, \qquad E \sim \mathrm{Exponential}(1). \end{equation} Confirm this directly, working with the CDF as in the proof of Theorem 1. The map e↦−ln⁡ee \mapsto -\ln e is strictly decreasing, so the inequality flips: ℙ(−ln⁡E≤x)=ℙ(E≥e−x)=exp⁡(−e−x),\begin{equation} \mathbb{P}(-\ln E \le x) = \mathbb{P}\!\left(E \ge e^{-x}\right) = \exp\!\left(-e^{-x}\right), \end{equation} which is the standard Gumbel CDF.

This explains the parallel noted in Session 6, where minima of exponentials added their rates and maxima of Gumbels added their weights eμke^{\mu_k}. Shifting by μ\mu turns G=−ln⁡EG = -\ln E into a recipe for every Gumbel: if E∼Exponential(1)E \sim \mathrm{Exponential}(1), then μ−ln⁡E\mu - \ln E has the Gumbel(μ)\mathrm{Gumbel}(\mu) distribution. Writing μ−ln⁡E=−ln⁡(Ee−μ)\mu - \ln E = -\ln\!\left(E e^{-\mu}\right), the variable Ee−μE e^{-\mu} is exponential with rate eμe^{\mu}. Now take independent Gk∼Gumbel(μk)G_k \sim \mathrm{Gumbel}(\mu_k) and generate each as μk−ln⁡Ek\mu_k - \ln E_k from its own independent Ek∼Exponential(1)E_k \sim \mathrm{Exponential}(1). This loses nothing, since the distribution of max⁡kGk\max_k G_k depends only on the distributions of the independent GkG_k. Because −ln-\ln is decreasing, it turns the maximum of Gumbels into the minimum of exponentials: maxkGk=−ln⁡(minkEke−μk),\begin{equation} \max_k G_k = -\ln\!\left(\min_k E_k e^{-\mu_k}\right), \end{equation} and the minimum of independent exponentials with rates eμke^{\mu_k} is exponential with rate ∑keμk\sum_k e^{\mu_k}. Undoing the logarithm gives Gumbel(ln∑keμk)\mathrm{Gumbel}\!\left(\ln \sum_k e^{\mu_k}\right), a second proof of Session 6’s max-stability proposition. “Rates add” and “eμe^{\mu}’s add” are the same fact seen through a decreasing monotone map.

Keep G=−ln⁡(−ln⁡U)G = -\ln(-\ln U) in mind for this session’s AI corner. The corner samples a token by cutting [0,1][0,1] into segments; Session 9 will show a second way to make the same draw, using one Gumbel per token and an argmax.

The value of a measurement

Session 3 turned a belief into an action by maximizing expected utility: with a finite action set and utility u(a,θ)u(a, \theta), the best action under the current belief earns V0=maxa𝔼[u(a,θ)],\begin{equation} \label{eq:v0} V_0 = \max_a \mathbb{E}\!\left[u(a, \theta)\right], \end{equation} the value of acting now. But we usually have the option to observe something first (run a sensor, buy a measurement YY) and only then act, choosing the best action under the posterior belief given YY. Since we do not yet know what YY will be, we average that improved decision over the possible observations: V1=𝔼Y[maxa𝔼[u(a,θ)|Y]].\begin{equation} \label{eq:v1} V_1 = \mathbb{E}_Y\!\left[\max_a \mathbb{E}\!\left[u(a, \theta) \,|\,Y\right]\right]. \end{equation} The improvement V1V_1 buys over V0V_0 is worth naming.

Definition 1 (Value of a measurement). The value of a measurement YY is VoM=V1−V0,\begin{equation} \mathrm{VoM} = V_1 - V_0, \end{equation} the expected gain in achievable utility from observing YY before acting, versus acting immediately.

Proposition 2 (Information never hurts in expectation). VoM≥0\mathrm{VoM} \ge 0.

Proof. For any fixed action aa, the tower property gives 𝔼[u(a,θ)]=𝔼Y[𝔼[u(a,θ)|Y]]\mathbb{E}\left[u(a,\theta)\right] = \mathbb{E}_Y\!\left[\mathbb{E}\left[u(a,\theta) \,|\,Y\right]\right]. Taking the best fixed action on the left and comparing, V0=maxa𝔼Y[𝔼[u(a,θ)|Y]]≤𝔼Y[maxa𝔼[u(a,θ)|Y]]=V1,\begin{equation} V_0 = \max_a \mathbb{E}_Y\!\left[\mathbb{E}\left[u(a,\theta) \,|\,Y\right]\right] \le \mathbb{E}_Y\!\left[\max_a \mathbb{E}\left[u(a,\theta) \,|\,Y\right]\right] = V_1, \end{equation} where the inequality is the Jensen-flavored fact that a max of averages is at most the average of maxes: committing to one action in advance can never beat choosing the best action separately in each YY-world. Hence VoM=V1−V0≥0\mathrm{VoM} = V_1 - V_0 \ge 0. ◻

The proposition says information is never harmful on average, but it earns its keep only if its value clears its price. A measurement that costs cc is worth taking precisely when VoM>c\mathrm{VoM} > c; otherwise act now and save the cost. HW3 makes that comparison; worked example (b) below asks what happens to VoM\mathrm{VoM} when the reading is degraded on its way to us.

Worked examples

(a) Running the sampler backward: every continuous variable hides a uniform

Inverse-CDF sampling turns a uniform into any distribution we like. Run it the other way. Take a continuous random variable XX with CDF FF and form the new random variable U=F(X)U = F(X), the CDF evaluated at its own random argument. What is the distribution of UU? The tempting guess is that it depends on XX: a skewed XX should give a skewed UU, a heavy-tailed XX something else again.

Proposition 3 (Probability integral transform). Let XX have a CDF FF that is continuous and strictly increasing on the support of XX. Then U=F(X)U = F(X) is Uniform[0,1]\mathrm{Uniform}[0,1], whatever the distribution of XX.

Proof. UU takes values in [0,1][0,1]. For u∈(0,1)u \in (0,1), transform the event as in the proof of Proposition 1, now in the other direction: since FF is increasing, F(X)≤uF(X) \le u exactly when X≤F−1(u)X \le F^{-1}(u), so ℙ(U≤u)=ℙ(X≤F−1(u))=F(F−1(u))=u,\begin{equation} \mathbb{P}(U \le u) = \mathbb{P}\!\left(X \le F^{-1}(u)\right) = F\!\left(F^{-1}(u)\right) = u, \end{equation} which is the Uniform[0,1]\mathrm{Uniform}[0,1] CDF. ◻

The guess fails for a reason Theorem 1 makes visible. The map g=Fg = F is increasing with g′=fXg' = f_X, so dduF−1(u)=1/fX(x)\tfrac{d}{du} F^{-1}(u) = 1 / f_X(x) at x=F−1(u)x = F^{-1}(u), and fU(u)=fX(x)⋅1fX(x)=1.\begin{equation} f_U(u) = f_X(x) \cdot \frac{1}{f_X(x)} = 1 . \end{equation} In the language of Figure 1: FF is steepest exactly where XX is most likely, so it stretches the dense regions of XX and squeezes the sparse ones by precisely the amount that flattens the density. Uniforms in, any distribution out (Proposition 1); any continuous distribution in, uniforms out (Proposition 3).

The hypothesis matters. Let X∼Bernoulli(p)X \sim \mathrm{Bernoulli}(p). Then F(0)=1−pF(0) = 1 - p and F(1)=1F(1) = 1, so F(X)F(X) equals 1−p1 - p with probability 1−p1 - p and equals 11 with probability pp: two atoms, nothing like a uniform. A jump in FF becomes an atom of F(X)F(X), which is why the proposition needs FF continuous.

Payoff: is a model’s uncertainty honest?

A weather forecaster, or a machine-learning model that reports uncertainty, issues a predictive CDF FtF_t for each outcome XtX_t before it is observed. If the model is right, FtF_t is the true CDF of XtX_t, so by Proposition 3 each Ut=Ft(Xt)U_t = F_t(X_t) is uniform, and a histogram of the UtU_t over many forecasts should be flat. The check needs only the outcomes and the model’s own CDFs, never the true distribution. Departures from flatness diagnose the error. Suppose the truth is X∼𝒩(0,1)X \sim {\mathcal N}(0,1) but the model claims 𝒩(0,s2){\mathcal N}(0, s^2), so U=Φ(X/s)U = \Phi(X/s). Transforming the event once more, ℙ(U≤u)=ℙ(X≤sΦ−1(u))=Φ(sΦ−1(u)).\begin{equation} \mathbb{P}(U \le u) = \mathbb{P}\!\left(X \le s\,\Phi^{-1}(u)\right) = \Phi\!\left(s\,\Phi^{-1}(u)\right) . \end{equation} An overconfident model, with s=1/2s = 1/2 (error bars half as wide as they should be), puts Φ(12Φ−1(0.1))≈0.26\Phi\!\left(\tfrac 12 \Phi^{-1}(0.1)\right) \approx 0.26 of the outcomes in the bottom tenth of its predictive distribution and, by symmetry, another 0.260.26 in the top tenth. Over half the outcomes land in the outer 20%20\%, and the histogram is U-shaped. An underconfident model, with s=2s = 2, puts only about 0.0050.005 in each outer tenth and 0.390.39 in the middle fifth: a hump. A flat histogram is the first test that a model’s stated uncertainty must pass before anyone should act on it.

(b) Can known noise be undone?

Return to the decision layer with a concrete problem. A target is either present (θ=1\theta = 1) or absent (θ=0\theta = 0), and we must declare one, with utilities

Table 1: Action; θ=1\theta = 1 (present); θ=0\theta = 0 (absent)
Action θ=1\theta = 1 (present) θ=0\theta = 0 (absent)
Declare present +10+10 −20-20 (false alarm)
Declare absent −40-40 (miss) 00

A sensor reading Y∈{0,1}Y \in \left\{0, 1\right\} obeys ℙ(Y=1|θ=1)=0.9\mathbb{P}(Y = 1 \,|\,\theta = 1) = 0.9 and ℙ(Y=1|θ=0)=0.2\mathbb{P}(Y = 1 \,|\,\theta = 0) = 0.2. At prior ℙ(θ=1)=0.4\mathbb{P}(\theta = 1) = 0.4, working through the definitions gives V0=−8V_0 = -8 (declare present without looking) and VoM(Y)=7.6\mathrm{VoM}(Y) = 7.6.

Now suppose the reading does not reach us directly. It is relayed over a link that flips the bit with probability ε\varepsilon, independently of everything else, and we see only the received bit ZZ. We know ε\varepsilon, so we know ZZ’s likelihoods exactly: by total probability over YY, ℙ(Z=1|θ=1)=0.9(1−ε)+0.1ε,ℙ(Z=1|θ=0)=0.2(1−ε)+0.8ε.\begin{equation} \mathbb{P}(Z = 1 \,|\,\theta = 1) = 0.9(1 - \varepsilon) + 0.1\,\varepsilon, \qquad \mathbb{P}(Z = 1 \,|\,\theta = 0) = 0.2(1 - \varepsilon) + 0.8\,\varepsilon . \end{equation} A natural hope is that Bayes’ rule with these correct likelihoods undoes the damage, or at least that some clever enough rule for acting on ZZ recovers what the link took. It cannot.

Proposition 4 (Noise cannot add value). Let ZZ be obtained from YY by flipping it with probability ε\varepsilon, independently of (θ,Y)(\theta, Y). Then for every prior and every utility, VoM(Z)≤VoM(Y)\mathrm{VoM}(Z) \le \mathrm{VoM}(Y).

Proof. Think in rules. A decision rule dd assigns an action to each possible reading. Choosing the best action separately for each reading, as V1V_1 does, is the same as choosing the best rule, because 𝔼[u(d(Y),θ)]=∑yℙ(Y=y)𝔼[u(d(y),θ)|Y=y]\mathbb{E}\left[u(d(Y), \theta)\right] = \sum_y \mathbb{P}(Y = y)\, \mathbb{E}\left[u(d(y), \theta) \,|\,Y = y\right] and each term can be maximized on its own. So V1(Y)=max⁡d𝔼[u(d(Y),θ)]V_1(Y) = \max_d \mathbb{E}\left[u(d(Y), \theta)\right], and likewise for ZZ.

Fix any rule dd for acting on ZZ. Condition on whether the link flipped. The flip is independent of (θ,Y)(\theta, Y): with probability 1−ε1 - \varepsilon we have Z=YZ = Y, and with probability ε\varepsilon we have Z=1−YZ = 1 - Y, so 𝔼[u(d(Z),θ)]=(1−ε)𝔼[u(d(Y),θ)]+ε𝔼[u(d(1−Y),θ)].\begin{equation} \mathbb{E}\left[u(d(Z), \theta)\right] = (1 - \varepsilon)\, \mathbb{E}\left[u(d(Y), \theta)\right] + \varepsilon\, \mathbb{E}\left[u(d(1 - Y), \theta)\right] . \end{equation} Both d(Y)d(Y) and d(1−Y)d(1 - Y) are rules that act on YY, so each expectation on the right is at most V1(Y)V_1(Y), and so is their average. Maximizing over dd gives V1(Z)≤V1(Y)V_1(Z) \le V_1(Y). The act-now value V0V_0 does not involve the measurement, so subtracting it from both sides gives the claim. ◻

This is the argument behind Proposition 2 again: a rule acting on ZZ is an average of rules acting on YY, and an average cannot beat the best. In fact Proposition 2 is the special case ε=1/2\varepsilon = 1/2. Then ZZ is a fair coin flip independent of θ\theta, observing it leaves the prior unchanged, so V1(Z)=V0V_1(Z) = V_0, and Proposition 4 reads V0≤V1(Y)V_0 \le V_1(Y).

The loss is fast. At prior 0.40.4, the value of the relayed reading is

Table 2: Flip probability ε\varepsilon; 00; 0.10.1; 0.30.3; 0.50.5
Flip probability ε\varepsilon 00 0.10.1 0.30.3 0.50.5
VoM(Z)\mathrm{VoM}(Z) 7.67.6 5.285.28 0.640.64 00

A link that delivers the right bit 70%70\% of the time leaves less than a tenth of the reading’s value. Knowing ε\varepsilon exactly does not help: Bayes’ rule with ZZ’s likelihoods extracts everything ZZ contains, and the loss is in ZZ, not in the inference.

Deterministic processing is the easier case. If Z=h(Y)Z = h(Y) for a fixed function hh (quantizing a reading, compressing it, or reducing it to a summary before the decision is made), then any rule acting on ZZ is already a rule acting on YY, namely d(h(Y))d(h(Y)), so V1(Z)≤V1(Y)V_1(Z) \le V_1(Y) with no averaging needed. Noise or processing, the conclusion is the same: what happens to a reading between the sensor and the decision can lose value but never create it.

Posterior →\to Action. With ε=0.1\varepsilon = 0.1, the receiver does everything right: it runs Bayes’ rule with ZZ’s own likelihoods, getting ℙ(θ=1|Z=1)≈0.68\mathbb{P}(\theta = 1 \,|\,Z = 1) \approx 0.68 and ℙ(θ=1|Z=0)≈0.14\mathbb{P}(\theta = 1 \,|\,Z = 0) \approx 0.14, and declares present exactly when the posterior exceeds 2/72/7, the point where the two actions break even. That is the best anyone holding ZZ can do. But the clean reading would have given posteriors 0.750.75 and 1/13≈0.0771/13 \approx 0.077, further from the threshold on both sides, and acting on YY is right more often than acting on ZZ. The action follows the posterior, the posterior can only be as decisive as the evidence, and the value lost on the link is lost for good.

One question to carry out of the room, asked but deliberately left unanswered here. For the clean sensor YY, compute VoM\mathrm{VoM} for a range of priors ℙ(θ=1)\mathbb{P}(\theta = 1), from near 00 to near 11, and plot it against the prior. The curve has the shape of Figure 2. Where does it peak, and where does it fall to zero? Think about what a measurement can and cannot do for you when you are already almost sure, and settle the question in HW3.

Value of a measurement as a function of the prior probability that the target is present, for the decision problem of this section with the clean sensor YY.

Consolidation

AI corner: how a model picks a token (sampling and temperature). AI corner 1 said a language model is, mathematically, a conditional pmf; today we learned how machines draw from distributions, so put the two together. When a language model emits a token it samples from a categorical pmf over its finite vocabulary, the finite-alphabet cousin of today’s inverse-CDF sampler. Partition [0,1][0,1] into segments whose lengths are the cumulative token probabilities, draw one U∼Uniform[0,1]U \sim \mathrm{Uniform}[0,1], and the segment it lands in names the emitted token. Before drawing, a temperature TT reshapes the pmf from scores (“logits”) ziz_i via pi(T)∝exp⁡(zi/T)p_i(T) \propto \exp(z_i / T). With logits z=(2.0,1.0,0.5,−1.0)z = (2.0,\, 1.0,\, 0.5,\, -1.0), the top token has probability 0.8420.842 at T=0.5T = 0.5, 0.6090.609 at T=1T = 1, and 0.4340.434 at T=2T = 2: as T→0T \to 0 the pmf collapses onto the arg max\operatorname*{arg\,max} (deterministic, “greedy” decoding), while large TT flattens it toward uniform (diverse, but more error-prone). Temperature is a knob on the pmf, nothing more mysterious. So-called top-pp (“nucleus”) sampling is even more familiar: keep the smallest set of tokens whose cumulative probability reaches pp, renormalize, and sample: literally Session 1’s restrict-and-renormalize.

Work these in class.

  1. (Monotone change of variables.) Let X∼Uniform[1,2]X \sim \mathrm{Uniform}[1,2] and Y=1/XY = 1/X. Show g(x)=1/xg(x) = 1/x is strictly monotone on [1,2][1,2], then use Theorem 1 to find fYf_Y and its support.
    Answer: gg is strictly decreasing, with g−1(y)=1/yg^{-1}(y) = 1/y and ddyg−1(y)=−1/y2\tfrac{d}{dy} g^{-1}(y) = -1/y^2. Since fX≡1f_X \equiv 1 on [1,2][1,2] and YY ranges over [12,1][\tfrac12, 1], fY(y)=1⋅1/y2=1/y2f_Y(y) = 1 \cdot 1/y^2 = 1/y^2 on [12,1][\tfrac12, 1] (check: ∫1/21y−2dy=1\int_{1/2}^{1} y^{-2}\,dy = 1).

  2. (Inverse-CDF sampling.) A random variable has CDF F(x)=x2F(x) = x^2 on [0,1][0,1]. Write the one-line rule that turns a uniform draw UU into a sample of XX.
    Answer: invert U=x2U = x^2 to get X=F−1(U)=UX = F^{-1}(U) = \sqrt{U}; return the square root of a uniform draw.

  3. (Value of a measurement, conceptual.) In one or two sentences, explain why VoM≥0\mathrm{VoM} \ge 0 always, yet a rational agent may still decline to measure.
    Answer: By Proposition 2 the expected best-case utility can only rise (or stay flat) once you may adapt the action to the reading, so VoM≥0\mathrm{VoM} \ge 0; but the measurement has a cost cc, and when VoM<c\mathrm{VoM} < c the information is not worth its price, so acting now is optimal.

Synthesis

The course thesis asks what is uncertain, what is observed, and how observation should change belief and action; this session worked the machinery of observation itself. Pushing a random variable through a monotone function gave the density of Y=g(X)Y = g(X), and the derivative in that formula turned out to be honest bookkeeping: a density is a rate, gg stretches lengths, and mass (not density) is what is conserved. Running the same idea backwards produced inverse-CDF sampling, the one-line reason your simulators work at all (the Gumbel sampler even revealed a Gumbel to be the negative logarithm of an exponential). Run backwards once more, it showed that every continuous variable pushed through its own CDF is uniform, which is how one checks whether a model’s stated uncertainty is honest. The same change-of-variables identity is the whole probabilistic content of the generative models students meet later. Then the decision layer returned: a measurement’s worth is VoM=V1−V0\mathrm{VoM} = V_1 - V_0, computable before the measurement is taken, never negative in expectation, never increased by noise or processing between the sensor and the decision, and worth paying for only when it clears its cost. Next session we take the decisive step to two random variables at once (joint distributions, marginals, and conditionals), where Bayes’ rule returns yet again, now wearing densities.

Self-check questions

  1. In the change-of-variables formula, why must fYf_Y carry the factor |dg−1/dy|\left\lvert dg^{-1}/dy \right\rvert? Give the units-based reason.
    Answer: fYf_Y is a density, with units of 1/[y]1/[y]; fX(g−1(y))f_X(g^{-1}(y)) has units 1/[x]1/[x], and |dg−1/dy|\left\lvert dg^{-1}/dy \right\rvert supplies the [x]/[y][x]/[y] conversion so the units come out right. Physically, gg stretches lengths, so the density must be rescaled by the reciprocal stretch factor to conserve probability mass.

  2. You have U∼Uniform[0,1]U \sim \mathrm{Uniform}[0,1] and want a sample from a distribution with continuous, strictly increasing CDF FF. What do you return, and why does it work?
    Answer: return X=F−1(U)X = F^{-1}(U); then ℙ(X≤x)=ℙ(U≤F(x))=F(x)\mathbb{P}(X \le x) = \mathbb{P}(U \le F(x)) = F(x), so XX has CDF FF.

  3. A colleague says “a measurement can only help, so always measure.” Where is the error?
    Answer: VoM≥0\mathrm{VoM} \ge 0 holds only for the expected utility and ignores cost; measuring is optimal only when VoM\mathrm{VoM} exceeds the measurement’s cost, and it can also fail to help on a particular reading even when it helps on average.