A random variable turns the outcome of an experiment into a number, and a distribution says how likely each number is. This chapter, the longest of the book, builds the working vocabulary of probability: the binomial and hypergeometric laws from counting, probability functions and densities, cumulative distribution functions, the mean and the variance, joint, marginal and conditional distributions, independence and covariance, the laws of sums, products, ratios and order statistics, and moment-generating functions. The book proves much of this at the level of examples; these notes add the missing arguments (the identities behind the hypergeometric law, why a density is the derivative of a cdf, expectations of functions, the order-statistic density from a binomial tail, conditional expectation, the mgf as a derivative generator and its uniqueness), and repair three small slips of the printed text.
Course home Ch. 1 Introduction Ch. 2 Probability Ch. 3 Random variables Ch. 4 Special distributions Ch. 5 Estimation Ch. 6 Hypothesis testing Ch. 7 Normal-based inference Ch. 8 Types of data Ch. 9 Two-sample inference Ch. 10 Goodness of fit Ch. 11 Regression Ch. 12 Analysis of variance Ch. 13 Randomized blocks Ch. 14 Nonparametric statistics
Each Filling the gap box completes a step or a proof the book leaves out, and each selected question asks you to apply the chapter. Try it yourself first. When you are stuck, open Hint 1; the next hint unlocks one minute after you open the previous one, so take one hint at a time and think about it before moving on: the key idea first, then the tools, then the steps, with intermediate results to aim for. The full proof or solution appears after the last hint and unlocks two minutes later: use it to check your own argument. If you use a generative AI assistant, use it the same way: ask for a hint or for the next step only, then check what it says against these notes (why I teach this way). Spotted a mistake? Use the Report an error link at the end of each box: confirmed errors are corrected and listed, with thanks, in the errata.
They follow the book. Sections carry the book's numbers (3.1 to 3.13) and numbered items keep theirs (Definition 3.4.1, Theorem 3.10.2, Example 3.8.3, Case Study 3.2.1). Everything is written in new words; the book is cited for each result, example and figure, and displayed equations that the book numbers keep its number, e.g. \((3.2.1)\).
Filling the gaps. Wherever the book says "it can be shown", leaves an exercise to the reader, defers to a reference or works an example too fast to follow, an orange Filling the gap box gives the full argument. Proofs and derivations start hidden: open one with its bar, or use the button below. Each gap box and each selected question offers graded hints, one at a time, before the full solution.
Figures and demonstrations. Thirteen figures of the chapter (3.2.2, 3.4.1 to 3.4.9, 3.7.2, 3.10.1 and 3.11.1) are reproduced; three own figures (x3.1 to x3.3) set the book's goodness-of-fit tables against their models, compare sampling with and without replacement and show the densities of the five order statistics of a sample. The schematic drawings of the book are not redrawn. All are computed by the Python code. The ▶ Demo boxes open an interactive demonstration already set to the case being discussed.
R. J. Larsen and M. L. Marx, An Introduction to Mathematical Statistics and Its Applications, 6th edition, Pearson (2018), Chapter 3, pages 102–217. Section, case-study, figure, equation and question numbers below refer to this book. Further reading is listed in the references.
The explanations, derivations, figures and code are my own; equations are cited by their numbers in the book.
Everything in this chapter is also developed, at other levels and in other words, in the companion courses of this site. Where a proof there is complete, these notes give the statement and a short argument and link to it.
New here: the hypergeometric identities and the binomial limit with a coupling bound (Filling the gap 3.1 to 3.3), why the exponential curve fits the geometric bars (3.5), the tail-sum formula and the truncated St. Petersburg game (3.9), the optimal production level of Example 3.5.13 (3.11), a corrected proof for ratios and products (3.17), the order-statistic density from a binomial tail (3.21), memorylessness as a characterisation (3.24) and a pair of distributions with the same moments but different laws (3.27).
Notation. \(\P\), \(\E\), \(\V\), \(\Cov\) are probability, mean, variance and covariance. A probability function is \(p_X(k)=\P(X=k)\), a density \(f_Y(y)\), a cdf \(F_X(t)=\P(X\le t)\) (the book calls both \(p_X\) and \(f_Y\) "pdf"). \(\binom nk=n!/(k!(n-k)!)\), \(\mu=\E X\), \(\sigma^2=\V X\). A random sample is \(Y_1,\dots,Y_n\) independent with a common law, and \(Y'_1<\dots<Y'_n\) are its order statistics.
Prerequisites. Chapter 2 of the book: sample spaces, axioms, conditional probability, independence and counting (Chapter 1 of these notes gives the overview).
pp. 102–103 Chapter 2 of the book assigned probabilities to events, sets of sample outcomes. Usually the individual outcome is far more detailed than the question asked of it. If eight patients are each tested for an allergic reaction, the sample space has \(2^8=256\) sequences of yes and no; if only the number of reactions matters, the sequence (yes, no, no, yes, no, no, yes, no) can be replaced by the number 3, and the 256 outcomes collapse to the nine values \(0,1,\dots,8\). A random variable is such a rule, a function \(X\) that assigns a real number \(X(s)\) to every sample outcome \(s\). It is discrete if it takes finitely or countably many values and continuous if its values fill an interval. A random variable also changes what "an event" means: \(\{X\le 3\}\) is the set of outcomes \(s\) with \(X(s)\le3\), and the probability \(\P(X\le3)\) is inherited from the probability on the original space.
The rest of the chapter is the toolkit for working with these numbers: how to describe their law (probability function, density, cdf), summarise it (mean, variance, moments), combine several of them (joint laws, sums, ratios, order statistics, conditioning) and encode it (moment-generating function).
See also (companion courses): Section 2.1 and Definition 2.1 of the graduate course for the formal definition of a random variable as a measurable function; Section 2.2 of the machine-learning course.
pp. 103–104 Toss a coin \(n\) times, heads with probability \(p\) on each toss, independently. A particular sequence with \(k\) heads has probability \(p^k(1-p)^{n-k}\), and there are \(\binom nk\) such sequences, so the number of heads has the following law.
In \(n\) independent trials, each a success with probability \(p\), the number \(X\) of successes satisfies
\[ \P(X=k)=\binom nk p^k(1-p)^{n-k},\qquad k=0,1,\dots,n. \]The book proves this by the counting argument above. The probabilities sum to 1 because, by the binomial theorem, \(\sum_k\binom nk p^k(1-p)^{n-k}\)
pp. 104–107 Examples 3.2.1 to 3.2.4 apply this directly. In Example 3.2.2 (a pharmaceutical test on 30 monkeys, decision rule "continue only if at least 16 improve") the chance that a drug that works 60% of the time is wrongly dropped is \(\P(X\le15)=0.1754\) for \(X\sim\Bin(30,0.6)\), and the chance that a drug that works only half the time is wrongly kept is \(\P(X\ge16)=0.4278\) for \(X\sim\Bin(30,0.5)\); the book rounds the second to 0.43. Example 3.2.4 (ten colleges, each needing a technician with probability 0.2, a pool of five) gives \(\P(X>5)=0.0064\), about one college-day in 200.
pp. 106–107 Example 3.2.3 (the Stanley Cup) asks how long a best-of-seven series lasts if two teams are evenly matched. For team A to win in six games it must win exactly three of the first five and then the sixth: \[\binom53(1/2)^5\cdot\frac12=0.15625\]; doubling for team B gives \[\P(6\text{ games})=0.3125\]. The four lengths are \(0.125,\ 0.25,\ 0.3125,\ 0.3125\) (Table 3.2.3 of the book sets these against the 68 series played from 1947 to 2015, of lengths 4, 5, 6, 7 in 17, 16, 21, 14 cases). The fit is poor, with too many short series. Two explanations are natural: the teams are not evenly matched (\(p\ne1/2\)), or games are not independent. With general \(p\) the probability of a series of \(g\) games is \(\binom{g-1}{3}\{p^4q^{g-4}+q^4p^{g-4}\}\) (\(q=1-p\)); choosing the \(p\) that maximises the likelihood of the 68 observed lengths gives \(p=0.676\), and then the model's four probabilities are \(0.220,\ 0.300,\ 0.270,\ 0.210\), close to the observed proportions \(0.250,\ 0.235,\ 0.309,\ 0.206\) (Figure x3.1(b)). The mismatch between the finalists is therefore enough to explain the data; momentum need not be invoked.
fig_x3_1.pp. 108–109 The binomial law corresponds to drawing with replacement from an urn. Now take an urn with \(r\) red and \(w\) white chips, \(r+w=N\), and draw \(n\) of them at once, without replacement.
The number \(X\) of red chips among the \(n\) drawn satisfies
\[ \P(X=k)=\frac{\binom rk\binom w{n-k}}{\binom Nn}, \tag{3.2.1} \]for the integers \(k\) with \(\max(0,n-w)\le k\le\min(n,r)\). The proof (the book's) counts: there are \(\binom Nn\) equally likely samples, and \(\binom rk\binom w{n-k}\) of them contain \(k\) red and \(n-k\) white chips. Drawing the chips one after another in order, without replacement, gives the same law (Question 3.2.28 of the book).
The book defines the law by counting and never checks that (3.2.1) sums to 1. It does, and the reason is an identity of independent interest.
Two ways of counting the same thing: what does \((1+x)^r(1+x)^w=(1+x)^{r+w}\) say about the coefficient of \(x^n\)?
Expand both factors on the left and write the coefficient of \(x^n\) in the product. Aim for: a sum over \(k\) of \(\binom rk\binom w{n-k}\).
Read the coefficient of \(x^n\) on the right-hand side. Aim for: an equality of two expressions, then divide by \(\binom Nn\).
Compare the coefficient of \(x^n\) on both sides of \[(1+x)^r(1+x)^w=(1+x)^{r+w}\]. On the right it is \(\binom Nn\). On the left, \[(1+x)^r=\sum_k\binom rk x^k\] and \[(1+x)^w=\sum_j\binom wj x^j\], so the coefficient of \(x^n\) is \(\sum_k\binom rk\binom w{n-k}\) (terms with \(k>r\) or \(n-k>w\) vanish). Hence
\[ \sum_k\binom rk\binom w{n-k}=\binom{r+w}n, \qquad\text{that is}\qquad \sum_k\frac{\binom rk\binom w{n-k}}{\binom Nn}=1. \]A counting proof gives the same: classify the \(n\)-subsets of the \(N\) chips by how many are red. ∎
Example 3.2.8 uses, without proof, the recursion
\[ \frac{\P(X=k+1)}{\P(X=k)}=\frac{(n-k)(r-k)}{(k+1)(w-n+k+1)}. \]It makes long hypergeometric calculations painless and gives the mode: the probabilities increase while the ratio exceeds 1, and the most likely value is \(\lfloor (n+1)(r+1)/(N+2)\rfloor\).
The ratio of neighbouring probabilities cancels almost everything. Which factorials survive when you divide \(\binom r{k+1}\binom w{n-k-1}\) by \(\binom rk\binom w{n-k}\)?
Write the two ratios of binomial coefficients and multiply. Aim for: \(\frac{(n-k)(r-k)}{(k+1)(w-n+k+1)}\).
Set ratio \(>1\) and expand. Aim for: a linear inequality \(k(N+2)<\dots\) using \(N=r+w\).
The probabilities rise while the inequality holds. Read off where they stop rising and take the integer part.
Use \[\binom r{k+1}=\binom rk\frac{r-k}{k+1}\] and \[\binom w{n-k-1}=\binom w{n-k}\frac{n-k}{w-n+k+1}\]; the denominator \(\binom Nn\) cancels in the ratio, which gives the recursion. For the mode, expand the inequality ratio \(>1\), i.e. \((n-k)(r-k)>(k+1)(w-n+k+1)\). Collect the terms in \(k\): the \(k^2\) terms cancel and what is left is \(nr+n-w-1>k(N+2)\). Since \[nr+n-w-1=(n+1)(r+1)-(N+2)\] (use \(N=r+w\)), this reads \(k+1<(n+1)(r+1)/(N+2)\). So \(\P(X=k+1)>\P(X=k)\) exactly while \(k+1\) is below \(m^*=(n+1)(r+1)/(N+2)\), and the largest probability is at \(\lfloor m^*\rfloor\) (two equal maxima if \(m^*\) is an integer). The same computation for the binomial law gives mode \(\lfloor(n+1)p\rfloor\). ∎
Check with Example 3.2.8 (a tax audit: \(N=470\), \(n=19\), \(r=10\)): \(\P(X=0)=0.6592\); the recursion gives \[\P(X=1)=0.6592\cdot\frac{19\cdot10}{1\cdot442}=0.2834\] and \[\P(X=2)=0.2834\cdot\frac{18\cdot9}{2\cdot443}=0.0518\], so \[\P(X\ge3)=1-0.6592-0.2834-0.0518=0.0056\].
See also (companion courses): the binomial law and its properties, Result 2.5 of the graduate course and Section 2.4 of the machine-learning course.
pp. 110–113 Examples 3.2.5 to 3.2.8. A jury pool of 25 contains two people who would vote to acquit; a panel of 12 is hung (not unanimous) unless it contains neither. Instead of adding two hypergeometric terms as the book does, use the complement: \[\P(\text{unanimous})=\binom{23}{12}/\binom{25}{12}=\frac{13\cdot12}{25\cdot24}=0.26\], so \(\P(\text{hung})=0.74\). In Example 3.2.6 (Florida's Fantasy Five lottery, five numbers drawn from 36, of which 12 are at most 12) the number of "low" numbers is hypergeometric with \(N=36\), \(r=12\), \(n=5\); the probabilities \(0.113,\ 0.338,\ 0.354,\ 0.161,\ 0.032,\ 0.002\) for \(k=0,\dots,5\) agree with Table 3.2.4 of the book, against which 366 daily drawings give observed proportions \(0.128,\ 0.372,\ 0.279,\ 0.178,\ 0.038,\ 0.005\). Example 3.2.7 (matching striation lines on bullets, \(m=25\) cells, \(n_e=4\) marks, \(n_t=3\) test marks) gives \[\P(\text{at least one match})=0.4217\], too large to be convincing evidence of a common gun.
Binomial against hypergeometric. Figure x3.2 shows the same urn sampled both ways. For a sample that is a small share of the population the two laws are practically the same; for a large share the hypergeometric is visibly more concentrated, by exactly the factor \((N-n)/(N-1)\) in its variance (Filling the gap 3.20). The next box states the limit precisely.
fig_x3_2.The book introduces the binomial as drawing with replacement and the hypergeometric as drawing without, and later uses the binomial as an approximation to the hypergeometric (for example in the audit sampling of Example 3.2.8, where \(n/N\) is only 4%). Here is a precise statement. Let \(H\) be the number of red chips in a sample of size \(n\) drawn without replacement from \(N\) chips of which \(r\) are red, and \(B\sim\Bin(n,r/N)\). Then for every set \(A\) of integers,
\[ |\P(H\in A)-\P(B\in A)|\ \le\ \frac{n(n-1)}{2N}. \]In particular, for fixed \(n\) and \(r/N\to p\) with \(N\to\infty\), \[\P(H=k)\to\binom nk p^k(1-p)^{n-k}\].
Sampling with replacement can be turned into sampling without replacement by throwing away the repeats. How likely is a repeat among \(n\) draws from \(N\)?
Let \(D\) be the event that all \(n\) draws with replacement are distinct. Aim for: \(\P(B\in A\mid D)=\P(H\in A)\).
Write \(\P(B\in A)\) as a mixture over \(D\) and \(D^c\) and subtract \(\P(H\in A)\). Aim for: a bound by \(\P(D^c)\).
Bound \(\P(D^c)\) by summing \(1/N\) over the \(\binom n2\) pairs of draws.
Draw \(n\) chips with replacement, \(I_1,\dots,I_n\) iid uniform on the \(N\) chips; the number \(B\) of red among them is \(\Bin(n,r/N)\) exactly. Let \(D\) be the event that the \(n\) draws are all distinct. Given \(D\), the (ordered) sample is uniformly distributed over the ordered \(n\)-tuples of distinct chips, which is the same as drawing in order without replacement, and by Question 3.2.28 of the book the red count of such a sample is hypergeometric. So \[\P(B\in A\mid D)=\P(H\in A)\], and
\[ \P(B\in A)=\P(D)\,\P(H\in A)+\P(D^c)\,\P(B\in A\mid D^c). \]Therefore \[|\P(B\in A)-\P(H\in A)|=\P(D^c)\,|\P(B\in A\mid D^c)-\P(H\in A)|\le\P(D^c)\]. By the union bound over pairs of draws, \(\P(D^c)\le\binom n2\frac1N\). ∎
The bound is crude (for the audit it is 0.36, while the actual total variation distance between the two laws is 0.009), but it shows the right dependence: the error is of order \(n^2/N\), which is why a sample of 19 from 470 is treated as binomial. The first moments are always equal (\(np\)), and the variances differ by the factor \((N-n)/(N-1)\) of Filling the gap 3.20. A direct proof of the limit: write \(\P(H=k)\)
Washington wholesalers may not sell apples if more than 10% of a shipment is below the firmness limit, and testing an apple destroys it. A shipper holds 144 apples, tests 15 chosen at random, and sells the rest if at most two are substandard. If 10 of the 144 are substandard (6.9%, an acceptable shipment), the number found is hypergeometric with \(N=144\), \(r=10\), \(n=15\) and the shipment passes with probability \[\P(X\le2)=0.320+0.401+0.208=0.929\]. If 30 are substandard (21%) it passes with probability \(0.024+0.110+0.221=0.355\): the plan would let a clearly unacceptable shipment through more than a third of the time. Plotting the pass probability against the true number of substandard apples gives the plan's operating characteristic (OC) curve; this is Figure 3.2.2 of the book.
fig_3_2_2.The book remarks that every sampling plan can err in two ways, rejecting an acceptable lot or accepting an unacceptable one, and that the two error rates trade off through the decision rule and the sample size; this is the idea of size and power in hypothesis testing (Chapter 6 of the book; see the first-year notes, Estimation and Hypothesis Testing).
pp. 116–126 The section sets up the language. For a finite or countable sample space \(S\), a discrete probability function is a function \(p(s)\ge0\) with \(\sum_{s\in S}p(s)=1\) (Definition 3.3.1), and the probability of an event \(A\) is \(\P(A)=\sum_{s\in A}p(s)\), equation (3.3.1) of the book. A discrete random variable is a function \(X\) on \(S\) with finitely or countably many values (Definition 3.3.2), and its probability function (the book's "pdf") is \(p_X(k)=\P(\{s:X(s)=k\})\) (Definition 3.3.3). Its cdf is \(F_X(t)=\P(X\le t)\) (Definition 3.3.4).
Examples 3.3.1 and 3.3.2. For the ace-six flat die (faces 1 and 6 twice as likely as the others, so probabilities \[\frac14,\frac18,\frac18,\frac18,\frac18,\frac14\]) the probability of an even face is \[\frac18+\frac18+\frac14=\frac12\], and two such dice show a sum of 7 with probability \(\frac3{16}\), against \(\frac16\) for fair dice. For a fair coin tossed until the first head, \(p(s)=(1/2)^s\), \(s=1,2,\dots\); these sum to 1 by the geometric series \(\sum_{s\ge0}r^s=1/(1-r)\), equation (3.3.2), and the chance that the first head falls on an odd toss is \[\sum_{j\ge0}(1/2)^{2j+1}=\frac12\cdot\frac1{1-1/4}=\frac23\]. In Example 3.3.4 the function \[p(s)=\frac1{1+\lambda}\bigl(\frac\lambda{1+\lambda}\bigr)^s\], \(s=0,1,\dots\), is a probability function for every \(\lambda>0\), again by the geometric series.
pp. 119–120 Case Study 3.3.1 compares a model with data. Over 1096 days in London 903 men aged 85 and over died, and the numbers of days with \(s=0,1,\dots,5\) deaths were \(484,391,164,45,11,1\). The Poisson probability function \(p(s)=e^{-0.82}0.82^s/s!\) of equation (3.3.3), whose mean 0.82 is the observed average \(903/1096=0.824\), reproduces the observed proportions closely (Figure x3.1(a)): \(0.440,\ 0.361,\ 0.148,\ 0.040,\ 0.008\) for \(s=0,\dots,4\) against \(0.442,\ 0.357,\ 0.150,\ 0.041,\ 0.010\). (For \(s=5\) the model gives \(0.0014\); see Notes on the book.) The Poisson law is derived in Chapter 4 of the book.
pp. 120–121 Example 3.3.3 (Benford's law). Newcomb and Benford noticed that the leading digit \(s\) of "numbers from the newspaper" is not uniform: \(p(s)=\log_{10}(1+1/s)\), \(s=1,\dots,9\), which is \[0.301,\ 0.176,\ 0.125,\ 0.097,\ 0.079,\ 0.067,\ 0.058,\ 0.051,\ 0.046\]. It is a probability function because the logarithms telescope: \[\sum_{s=1}^9\log_{10}\frac{s+1}s=\log_{10}10=1\]. A 1 is about \(\log_{10}2/\log_{10}(10/9)=6.6\) times as common as a 9 (the book divides the rounded values, \(0.301/0.046\), and gets 6.5). The explanation in the book's comment is proportional growth: going from 1000 to 2000 is a 100% increase, from 8000 to 9000 only 12.5%.
pp. 122–125 Examples 3.3.5 to 3.3.9. The sum of two dice is the random variable \(X(i,j)=i+j\) on 36 outcomes, with probability function \[\frac1{36},\frac2{36},\dots,\frac6{36},\dots,\frac1{36}\] at \(2,\dots,12\) (Table 3.3.3). In Example 3.3.7 a plant produces three generators a day, each ready to ship with probability 0.95 (profit \(\$10{,}000\)) or needing rework (cost \(\$2{,}000\)); the daily profit takes the values \[\$30{,}000,\ \$18{,}000,\ \$6{,}000,\ -\$6{,}000\] with probabilities \(0.857375,\ 0.135375,\ 0.007125,\ 0.000125\) (the number of defectives is binomial). In Example 3.3.8 a basketball player with success rate 0.65 shoots until the second basket; the number of throws \(X\) has \[p_X(k)=(k-1)(0.35)^{k-2}(0.65)^2\], \(k=2,3,\dots\), equation (3.3.4): exactly one basket among the first \(k-1\) throws, which can be in any of \(k-1\) positions, then a basket on throw \(k\). Table 3.3.5 gives \[0.4225,\ 0.2958,\ 0.1553,\ 0.0725,\ 0.0317,\ 0.0133\] for \(k=2,\dots,7\), the rest \(0.0089\) for \(k\ge8\). (This is the negative binomial law of Section 4.5 of the book with \(r=2\).)
The book defines \(F_X(t)=\P(X\le t)\) and uses \[\P(s\le X\le t)=F_X(t)-F_X(s-1)\] for integer-valued \(X\) (Example 3.3.9, a binomial with \(n=50\), \(p=0.6\), \[\P(21\le X\le40)=F_X(40)-F_X(20)\]), but never says which properties a cdf has. For every random variable (discrete or not):
So for a discrete \(X\) the cdf is a step function that jumps by \(p_X(k)\) at each value \(k\); the probability function is recovered from the cdf and vice versa. For the larger of two fair dice (Example 3.3.10), \[F_X(t)=\lfloor t\rfloor^2/36\] for \(1\le t<7\), with jumps \(1/36,3/36,5/36,7/36,9/36,11/36\) at \(1,\dots,6\).
Each property of a cdf is the continuity of probability applied to a sequence of nested events. Which events increase, and which decrease?
Show \(F\) is nondecreasing and take limits along \(t_n\to\pm\infty\). Aim for: limits 1 and 0.
Take \(h_n\downarrow0\) and the events \(\{X\le t+h_n\}\). Aim for: right-continuity.
Write \(\{X<t\}\) as an increasing union. Aim for: \(\P(X=t)=F(t)-F(t-)\).
(1) \(\{X\le s\}\subset\{X\le t\}\) for \(s\le t\), so \(F\) is nondecreasing. For \(t_n\uparrow\infty\) the events \(A_n=\{X\le t_n\}\) increase to the whole space, so \(\P(A_n)\to1\) by continuity of probability from below (a consequence of countable additivity); for \(t_n\downarrow-\infty\) the events decrease to \(\emptyset\), so \(\P(A_n)\to0\). Monotonicity lets us pass from a sequence to the limit along all \(t\). (2) For \(h_n\downarrow0\) the events \(\{X\le t+h_n\}\) decrease to \(\{X\le t\}\), and continuity from above gives \(F(t+h_n)\to F(t)\). (3) \(\{X\le b\}\)
Consequently two random variables with the same cdf have the same probability function: the cdf is a complete description of the law, which is why tables of cdfs (such as the binomial tables at the back of the book) suffice.
See also (companion courses): Result 2.2 (what a cdf looks like) and Result 2.1 (the cdf determines the law) of the graduate course.
pp. 127–129 A discrete law cannot describe a "random point in an interval": every individual point must have probability 0. The book motivates the replacement with an example. A surveillance monitor, switched on at the start of each hour, works with probability 0.905 independently of the past; the hour \(X\) of the first failure has \[p_X(k)=(0.905)^{k-1}(0.095)\], \(k=1,2,\dots\) (Figure 3.4.1). Superimposing the curve \(y=0.1e^{-0.1x}\) (Figure 3.4.2) shows that the bar areas \(p_X(k)\) are nearly the areas under the curve: probabilities are then areas rather than point masses. For example \[\P(1\le X\le4)=1-0.905^4=0.3292\], while \[\int_0^4 0.1e^{-0.1x}\d x=1-e^{-0.4}=0.3297\].
fig_3_4_1.fig_3_4_2.The book presents Figure 3.4.2 as a remark ("notice how closely the curve approximates the bars"). The agreement is exact once the rate is chosen correctly: if \(Y\sim\mathrm{Exp}(\lambda)\) then \(\lceil Y\rceil\) is geometric with success probability \(q=1-e^{-\lambda}\), and conversely a geometric variable with success probability \(q\) is the ceiling of an exponential variable with rate \(\lambda=-\ln(1-q)\).
A geometric variable is how many unit-length boxes you pass before a waiting time ends. Compare \(\P(X>k)\) with \(\P(Y>k)\) for an exponential \(Y\).
For integer \(k\), show \(\{\lceil Y\rceil>k\}=\{Y>k\}\). Aim for: \(\P(\lceil Y\rceil>k)=e^{-\lambda k}\).
Match with \((1-q)^k\). Aim for: the rate \(\lambda\) in terms of \(q\).
Express \(p_X(k)\) as a difference of two survival values and recognise an integral of the density.
For a geometric \(X\) with success probability \(q\), \(\P(X>k)=(1-q)^k\), \(k=0,1,2,\dots\) (the first \(k\) trials all fail). For \(Y\sim\mathrm{Exp}(\lambda)\), \(\P(Y>t)=e^{-\lambda t}\), and for integer \(k\), \(\lceil Y\rceil>k\iff Y>k\), so \[\P(\lceil Y\rceil>k)=e^{-\lambda k}\]. The two survival functions agree at every integer \(k\) when \(e^{-\lambda}=1-q\), i.e. \(\lambda=-\ln(1-q)\); and a law on the positive integers is determined by its survival function at the integers. Hence \[p_X(k)=\P(k-1<Y\le k)=\int_{k-1}^k\lambda e^{-\lambda x}\d x\]: the area of the \(k\)-th bar is exactly the area under the exponential density over the hour, which is the picture of the figure. ∎
For \(q=0.095\), \(\lambda=-\ln0.905=0.0998\), which is the book's \(0.1\) to two decimals; since \(-\ln(1-q)=q+q^2/2+\cdots\), the rate is close to \(q\) whenever \(q\) is small. With the exact rate, \[\P(1\le X\le4)=1-e^{-4\lambda}=1-0.905^4=0.3292\] exactly; the 0.3297 quoted by the book is the area under the rounded curve \(0.1e^{-0.1x}\).
See also (companion courses): geometric and exponential laws in Result 2.6 of the graduate course, and the Poisson-process view of exponential waiting times in the Poisson process demo.
A probability function \(P\) on a set of real numbers is continuous if there is a function \(f\ge0\) with \[\int_{-\infty}^\infty f(t)\d t=1\] such that \[P([a,b])=\int_a^bf(t)\d t\] for every interval \([a,b]\); then \(P(A)=\int_Af\) for every set \(A\) for which the integral is defined.
pp. 129–130 Examples 3.4.1 and 3.4.2. The continuous analogue of "equally likely" is the uniform density \(f(t)=1/(b-a)\) on \([a,b]\) (Figure 3.4.3): \[\P(c\le Y\le d)=(d-c)/(b-a)\]. The function \(f(t)=3t^2\) on \([0,1]\) is a density (it is nonnegative and \(\int_0^13t^2\d t=1\)); outcomes near 1 are more likely, with \[\P(0\le Y\le\frac13)=\frac1{27}\] and \[\P(\frac23\le Y\le1)=\frac{19}{27}\] (Figure 3.4.4). In Example 3.4.3 the Normal density \[f(t)=\frac1{\sqrt{2\pi}\sigma}\exp\{-\frac12(\frac{t-\mu}\sigma)^2\}\] appears, with location \(\mu\) and scale \(\sigma\) (Figure 3.4.5).
fig_3_4_3.fig_3_4_4.fig_3_4_5.pp. 130–134 Fitting a density to data. A histogram has total area equal to the sum of the bar areas, not 1, so it cannot be laid beside a density. Rescaling the vertical axis so that the bar over a class of width \(w\) with \(m\) of \(n\) observations has height \(m/(nw)\) makes the total area exactly 1. For the forty observations of Table 3.4.1 grouped in five classes of width 10 with counts \(7,6,9,8,10\) the heights are \(0.0175,\ 0.0150,\ 0.0225,\ 0.0200,\ 0.0250\), compared with the Uniform(20, 70) density \(1/50=0.02\) (Figures 3.4.6 and 3.4.7).
fig_3_4_6.fig_3_4_7.Table 3.4.2 of the book groups the lifetimes of 903 V805 radar tubes into classes of width 80 hours up to 560 hours, then 560–700 and 700+ hours, with counts \(317,230,118,93,49,33,17,26,20\) and densities \[0.0044,\ 0.0032,\ 0.0016,\ 0.0013,\ 0.0007,\ 0.0005,\ 0.0002,\ 0.0002,\ 0.0002\]. The exponential density \[f(t)=\lambda e^{-\lambda t}\], \(t>0\), with \(\lambda=0.0056\) (the reciprocal of the average lifetime, about 179 hours), follows the histogram closely (Figure 3.4.8), so the probability that a tube lasts longer than 500 hours is estimated by \[\int_{500}^\infty0.0056e^{-0.0056t}\d t=e^{-2.8}=0.0608\]. Why the reciprocal of the mean is the right rate is explained next.
fig_3_4_8.The book states that the rescaling "forces" the area to be 1, and that for the radar tubes the value of \(\lambda\) is the reciprocal of the sample mean "for reasons explained in Chapter 5". Here are both justifications at the level of this chapter.
Two questions. Why divide the class count by \(nw\)? And what single number about the exponential density does the sample mean estimate?
Relate the relative frequency of a class to \(f(y)w\). Aim for: bar height \(m/(nw)\), and total area \(\sum m_j/n=1\).
Compute \(\E Y\) for the exponential density. Aim for: \(1/\lambda\), then set it equal to \(\bar y\).
Compute the expected class counts \(903(e^{-\lambda a}-e^{-\lambda b})\) and compare with the table.
Why \(m/(nw)\). The relative frequency \(m/n\) of a class estimates the probability \(\int_{\text{class}}f\) of the class, and for a narrow class of width \(w\) that probability is approximately \(f(y)\,w\) at any \(y\) in the class. So \(f(y)\approx(m/n)/w\), which is the bar height. The total area is then \[\sum_j w_j\cdot m_j/(nw_j)=\sum_jm_j/n=1\], whatever the class widths; this is why unequal widths (the tube classes 560–700 and 700+, which are wider) need density rather than frequency on the vertical axis.
Why \(1/\bar y\). If \(Y\) has density \(\lambda e^{-\lambda y}\), then \[\E Y=\int_0^\infty y\lambda e^{-\lambda y}\d y=1/\lambda\] (integrate by parts; Example 3.5.6 of the book). Equating the model mean with the sample mean \(\bar y\) gives \(\lambda=1/\bar y\), the method of moments; it is also the maximum likelihood estimate (Chapter 5 of the book). The book's \(\bar y=1/0.0056=178.6\) hours cannot be recomputed from Table 3.4.2 alone, because the individual lifetimes in the last class are not given; the classes bound it between \(\sum_jm_jl_j/903=138.6\) (every tube at the lower endpoint of its class) and a value that depends on how long the 20 tubes beyond 700 hours lasted, and 178.6 is consistent with that range.
How good is the fit? With \(\lambda=0.0056\) the expected counts in the nine classes of Table 3.4.2 are \(326,\ 208,\ 133,\ 85,\ 54,\ 35,\ 22,\ 21,\ 18\), against the observed \(317,\ 230,\ 118,\ 93,\ 49,\ 33,\ 17,\ 26,\ 20\); the largest discrepancy, 22 tubes in the second class, is about 1.7 standard deviations (\(\sqrt{208\cdot0.77}\)). ∎
A random variable \(Y\) is continuous if there is a function \(f_Y\) with \[\P(a\le Y\le b)=\int_a^bf_Y(y)\d y\] for all \(a<b\); \(f_Y\) is its density, and its cdf is \[F_Y(y)=\int_{-\infty}^yf_Y(t)\d t=\P(Y\le y)\] (Definition 3.4.3). In Examples 3.4.4 and 3.4.5 the identity random variable on a continuous sample space has the sample space's density; for instance \(f_Y(y)=6y(1-y)\), \(0\le y\le1\), is a density (\(6[y^2/2-y^3/3]_0^1=1\); Figure 3.4.9) that favours values near the middle. The book's convention is that a density is 0 outside the stated range.
fig_3_4_9.If \(Y\) is continuous with cdf \(F_Y\) and density \(f_Y\), then \[\frac{\d}{\d y}F_Y(y)=f_Y(y)\] (Theorem 3.4.1), and (Theorem 3.4.2, here) (a) \(\P(Y>s)=1-F_Y(s)\); (b) \[\P(r<Y\le s)=F_Y(s)-F_Y(r)\]; (c) \[\lim_{y\to\infty}F_Y(y)=1\]; (d) \[\lim_{y\to-\infty}F_Y(y)=0\]. The book proves (c) and (d) with the countable additivity axiom and gets Theorem 3.4.1 from the fundamental theorem of calculus.
Three facts that the book uses silently: (i) \(\P(Y=y)=0\) for every \(y\), so \(\P(a\le Y\le b)\), \(\P(a<Y<b)\) and \(\P(a<Y\le b)\) are all equal; (ii) \(F_Y\) is a continuous function; (iii) \(F_Y'(y)=f_Y(y)\) at every \(y\) where \(f_Y\) is continuous, and in general at all but a null set of \(y\).
A density integrates over short intervals to something small. What does that say about \(\P(Y=y)\), and about the jump of the cdf?
Bound \(\P(Y=y)\) by an integral over a shrinking interval. Aim for: a bound tending to 0.
Use it with the jump formula of gap 3.4. Aim for: continuity of \(F_Y\).
At a point of continuity of \(f_Y\), bound the difference quotient \(h^{-1}\int_y^{y+h}f_Y\) above and below. Aim for: \(F_Y'=f_Y\).
(i) For every \(h>0\), \[\P(Y=y)\le\P(y-h<Y\le y)=\int_{y-h}^yf_Y\], which tends to 0 as \(h\downarrow0\) because \(f_Y\) is integrable (the integral is the tail of a convergent integral; formally, by dominated convergence). (ii) By the properties in Filling the gap 3.4, \(F_Y\) is right-continuous and its jump at \(y\) is \(\P(Y=y)=0\); so it is also left-continuous. More directly, \[|F_Y(y+h)-F_Y(y)|=\int_y^{y+h}f_Y\to0\]. (iii) If \(f_Y\) is continuous at \(y\), the mean value theorem for integrals gives \[\{F_Y(y+h)-F_Y(y)\}/h=h^{-1}\int_y^{y+h}f_Y\to f_Y(y)\]. A general integrable density need not be continuous anywhere (Lebesgue's differentiation theorem says the derivative equals \(f_Y\) except on a set of length zero), but every density in this chapter is piecewise continuous, so the statement holds except at the finitely many kinks (for example at \(1\) for \(f_Y(y)=3y^2\) on \([0,1]\), where the density jumps from 3 to 0), which is all that is needed to differentiate a cdf into a density. (a) and (b) are just \(\P(Y>s)=1-\P(Y\le s)\) and additivity of probability over \(\{Y\le r\}\cup\{r<Y\le s\}\). ∎
For (c), (d): increasing events \(\{Y\le n\}\uparrow\) the whole space and decreasing events \(\{Y\le-n\}\downarrow\emptyset\), so continuity of probability gives limits 1 and 0 (as in the proof in Filling the gap 3.4).
See also (companion courses): Result 2.3 (probabilities from the cdf) and the quantile function and inverse-cdf sampling of Result 2.4, with the inverse-cdf sampling demo.
pp. 137–139 A distribution contains more detail than one usually wants. The expected value (mean) summarises its location. The book motivates it with a roulette bet: a one-dollar bet on red in American roulette wins \$1 with probability \(\frac{18}{38}=\frac9{19}\) and loses \$1 with probability \(\frac{10}{19}\), so the average gain per play is \[\$1\cdot\frac9{19}-\$1\cdot\frac{10}{19}=-0.053\], a loss of about 5 cents. Physically it is the point at which the probability bars balance on a fulcrum.
For a discrete \(X\), \[\E X=\mu_X=\sum_kk\,p_X(k)\]; for a continuous \(Y\), \[\E Y=\mu_Y=\int_{-\infty}^\infty y\,f_Y(y)\d y\]; in both cases only if the sum or the integral converges absolutely. Otherwise the variable has no finite expected value.
Absolute convergence matters because a conditionally convergent series changes its value when its terms are reordered, and an average cannot depend on the order of the outcomes. The Cauchy density \(f(y)=\frac1{\pi(1+y^2)}\) is a standard case: \(\int|y|f(y)\d y=\infty\), so the mean does not exist.
If \(X\sim\Bin(n,p)\) then \(\E X=np\). The book writes \[k\binom nk=n\binom{n-1}{k-1}\], pulls out \(np\), and recognises a binomial sum over \(n-1\) trials equal to 1. Example 3.5.1 checks \(n=3\), \(p=5/9\): \[\E X=\frac{0\cdot64+240+600+375}{729}=\frac{1215}{729}=\frac53\].
If \(X\) is hypergeometric with \(r\) red and \(w\) white chips and \(n\) drawn, \(\E X=rn/(r+w)=np\) with \(p=r/N\). The book states this after Example 3.5.2 (nine chips, five red, three drawn: \[\E X=\frac{30+80+30}{84}=\frac53\]) and leaves the proof to Question 3.5.25.
The identity \(k\binom rk=r\binom{r-1}{k-1}\) removes the factor \(k\). What remains is a sum you already know how to evaluate.
Pull \(r\) out of the sum using the identity. Aim for: a sum of \(\binom{r-1}{k-1}\binom w{n-k}\).
Evaluate it by Vandermonde with \(r-1\) red chips and \(n-1\) draws. Aim for: \(\binom{N-1}{n-1}\).
Divide by \(\binom Nn\) and simplify.
For \(k\ge1\), \[k\binom rk=k\frac{r!}{k!(r-k)!}=r\frac{(r-1)!}{(k-1)!(r-k)!}=r\binom{r-1}{k-1}\]. Hence
\[ \E X=\sum_{k\ge1}k\frac{\binom rk\binom w{n-k}}{\binom Nn}=\frac r{\binom Nn}\sum_{k\ge1}\binom{r-1}{k-1}\binom w{n-k}=\frac r{\binom Nn}\binom{N-1}{n-1}, \]by Vandermonde's identity (Filling the gap 3.1) applied to the urn with \(r-1\) red and \(w\) white chips and \(n-1\) draws. Finally \[\binom{N-1}{n-1}/\binom Nn=n/N\], so \(\E X=rn/N\). ∎
A shorter route, Example 3.9.10, writes \(X\) as a sum of indicators and uses linearity (see Filling the gap 3.20): each chip drawn is red with probability \(r/N\), so \(\E X=n\cdot r/N\).
pp. 141–143 Examples 3.5.3 to 3.5.5. In the numbers game D.J. a \$5 ticket pays \$3500 against a 1-in-1000 chance, so \[\E(\text{gain})=3500/1000-5\cdot999/1000=-\$1.50\]. In Example 3.5.4 fifty blood samples are pooled and tested once; if the pooled test is positive all fifty are tested again, so the number of tests is \(X=1\) or \(51\), and with disease prevalence \(p\)
\[ \E X=1\cdot(1-p)^{50}+51\bigl[1-(1-p)^{50}\bigr]=51-50(1-p)^{50}. \]This gives \(51.0,\ 50.7,\ 20.8,\ 3.4,\ 1.2\) tests for \[p=0.5,\ 0.1,\ 0.01,\ 0.001,\ 0.0001\] (Table 3.5.1): pooling pays only for rare diseases: \(\E X<50\) exactly when \((1-p)^{50}>1/50\), i.e. \(p<1-50^{-1/50}=0.075\).
Example 3.5.5 (the St. Petersburg paradox). Toss a fair coin until the first tail; if it appears at toss \(k\) you win \(\$2^k\). The probability of that is \(2^{-k}\), so each term of the expectation is \(2^k2^{-k}=1\) and \(\E X=1+1+1+\cdots=\infty\): no finite entry fee makes the game "fair". The book draws two lessons: the mean can fail to represent the "location" of a law, and a positive expected value does not mean the game is worth playing; capping the payoff, as in Question 3.5.19, gives a sensible fee.
For a nonnegative integer-valued \(X\), \[\E X=\sum_{k=1}^\infty\P(X\ge k)\] (Question 3.5.26), and for a nonnegative continuous \(Y\), \[\E Y=\int_0^\infty\P(Y>y)\d y\]. The formula is often the shortest route to a mean, and it also gives a precise meaning to "the mean is infinite": the series diverges.
A nonnegative integer is the number of indicators \(\one\{X\ge k\}\) that equal 1. What does taking expectations term by term give?
Write \(X\) as a sum of indicators and take expectations. Aim for: \(\sum_k\P(X\ge k)\).
Apply it to the capped game: prize \(2^k\) for \(k\le9\), \(1000\) afterwards. Aim for: nine terms equal to 1, plus the tail.
Compute \(\P(\text{first tail at toss }10\text{ or later})\) and multiply by 1000.
Write \[X=\sum_{k\ge1}\one\{X\ge k\}\] (for \(X=m\) exactly \(m\) of the indicators equal 1). All terms are nonnegative, so expectation and summation can be interchanged (Tonelli's theorem for series): \[\E X=\sum_k\E\one\{X\ge k\}=\sum_k\P(X\ge k)\]. For \(Y\ge0\) write \[Y=\int_0^\infty\one\{Y>t\}\d t\] and interchange in the same way. ∎
Examples. For a geometric \(X\) with success probability \(p\), \(\P(X\ge k)=(1-p)^{k-1}\), so \[\E X=\sum_{k\ge1}(1-p)^{k-1}=1/p\]. For the length of a best-of-seven series, \[\E X=4+\P(X\ge5)+\P(X\ge6)+\P(X\ge7)=4+\frac78+\frac58+\frac5{16}=5.8125\] (Question 3.5.23).
The capped game. Suppose the prize for first tail at toss \(k\) is \(2^k\) for \(k\le9\) but only \(\$1000\) for \(k\ge10\) (Question 3.5.19). The probability that the first tail is at toss 10 or later is \(2^{-9}\), so
\[ \E X=\sum_{k=1}^92^k2^{-k}+1000\cdot2^{-9}=9+\frac{1000}{512}=10.95. \]A fair entry fee is about \$10.95. Each extra toss allowed before the cap adds only one dollar to the fair fee: the unlimited game is infinite only because of the astronomically rare, astronomically large prizes.
pp. 143–145 Examples 3.5.6 and 3.5.7. For the exponential density \[f_Y(y)=\frac1\mu e^{-y/\mu}\], \(\E Y=\mu\) (substitute \(w=y/\mu\) and integrate \(we^{-w}\) by parts); for nitrogen at room temperature the mean free path is \(\mu=0.00005\) cm. For the Rayleigh density \[f_Y(y)=\frac y{a^2}e^{-y^2/2a^2}\], \(\E Y=a\sqrt{\pi/2}\).
p. 145 The median. If a few values are extremely large or small, the mean is a poor summary. The median \(m\) of a continuous \(Y\) solves \[\int_{-\infty}^mf_Y=\frac12\] (Definition 3.5.2; for a discrete variable it is the point with \(\P(X<m)=\P(X>m)\), averaging the two middle values when needed). In Example 3.5.8 a light bulb with mean life 1000 hours (exponential) has median \(-1000\ln\frac12=693\) hours: half of all bulbs fail before 693 hours although the average is 1000.
If \(X\) is discrete with probability function \(p_X\), then \(\E g(X)=\sum_kg(k)p_X(k)\) whenever \(\sum_k|g(k)|p_X(k)<\infty\); if \(Y\) is continuous with density \(f_Y\) and \(g\) is continuous, \[\E g(Y)=\int g(y)f_Y(y)\d y\] whenever the integral converges absolutely. Corollary 3.5.1: \(\E(aW+b)=a\E W+b\).
The book proves the discrete case (group the values \(k\) with the same \(g(k)=w_j\)) and refers to a text for the continuous case.
A nonnegative variable is the integral of \(\one\{W>t\}\) over \(t\). If \(W=g(Y)\), swap the order of integration.
Write \(\P(g(Y)>t)=\int\one\{g(y)>t\}f_Y(y)\d y\) and put it in the tail formula. Aim for: a double integral over \((t,y)\).
Integrate over \(t\) first. Aim for: \(\int g(y)f_Y(y)\d y\).
Handle a general \(g\) by positive and negative parts, and state what happens if \(\int|g|f_Y=\infty\).
Let \(g\ge0\) first. Apply the tail formula of Filling the gap 3.9 to \(W=g(Y)\) and write the probability as an integral of \(f_Y\):
\[ \E g(Y)=\int_0^\infty\P(g(Y)>t)\d t=\int_0^\infty\int_{-\infty}^\infty\one\{g(y)>t\}f_Y(y)\d y\d t=\int_{-\infty}^\infty f_Y(y)\Bigl(\int_0^\infty\one\{t<g(y)\}\d t\Bigr)\d y=\int g(y)f_Y(y)\d y, \]where the interchange is Tonelli's theorem (everything is nonnegative). For general \(g\) split \(g=g^+-g^-\) into positive and negative parts. If \(\int|g|f_Y<\infty\) then both \(\E g^+(Y)\) and \(\E g^-(Y)\) are finite, and subtracting gives the formula. If it is infinite, \(\E g(Y)\) is not defined. ∎
The same argument, with a sum over \(k\), gives the discrete case without the grouping step. Linearity of the corollary is immediate from the formula.
See also (companion courses): the rule of the lazy statistician, Result 3.1 of the graduate course.
pp. 149–152 Examples 3.5.9 to 3.5.14. For \(X\) taking \(-2,1,2\) with probabilities \(\frac58,\frac18,\frac28\), \(W=X^2\) takes 1 and 4 with probabilities \(\frac18,\frac78\) and \(\E W=\frac{29}8\), the same as \(\sum k^2p_X(k)\). A spray can with propellant density \(3y^2\) on \((0,1)\) covers on average \(\E[20\pi Y^2]=12\pi=37.7\) ft\(^2\), just under the 40 ft\(^2\) needed (Example 3.5.10). Paying \(\bigl(\frac12\bigr)^k\) dollars if the first head is at toss \(k\) has expected value \[\sum_{k\ge1}4^{-k}=\frac13\] (Example 3.5.11). Maxwell's speed density \[f_S(s)=4\sqrt{a^3/\pi}\,s^2e^{-as^2}\] gives mean kinetic energy \(\E(\tfrac12mS^2)=3m/(4a)\) (Example 3.5.12). A point chosen uniformly on \([0,1]\) splits the segment so that the shorter-to-longer ratio has mean \(2\ln2-1=0.386\) (Example 3.5.14).
pp. 151–152 Example 3.5.13 (how many to manufacture). A firm makes \(x\) items; demand \(V\) is exponential with mean \(\lambda\); each item sold earns \(m\) and each unsold item costs \(n\). The profit is \(Q(v)=mv-n(x-v)\) if \(v<x\) and \(mx\) if \(v\ge x\). The book integrates, quotes \[\E Q=\lambda(m+n)-\lambda(m+n)e^{-x/\lambda}-nx\] and the optimum \[x^*=-\lambda\ln\frac n{m+n}\].
Profit is a function of demand, and one clean formula covers both cases: \(Q(v)=(m+n)\min(v,x)-nx\). What is \(\E\min(V,x)\) for an exponential \(V\)?
Check \(Q(v)=(m+n)\min(v,x)-nx\) in both cases. Aim for: a formula for \(\E Q\) in terms of \(\E\min(V,x)\).
Evaluate \(\E\min(V,x)\). Aim for: \(\lambda(1-e^{-x/\lambda})\).
Differentiate in \(x\), set to 0, and check the sign of the second derivative. Aim for: \(x^*\) as a log of \((m+n)/n\).
For \(v<x\), \(Q(v)=(m+n)v-nx\); for \(v\ge x\), \(Q(v)=mx=(m+n)x-nx\). So in both cases \(Q(v)=(m+n)\min(v,x)-nx\). By the tail formula of Filling the gap 3.9,
\[ \E\min(V,x)=\int_0^x\P(V>v)\d v=\int_0^xe^{-v/\lambda}\d v=\lambda(1-e^{-x/\lambda}), \]hence \[\E Q=\lambda(m+n)(1-e^{-x/\lambda})-nx\], the book's expression. Differentiating, \[\frac{\d}{\d x}\E Q=(m+n)e^{-x/\lambda}-n\], which is positive for small \(x\), vanishes at \(e^{-x/\lambda}=n/(m+n)\) and is negative after; the second derivative \(-\frac{m+n}\lambda e^{-x/\lambda}\) is negative, so \(\E Q\) is concave and the stationary point is its maximum:
\[ x^*=\lambda\ln\frac{m+n}n>0. \]Interpretation: produce until the probability that the last item is not sold, \(\P(V>x)=e^{-x/\lambda}\), equals the ratio \(n/(m+n)\) of loss to total stake. For \(m=5\), \(n=2\), \(\lambda=300\) the best choice is \(300\ln3.5=375.8\) items. ∎
pp. 153–157 Two laws can have the same mean and very different spreads. Averaging the deviation \(X-\mu\) is useless (it is always 0), and the absolute deviation is awkward to differentiate; squaring works well.
The variance is \[\sigma^2=\V X=\E[(X-\mu)^2]=\sum_k(k-\mu)^2p_X(k)\] (discrete) or \(\int(y-\mu)^2f_Y(y)\d y\) (continuous), defined when \(\E X^2<\infty\); the standard deviation is \(\sigma\), in the units of \(X\).
\(\V W=\E W^2-\mu^2\) (Theorem 3.6.1), and \(\V(aW+b)=a^2\V W\) (Theorem 3.6.2). The book proves the first by expanding \((w-\mu)^2\) inside the integral; the second follows because \(\E(aW+b)=a\mu+b\), so \(aW+b-\E(aW+b)=a(W-\mu)\).
Example 3.6.1 (an urn of five chips, two red, two drawn without replacement): \(\mu=0.8\) and \(\E X^2=1.00\), so \(\V X=0.36\). Example 3.6.2: for \(f_Y(y)=2y\) on \([0,1]\), \(\E Y=\frac23\), \(\E Y^2=\frac12\), \(\V Y=\frac1{18}\), and the standard deviation of \(3Y+2\) is \(\sqrt{9/18}=0.71\). Example 3.6.3 (the interquartile range): for \(f_Y=3y^2\), the quartiles solve \(Q^3=0.25\) and \(0.75\), so \(Q_1=0.630\), \(Q_3=0.909\) and the interquartile range is \(0.279\); it measures spread around the median as the standard deviation does around the mean.
pp. 158–160 Higher moments. The \(r\)-th moment is \(\mu_r=\E W^r\) and the \(r\)-th moment about the mean is \(\E(W-\mu)^r\). Example 3.6.4 introduces the coefficient of skewness \[\gamma_1=\E(W-\mu)^3/\sigma^3\] (zero for a symmetric density) and the coefficient of kurtosis \[\gamma_2=\E(W-\mu)^4/\sigma^4-3\], a measure of heavy tails; both are unchanged by \(W\mapsto aW+b\) with \(a>0\) (Question 3.6.23), because they are ratios of central moments of the same order. For the exponential law \(\gamma_1=2\) and \(\gamma_2=6\); for the uniform law \(\gamma_1=0\), \(\gamma_2=-\frac65\); for the Normal law both are 0, the reference against which "3" is subtracted. Theorem 3.6.3: if \(\E|W|^k<\infty\) then \(\E|W|^j<\infty\) for \(j<k\) (because \(|w|^j\le1+|w|^k\)). Question 3.6.13, below, shows the mean is the constant that minimises the mean squared deviation.
See also (companion courses): Result 3.5 (properties of the variance) and Result 3.6 (zero variance means a constant) of the graduate course.
pp. 160–163 Two random variables defined on the same sample space need more than their individual laws to describe how they vary together. For discrete variables the joint probability function is \(p_{X,Y}(x,y)=\P(X=x,Y=y)\) (Definition 3.7.1). In Example 3.7.2 two dice are rolled, \(X\) is the sum and \(Y\) the larger face (Table 3.7.1); for instance \(p_{X,Y}(4,3)=\frac2{36}\) (the outcomes (1,3) and (3,1)) and \(p_{X,Y}(2,3)=0\). Summing the table over the other variable gives the marginal probability functions: \[p_X(x)=\sum_yp_{X,Y}(x,y)\] and \[p_Y(y)=\sum_xp_{X,Y}(x,y)\] (Theorem 3.7.1 and Definition 3.7.2), because the events \(\{Y=y\}\) partition the sample space. Here \(p_Y\) is \(\frac1{36},\frac3{36},\dots,\frac{11}{36}\).
pp. 163–166 For continuous variables, \(X\) and \(Y\) are jointly continuous if there is a function \(f_{X,Y}\ge0\) with \[\P[(X,Y)\in R]=\iint_Rf_{X,Y}(x,y)\d x\d y\] for every region \(R\) (Definition 3.7.3); it integrates to 1 over the plane, and it is the height of a surface whose volume over \(R\) is the probability. In Example 3.7.3 the constant \(c\) of \(f=cxy\) on \(0<y<x<1\) is found by making the volume 1. In Example 3.7.4 the daily hours \(X\) of television and \(Y\) of homework have joint density \(xye^{-(x+y)}\) on the first quadrant, and the chance of watching at least twice as much as working, \(\P(X\ge2Y)\), is \(\frac7{27}\) (Filling the gap 3.12).
The book gives the inner integral and the answer \(\frac7{27}\) in one line. The steps:
The density factors into a function of \(x\) and a function of \(y\), so the inner integral is a one-variable integral you can do by parts.
Compute the inner integral over \(y\) from 0 to \(x/2\). Aim for: \(1-(1+x/2)e^{-x/2}\).
Multiply by \(xe^{-x}\) and split into three integrals. Aim for: exponents \(e^{-3x/2}\).
Evaluate each with the gamma integral and add.
First \[f(x,y)=xe^{-x}\cdot ye^{-y}\] integrates to \[(\int_0^\infty xe^{-x}\d x)^2=1\], so it is a density, and \(X\) and \(Y\) are independent gamma variables with shape 2. The region \(\{X\ge2Y\}\) is \(0<y<x/2\). The inner integral is, by parts,
\[ \int_0^{x/2}ye^{-y}\d y=\Bigl[-ye^{-y}-e^{-y}\Bigr]_0^{x/2}=1-\bigl(1+\tfrac x2\bigr)e^{-x/2}. \]Therefore
\[ \P(X\ge2Y)=\int_0^\infty xe^{-x}\Bigl[1-\bigl(1+\tfrac x2\bigr)e^{-x/2}\Bigr]\d x=\underbrace{\int_0^\infty xe^{-x}\d x}_{1}-\int_0^\infty xe^{-3x/2}\d x-\frac12\int_0^\infty x^2e^{-3x/2}\d x. \]With \[\int_0^\infty x^ke^{-ax}\d x=k!/a^{k+1}\] and \(a=\frac32\): the second term is \(1/a^2=\frac49\), the third is \[\frac12\cdot\frac2{a^3}=\frac8{27}\]. So \[\P=1-\frac49-\frac8{27}=\frac{27-12-8}{27}=\frac7{27}\]. (The book's intermediate line writes the last term as \(\frac{16}{54}\), the same number.) ∎
pp. 164–166 Geometric probability. If \((X,Y)\) is uniform on a rectangle, the probability of a region \(R\) is the ratio of areas, \(\text{area}(R)/\text{area(rectangle)}\) (3.7.1). In Example 3.7.5 two friends each arrive at a uniformly random time in \([0,60]\) minutes and wait 15 minutes; they meet iff \(|x-y|\le15\), the band of Figure 3.7.2, whose complement is two triangles of area \(\frac12\cdot45^2\), so \[\P(\text{meet})=1-\frac{45^2}{60^2}=\frac7{16}=0.4375\] (the book rounds to 0.44). With waiting time \(w\) and window \(T\) the answer is \(1-(1-w/T)^2\). In Example 3.7.6 a ring of diameter \(d\) tossed on a grid of squares of side \(s\) lands inside a square (a win) with probability \((s-d)^2/s^2\) if its centre is uniform; the operator keeps the win probability below 0.2 by taking \(d/s\ge1-\sqrt{0.2}=0.55\).
fig_3_7_2.If \(X,Y\) are jointly continuous, \[f_X(x)=\int f_{X,Y}(x,y)\d y\] and \[f_Y(y)=\int f_{X,Y}(x,y)\d x\]. The book proves it by differentiating \[F_X(x)=\int_{-\infty}^x\int f_{X,Y}(t,y)\d y\d t\]. In Example 3.7.7 the uniform density \(1/6\) on \([0,3]\times[0,2]\) has marginals uniform on \([0,3]\) and \([0,2]\).
pp. 179–181 Joint cdfs. The joint cdf is \[F_{X,Y}(x,y)=\P(X\le x,Y\le y)\]; for jointly continuous variables it is the volume under the surface over \((-\infty,x]\times(-\infty,y]\) (Examples 3.7.9, 3.7.10), and the joint density is recovered as \[f_{X,Y}=\partial^2F_{X,Y}/\partial x\partial y\] (Theorem 3.7.3).
For every pair of variables and every \(a<b\), \(c<d\),
\[ \P(a<X\le b,\ c<Y\le d)=F_{X,Y}(b,d)-F_{X,Y}(a,d)-F_{X,Y}(b,c)+F_{X,Y}(a,c). \]A rectangle is a difference of quadrants. Which four quadrant probabilities, with which signs, give \(\P(a<X\le b,c<Y\le d)\)?
Express the quadrant \(\{X\le b,Y\le d\}\) as the rectangle plus two strips plus a corner. Aim for: a relation among four values of \(F\).
Solve for the rectangle probability.
For the density, differentiate \(F(x,y)=\int^x\int^yf\) in \(y\) then in \(x\).
Inclusion and exclusion on the events \(\{X\le x,Y\le y\}\). The event \(\{X\le b,Y\le d\}\) is the disjoint union of the rectangle \(\{a<X\le b,c<Y\le d\}\), the strip \(\{X\le a,c<Y\le d\}\) and the strip \(\{a<X\le b,Y\le c\}\) together with \(\{X\le a,Y\le c\}\); in terms of cdf values, \[F(b,d)=\P(\text{rect})+[F(a,d)-F(a,c)]+[F(b,c)-F(a,c)]+F(a,c)\], which rearranges to the displayed formula. For the density, if \(f_{X,Y}\) is continuous then \[F(x,y)=\int_{-\infty}^x\int_{-\infty}^yf\], and differentiating twice by the fundamental theorem of calculus gives \[\partial^2F/\partial x\partial y=f\]. ∎
Example: for \(f=x+y\) on the unit square, \(F(x,y)=\tfrac12xy(x+y)\), and \[\P(0.2<X\le0.7,\,0.1<Y\le0.9)=0.504-0.099-0.028+0.003=0.380\], the same as integrating \(x+y\) over the rectangle directly. The mixed second derivative of \(F\) returns \(x+y\).
pp. 181–183 Independence. \(X\) and \(Y\) are independent if \[\P(X\in A,Y\in B)=\P(X\in A)\P(Y\in B)\] for all sets; the book proves that for continuous variables this holds exactly when the joint density factors.
Jointly continuous \(X,Y\) are independent if and only if \(f_{X,Y}(x,y)=g(x)h(y)\) for some functions \(g,h\); then there is a constant \(k=\int h\) with \(f_X=kg\) and \(f_Y=h/k\). The same holds for discrete variables with \(p\) in place of \(f\) (Definition 3.7.6 extends it to \(n\) variables).
Example 3.7.11: \(f_{X,Y}(x,y)=12xy(1-y)\) on the unit square factors as \((2x)\cdot(6y(1-y))\), so \(X\) and \(Y\) are independent with marginals \(2x\) and \(6y(1-y)\). In Example 3.7.12, \(k\) urns each hold chips numbered \(1,\dots,n\); the probability that the \(k\) chips drawn all carry the same number is \(n\cdot n^{-k}=n^{1-k}\).
(a) If \(X,Y\) are independent and \(g,h\) are functions (measurable), then \(g(X)\) and \(h(Y)\) are independent. (b) If \(f_{X,Y}\) is continuous and the set \(K=\{f_{X,Y}>0\}\) is not a product \(A\times B\), then \(X\) and \(Y\) are dependent.
For (a), pull the event back through the functions. For (b), what does a product \(f_Xf_Y\) say about where it is positive?
Write \(\{g(X)\in A'\}=\{X\in g^{-1}A'\}\) and use independence of \(X\) and \(Y\). Aim for: a product of two probabilities.
Suppose \(f=f_Xf_Y\). Where is the product positive? Aim for: a product set, contradicting the support.
For the triangle density compute \(\P(X>\frac12,Y<\frac12)\) and compare with the product of marginals.
(a) For sets \(A',B'\), \[\P(g(X)\in A',h(Y)\in B')=\P(X\in g^{-1}A',Y\in h^{-1}B')=\P(X\in g^{-1}A')\P(Y\in h^{-1}B')=\P(g(X)\in A')\P(h(Y)\in B')\]. (b) If \(X,Y\) were independent then \(f_{X,Y}=f_Xf_Y\) (Theorem 3.7.4), which is positive exactly where both \(f_X>0\) and \(f_Y>0\), i.e. on the product \(\{f_X>0\}\times\{f_Y>0\}\); so \(K\) would be a product. ∎
Example: the density \(f=2\) on the triangle \(0<x<y<1\). Here \(f_X(x)=2(1-x)\), \(f_Y(y)=2y\), and \[\P(X>\frac12,Y<\frac12)=0\] because \(x<y\) forces \(y>\frac12\), whereas \[\P(X>\frac12)\P(Y<\frac12)=\frac14\cdot\frac14=\frac1{16}>0\]. The density is constant, yet the variables are dependent, because knowing \(X=x\) restricts \(Y\) to \((x,1)\) (see the fourth preset of the slicing demo). The converse is false: a rectangular support does not imply independence (Question 3.7.47, below).
pp. 174–181 This section asks for the law of a function of one or two random variables. For a linear map the answers are immediate.
If \(Y=aX+b\): for discrete \(X\), \[p_Y(y)=p_X\bigl(\frac{y-b}a\bigr)\]; for continuous \(X\) and \(a\ne0\), \[f_Y(y)=\frac1{|a|}f_X\bigl(\frac{y-b}a\bigr)\]. Example 3.8.1: if \(X\) is uniform on \(1,\dots,10\), then \(Y=4X-1\) is uniform on \(3,7,\dots,39\).
The proof of Theorem 3.8.2 is the template for every transformation: write the cdf of the new variable as a probability about the old one, then differentiate. Three cases cover the exercises of this section.
In every case the event \(\{r(X)\le y\}\) is a set of values of \(X\). Describe it, then differentiate its probability.
Increasing \(r\): write \(F_Y(y)=F_X(r^{-1}(y))\) and differentiate. Aim for: \(f_X(r^{-1})\,(r^{-1})'\).
Decreasing \(r\): the inequality flips. Aim for: the same formula with an absolute value.
Many-to-one: for \(X^2\) take the cdf difference and differentiate with \(\frac{\d}{\d w}\sqrt w=\frac1{2\sqrt w}\).
Case 1: \[\{r(X)\le y\}=\{X\le r^{-1}(y)\}\] because \(r\) is increasing, and the chain rule gives the density. Case 2: the inequality reverses, \[\{r(X)\le y\}=\{X\ge r^{-1}(y)\}\], whose probability is \(1-F_X(r^{-1}(y))\) for a continuous \(X\). Case 3: for \(r(x)=x^2\), \[\{X^2\le w\}=\{-\sqrt w\le X\le\sqrt w\}\]; differentiate with \[\frac{\d}{\d w}\sqrt w=\frac1{2\sqrt w}\]. ∎
Check with Question 3.8.9 below: \(f_Y=6y(1-y)\) on \([0,1]\), \(W=Y^2\): \[f_W(w)=6\sqrt w(1-\sqrt w)/(2\sqrt w)=3(1-\sqrt w)\], which integrates to \(3(1-\frac23)=1\).
pp. 176–181 Sums. For independent \(X,Y\), the law of \(W=X+Y\) is the convolution:
\[p_W(w)=\sum_xp_X(x)p_Y(w-x)\] (discrete) and \[f_W(w)=\int f_X(x)f_Y(w-x)\d x\] (continuous). The book obtains the continuous case from \[F_W(w)=\int f_X(x)F_Y(w-x)\d x\], the volume over the half-plane \(x+y\le w\) (Figure 3.8.1, a sketch), and differentiates under the integral.
Example 3.8.2: if \(X\sim\Bin(m,p)\) and \(Y\sim\Bin(n,p)\) are independent, \[p_W(w)=\sum_x\binom mx\binom n{w-x}p^w(1-p)^{m+n-w}=\binom{m+n}wp^w(1-p)^{m+n-w}\] by Vandermonde's identity (Filling the gap 3.1), so \(W\sim\Bin(m+n,p)\): the binomial family reproduces itself. Not every family does: a sum of two independent uniforms is a triangle, not a uniform (Question 3.8.5; see the convolution demo, preset 1). In Example 3.8.3 a radiation monitor has two exponential sensors used one after the other (cold redundancy); the total lifetime \(W=X+Y\) has density \[\int_0^w\lambda e^{-\lambda x}\lambda e^{-\lambda(w-x)}\d x=\lambda^2we^{-\lambda w}\], \(w\ge0\).
The book computes the density of two exponentials and comments on the improvement in reliability without carrying it out. For \(n\) independent exponentials with rate \(\lambda\), the sum \(S_n\) has density \(\lambda^nw^{n-1}e^{-\lambda w}/(n-1)!\) and survival function \[\P(S_n>t)=e^{-\lambda t}\sum_{j=0}^{n-1}(\lambda t)^j/j!\].
A sum of independent exponentials is built one term at a time. Which integral does the convolution formula turn into for \(S_n+X_{n+1}\)?
Write the convolution of the claimed density of \(S_n\) with \(\lambda e^{-\lambda x}\). Aim for: the exponentials combine into \(e^{-\lambda w}\) outside the integral.
Integrate the power of \(x\). Aim for: \(\lambda^{n+1}w^ne^{-\lambda w}/n!\).
For the spare sensor take \(n=2\) and compare survival functions; find where the gain \(\lambda te^{-\lambda t}\) is largest.
Induction. For \(n=1\) it is the exponential density. If \(S_{n}\) has the stated density, then \(S_{n+1}=S_n+X_{n+1}\) has, by Theorem 3.8.3, \[\int_0^w\frac{\lambda^nx^{n-1}e^{-\lambda x}}{(n-1)!}\lambda e^{-\lambda(w-x)}\d x=\frac{\lambda^{n+1}e^{-\lambda w}}{(n-1)!}\int_0^wx^{n-1}\d x=\frac{\lambda^{n+1}w^ne^{-\lambda w}}{n!}\]. The survival function follows by integrating by parts repeatedly (or by differentiating the claimed expression). ∎
A spare sensor. One sensor survives past \(t\) with probability \(e^{-\lambda t}\); a sensor with a cold spare, \[\P(S_2>t)=(1+\lambda t)e^{-\lambda t}\]. The gain is \(\lambda te^{-\lambda t}\), largest at \(t=1/\lambda\) (the mean life of one sensor), where it equals \(e^{-1}=0.368\): there the spare lifts the survival probability from 0.368 to 0.736. The mean life doubles from \(1/\lambda\) to \(2/\lambda\), and the standard deviation grows only by a factor \(\sqrt2\).
See also (companion courses): sums and the sums that stay in their family, Results 2.19 and 2.20 of the graduate course; the mgf of a sum demo shows the same facts through moment-generating functions (Section 3.12 below).
pp. 179–181 Ratios and products. The same cdf method handles \(W=Y/X\) and \(W=XY\) for independent \(X,Y\).
If \(X\) and \(Y\) are independent and continuous, \(W=Y/X\) has density \[f_W(w)=\int_{-\infty}^\infty|x|f_X(x)f_Y(wx)\d x\] (Theorem 3.8.4), and \(W=XY\) has density \[f_W(w)=\int_{-\infty}^\infty\frac1{|x|}f_X(x)f_Y(w/x)\d x\] (Theorem 3.8.5).
The book's proof of Theorem 3.8.4 contains a slip (see Notes on the book), and Theorem 3.8.5 is left to the reader. Here is a proof of both that conditions on \(X\).
Condition on the sign of \(X\), then write each cdf as an integral over \(x\) of a cdf of \(Y\). Which probability, exactly, is \(\P(Y\ge wX,X<0)\)?
Split \(\P(Y/X\le w)\) over \(X>0\) and \(X<0\); on \(X<0\) the inequality reverses. Aim for: \(\int_0^\infty f_XF_Y(wx)+\int_{-\infty}^0f_X[1-F_Y(wx)]\).
Differentiate in \(w\). Aim for: a minus sign on the negative half, which becomes \(|x|\).
Repeat with \(w/x\) in place of \(wx\) for the product.
For the ratio, split on the sign of \(X\) and use independence and continuity of \(Y\):
\[ F_W(w)=\P(Y\le wX,X>0)+\P(Y\ge wX,X<0)=\int_0^\infty f_X(x)F_Y(wx)\d x+\int_{-\infty}^0f_X(x)\bigl[1-F_Y(wx)\bigr]\d x. \]Differentiating under the integral sign (as the book does, under smoothness), \[\frac{\d}{\d w}F_Y(wx)=xf_Y(wx)\], so
\[ f_W(w)=\int_0^\infty xf_X(x)f_Y(wx)\d x-\int_{-\infty}^0xf_X(x)f_Y(wx)\d x=\int_{-\infty}^\infty|x|f_X(x)f_Y(wx)\d x. \]For the product, \[\P(XY\le w)=\P(Y\le w/X,X>0)+\P(Y\ge w/X,X<0)=\int_0^\infty f_X(x)F_Y(w/x)\d x+\int_{-\infty}^0f_X(x)[1-F_Y(w/x)]\d x\], and \[\frac{\d}{\d w}F_Y(w/x)=\frac1xf_Y(w/x)\]; the same sign bookkeeping gives \(\int\frac1{|x|}f_X(x)f_Y(w/x)\d x\). ∎
Checks. Example 3.8.4 (product of two uniforms on the unit square): \[f_W(z)=\int_z^1\frac1x\d x=-\ln z\], \(0<z<1\). Example 3.8.5 (ratio of two iid exponentials): \[f_W(w)=\lambda^2\int_0^\infty xe^{-\lambda(1+w)x}\d x=\frac1{(1+w)^2}\], \(w\ge0\). Example 3.8.6 (\(f_X=1\), \(f_Y=2y\)): \[f_{XY}(w)=\int_w^1\frac1x\cdot\frac{2w}x\d x=2-2w\], \(0\le w\le1\).
See also (companion courses): the change-of-variables formula in several variables, Result 2.18 of the graduate course (the Jacobian approach).
\[\E g(X,Y)=\sum_x\sum_yg(x,y)p_{X,Y}(x,y)\] (discrete) and \(\iint g(x,y)f_{X,Y}(x,y)\d x\d y\) (continuous), provided the sum or integral converges absolutely; it extends to \(n\) variables. In Example 3.9.1 (the joint table with \(Z=3X-2XY+Y\)) both ways of computing \(\E Z\) give 1; in Example 3.9.2 three parallel resistors with joint density \((xy+xz+yz)/675000\) on \([10,20]^3\) have mean resistance \[\E[xyz/(xy+xz+yz)]=\frac1{675000}\iiint xyz=5.0\].
The book states the theorem with no argument. It is the two-variable version of Theorem 3.5.3.
Group outcomes by the value of \(g(X,Y)\). For the continuous case, represent a nonnegative variable by its tail and swap the order of integration.
Discrete: let \(S_j=\{g=z_j\}\) and write \(p_Z(z_j)\) as a sum over \(S_j\). Aim for: \(\sum_{x,y}g\,p_{X,Y}\).
Continuous, \(g\ge0\): repeat the argument of gap 3.10 with a double integral.
General \(g\): positive and negative parts.
Discrete. Let \(Z=g(X,Y)\), with values \(z_1,z_2,\dots\) and let \(S_j=\{(x,y):g(x,y)=z_j\}\). Then \[p_Z(z_j)=\sum_{(x,y)\in S_j}p_{X,Y}(x,y)\], and \[\E Z=\sum_jz_jp_Z(z_j)=\sum_j\sum_{S_j}g(x,y)p_{X,Y}(x,y)=\sum_{x,y}g(x,y)p_{X,Y}(x,y)\]; the sets \(S_j\) partition the support, and absolute convergence permits regrouping the terms.
Continuous. For \(g\ge0\), use the tail formula (Filling the gap 3.9) and Tonelli: \[\E g(X,Y)=\int_0^\infty\iint\one\{g(x,y)>t\}f_{X,Y}\d x\d y\d t=\iint f_{X,Y}(x,y)\int_0^\infty\one\{t<g(x,y)\}\d t\d x\d y=\iint gf_{X,Y}\]. For general \(g\) split into \(g^+-g^-\) as in Filling the gap 3.10. ∎
For any random variables \(X,Y\) with finite means (independent or not) and constants \(a,b\), \(\E(aX+bY)=a\E X+b\E Y\); more generally \[\E(\sum a_iW_i)=\sum a_i\E W_i\]. The proof applies Theorem 3.9.1 with \(g=ax+by\) and splits the integral.
pp. 184–187 Linearity makes many means trivial. A binomial variable is a sum of \(n\) Bernoulli indicators of mean \(p\), so \(\E X=np\) (Example 3.9.3). A secretary stuffing \(n\) letters into \(n\) envelopes at random gets \[\E(\text{number correct})=n\cdot\frac1n=1\] whatever \(n\) is (Example 3.9.4); ten dice have expected sum \(10\cdot3.5=35\) (Example 3.9.5); and the bridge honor count has mean 10 (Example 3.9.6).
If \(X\) and \(Y\) are independent with finite means, \(\E(XY)=\E X\,\E Y\). The book proves the discrete case and leaves the continuous case as an exercise.
Independence makes the joint density a product. Before you evaluate the double integral, ask whether it converges absolutely.
Apply Tonelli to \(|xy|f_X(x)f_Y(y)\). Aim for: \(\E|XY|=\E|X|\E|Y|<\infty\).
Apply Fubini to \(xyf_Xf_Y\) and factor the iterated integral. Aim for: \(\E X\,\E Y\).
By independence \(f_{X,Y}=f_Xf_Y\). First apply Tonelli to the nonnegative function \(|xy|f_X(x)f_Y(y)\): \[\E|XY|=\int|x|f_X\d x\int|y|f_Y\d y=\E|X|\,\E|Y|<\infty\], so \(XY\) has a finite mean and Fubini's theorem applies:
\[ \E(XY)=\int\!\!\int xyf_X(x)f_Y(y)\d y\d x=\int xf_X(x)\Bigl(\int yf_Y(y)\d y\Bigr)\d x=\E X\,\E Y. \]∎ The converse is false: \(\E(XY)=\E X\E Y\) (zero covariance) does not imply independence (Example 3.9.7 and Question 3.9.15 below).
pp. 188–189 Covariance. The covariance of \(X\) and \(Y\) is \[\Cov(X,Y)=\E(XY)-\E X\,\E Y=\E[(X-\mu_X)(Y-\mu_Y)]\]. By Theorem 3.9.3 independent variables have zero covariance (Theorem 3.9.4), but not conversely: in Example 3.9.7 the five equally likely points \((-2,4),(-1,1),(0,0),(1,1),(2,4)\) of the parabola give \(\E(XY)=0\), \(\E X=0\), so \(\Cov(X,Y)=0\), yet \[\P(X=1,Y=1)=\frac15\ne\frac15\cdot\frac25\].
\[\V(aX+bY)=a^2\V X+b^2\V Y+2ab\Cov(X,Y)\]. Corollaries: for any \(W_1,\dots,W_n\), \[\V(\sum a_iW_i)=\sum a_i^2\V W_i+2\sum_{i<j}a_ia_j\Cov(W_i,W_j)\], and for independent \(W_i\), the variance of the sum is the sum of the variances.
Example 3.9.8: for \(f_{X,Y}=x+y\) on the unit square, \(f_X(x)=x+\frac12\), \(\E X=\frac7{12}\), \(\E X^2=\frac5{12}\), \(\V X=\frac{11}{144}\), \(\E(XY)=\frac13\), \[\Cov(X,Y)=\frac13-\frac{49}{144}=-\frac1{144}\], so \[\V(X+Y)=2\bigl(\frac{11}{144}-\frac1{144}\bigr)=\frac5{36}\]. In Example 3.9.9 a binomial variable has \(\V X=np(1-p)\) as the variance of a sum of independent Bernoulli variables. Example 3.9.11: the average \(\bar W\) of \(n\) independent observations with mean \(\mu\) and variance \(\sigma^2\) has \(\E\bar W=\mu\) and \(\V\bar W=\sigma^2/n\) (the fact behind every standard error; see also the first-year normal sample demo).
pp. 189–190 The hypergeometric variance (Example 3.9.10). Write \(X=X_1+\cdots+X_n\) with \(X_i=1\) if the \(i\)-th chip drawn is red. Each \(X_i\) has \(\E X_i=p=r/N\) and \(\V X_i=p(1-p)\), and \[\Cov(X_j,X_k)=-p(1-p)/(N-1)\] for \(j\ne k\), so \[\V X=np(1-p)\frac{N-n}{N-1}\].
Write \(X\) as a sum of indicators of 'draw \(i\) is red'. The variance then needs one number besides \(p(1-p)\): the covariance of two draws.
Find \(\P(X_i=1)\) and \(\P(X_j=X_k=1)\). Aim for: \(\Cov(X_j,X_k)=p\bigl(\frac{r-1}{N-1}-\frac rN\bigr)\).
Simplify the covariance. Aim for: \(-p(1-p)/(N-1)\).
Count \(n\) variances and \(n(n-1)\) ordered covariances, and factor. Aim for: \(np(1-p)\frac{N-n}{N-1}\).
Draw the chips in order, without replacement. By symmetry the \(i\)-th chip drawn is equally likely to be any of the \(N\) chips, so \(\P(X_i=1)=r/N=p\) for every \(i\), and by the same symmetry any two draws \(j\ne k\) form a uniformly random ordered pair of distinct chips: \[\P(X_j=X_k=1)=\frac rN\cdot\frac{r-1}{N-1}\]. Hence
\[ \Cov(X_j,X_k)=\frac rN\frac{r-1}{N-1}-\frac{r^2}{N^2}=p\Bigl(\frac{r-1}{N-1}-\frac rN\Bigr)=p\,\frac{N(r-1)-r(N-1)}{N(N-1)}=-\frac{p(1-p)}{N-1}. \]The variance of the sum has \(n\) variances and \(n(n-1)\) ordered covariances:
\[ \V X=np(1-p)-n(n-1)\frac{p(1-p)}{N-1}=np(1-p)\,\frac{N-1-(n-1)}{N-1}=np(1-p)\frac{N-n}{N-1}. \]∎ Sanity checks: \(n=1\) gives \(p(1-p)\); \(n=N\) gives 0 (the whole urn is drawn, so the number of red chips is not random); and Example 3.6.1 (\(N=5\), \(r=2\), \(n=2\)) gives \[2\cdot0.4\cdot0.6\cdot\frac34=0.36\]. The negative covariance reflects that a red chip drawn leaves fewer reds in the urn. As \(N\to\infty\) with \(n\) fixed the factor tends to 1, the binomial variance of Filling the gap 3.3.
pp. 192–199 Given a random sample \(Y_1,\dots,Y_n\) from a continuous law, sort the values: \(Y'_1<Y'_2<\cdots<Y'_n\) (no ties, with probability 1: the event \(\{Y_i=Y_j\}\) has probability \(\iint_{x=y}f_Yf_Y=0\)). \(Y'_i\) is the \(i\)-th order statistic (Definition 3.10.1); \(Y'_1=Y_{\min}\) and \(Y'_n=Y_{\max}\). In Example 3.10.1 the measurements \(3.4,4.6,2.6,3.2\) have order statistics \(2.6<3.2<3.4<4.6\).
If \(Y_1,\dots,Y_n\) are independent with density \(f_Y\) and cdf \(F_Y\), then \[f_{Y_{\max}}(y)=n[F_Y(y)]^{n-1}f_Y(y)\] and \[f_{Y_{\min}}(y)=n[1-F_Y(y)]^{n-1}f_Y(y)\]. The proof differentiates the cdfs \[\P(Y_{\max}\le y)=[F_Y(y)]^n\] and \[\P(Y_{\min}>y)=[1-F_Y(y)]^n\], both products by independence.
Example 3.10.2: for three observations from the exponential density \(e^{-y}\), \(F_Y=1-e^{-y}\) and \[f_{Y'_1}(y)=3[e^{-y}]^2e^{-y}=3e^{-3y}\], again exponential with three times the rate: \[\P(Y'_1<1)=1-e^{-3}=0.95\] against \(\P(Y_1<1)=0.63\) for one observation (Figure 3.10.1). Example 3.10.3: the largest of ten observations lies below the median \(m\) with probability \((1/2)^{10}=0.00098\); no density is needed, only independence. Example 3.10.4 gives the discrete analogue \[p_{X_{\min}}(m)=[1-F_X(m-1)]^n-[1-F_X(m)]^n\] for integer-valued \(X\).
fig_3_10_1.\[ f_{Y'_i}(y)=\frac{n!}{(i-1)!\,(n-i)!}\,[F_Y(y)]^{i-1}\,[1-F_Y(y)]^{n-i}\,f_Y(y). \] The book argues heuristically, by analogy with the binomial: of the \(n\) observations, \(i-1\) fall below \(y\), one is at \(y\) and \(n-i\) above, in \(n!/[(i-1)!1!(n-i)!]\) arrangements (Figure 3.10.2, a sketch). The joint density of \(Y'_i\) and \(Y'_j\), \(i<j\), is found the same way, with five groups of observations (Figure 3.10.3, a sketch).
The "density at a point" argument of the book is correct but not a proof. A rigorous derivation goes through the cdf: \(Y'_i\le y\) exactly when at least \(i\) observations are at most \(y\).
\(Y'_i\le y\) exactly when at least \(i\) of the observations are at most \(y\). What is the law of that count?
Write \(F_{Y'_i}(y)=\sum_{k\ge i}\binom nkF^k(1-F)^{n-k}\). Aim for: a function \(G(F)\).
Differentiate each term in \(F\) as a difference of two terms. Aim for: everything cancels except one term.
Multiply by \(f_Y(y)\) and simplify \(n\binom{n-1}{i-1}\).
Let \(N_y=\#\{j:Y_j\le y\}\). The indicators \(\one\{Y_j\le y\}\) are independent Bernoulli variables with success probability \(F=F_Y(y)\), so \(N_y\sim\Bin(n,F)\) and
\[ F_{Y'_i}(y)=\P(N_y\ge i)=\sum_{k=i}^n\binom nkF^k(1-F)^{n-k}. \]Regard this as a function \(G(F)\) of \(F\) and differentiate term by term. Using \[\frac{\d}{\d F}\binom nkF^k(1-F)^{n-k}=n\bigl[\binom{n-1}{k-1}F^{k-1}(1-F)^{n-k}-\binom{n-1}kF^k(1-F)^{n-k-1}\bigr]\] (with \(\binom{n-1}n=0\)), the sum over \(k=i,\dots,n\) telescopes: the second part of the term \(k\) cancels the first part of the term \(k+1\), leaving only \(n\binom{n-1}{i-1}F^{i-1}(1-F)^{n-i}\). Since \[n\binom{n-1}{i-1}=n!/[(i-1)!(n-i)!]\], the chain rule \[\frac{\d}{\d y}G(F_Y(y))=G'(F)f_Y(y)\] gives the theorem. ∎
This also proves Theorem 3.10.1 (\(i=n\) and \(i=1\)), shows that the cdf of the \(i\)-th smallest is a binomial tail (the bottom panel of the demonstration), and works for any \(F\) without a density: only the cdf enters.
fig_x3_3.pp. 196–198 Examples 3.10.5 and 3.10.6. Annual maximum flood heights \(Y\) of a river are uniform on \((20,40)\) feet; for \(n=33\) years the book asks for the height \(h\) exceeded by the second largest value \(Y'_{32}\) with probability 0.30. The substitution \(u=y/20-1\) turns the density of \(Y'_{32}\) into \(33\cdot32\,u^{31}(1-u)\), and \[\P(Y'_{32}>h)=1-33(h/20-1)^{32}+32(h/20-1)^{33}\], set equal to 0.30 and solved numerically. Example 3.10.6 finds the density of the range \(R=Y'_3-Y'_1\) of three uniform observations from the joint density \(6(v-u)\) of \(Y'_1\) and \(Y'_3\): \(F_R(r)=3r^2-2r^3\), \(f_R(r)=6r(1-r)\).
For a Uniform(0,1) sample, \(F(y)=y\), so Theorem 3.10.2 says \(Y'_i\) has density \(\frac{n!}{(i-1)!(n-i)!}y^{i-1}(1-y)^{n-i}\), the \(\mathrm{Beta}(i,n-i+1)\) law, and consequently
\[ \E Y'_i=\frac i{n+1},\qquad \V Y'_i=\frac{i(n-i+1)}{(n+1)^2(n+2)},\qquad \P(R\le r)=nr^{n-1}-(n-1)r^n,\quad 0\le r\le1, \]where \(R=Y'_n-Y'_1\) is the range, with mean \((n-1)/(n+1)\).
For uniform data the density of \(Y'_i\) is a polynomial. Use the fact that it integrates to 1, and apply it with shifted indices.
Get the mean by applying the Beta integral with \(i+1\) and \(n+1\). Aim for: \(i/(n+1)\).
Integrate the joint density of \((Y'_1,Y'_n)\) over \(v-u\le r\), splitting at \(u=1-r\). Aim for: \(nr^{n-1}-(n-1)r^n\).
Solve for \(u\) with a bisection and convert to \(h=20(1+u)\).
Normalisation and mean. The density integrates to 1, which says \[\int_0^1y^{i-1}(1-y)^{n-i}\d y=\frac{(i-1)!(n-i)!}{n!}\] (Question 3.10.13). Then \[\E Y'_i=\frac{n!}{(i-1)!(n-i)!}\int_0^1y^i(1-y)^{n-i}\d y=\frac{n!}{(i-1)!(n-i)!}\cdot\frac{i!(n-i)!}{(n+1)!}=\frac i{n+1}\] (Question 3.10.14). The same device with \(y^{i+1}\) gives \[\E Y_i'^2=\frac{i(i+1)}{(n+1)(n+2)}\] and the variance. Range. The joint density of \((Y'_1,Y'_n)\) from the five-group argument with \(i=1\), \(j=n\) is \(n(n-1)(v-u)^{n-2}\), \(0<u<v<1\). For \(0\le r\le1\), integrate over \(v-u\le r\): for \(u\le1-r\) the inner integral is \[\int_u^{u+r}n(n-1)(v-u)^{n-2}\d v=nr^{n-1}\], for \(u>1-r\) the inner integral runs up to \(v=1\) and equals \(n(1-u)^{n-1}\). Hence
\[ \P(R\le r)=\int_0^{1-r}nr^{n-1}\d u+\int_{1-r}^1n(1-u)^{n-1}\d u=nr^{n-1}(1-r)+r^n=nr^{n-1}-(n-1)r^n. \]For \(n=3\) this is \(3r^2-2r^3\), the book's answer. Example 3.10.5. With \(u=h/20-1\) the equation is \(33u^{32}-32u^{33}=0.70\); the left side is increasing in \(u\) on \((0,1)\), so there is one root, \(u=0.96679\), giving \(h=39.336\) feet (the book prints 39.33). The second-largest of 33 annual floods exceeds 39.3 feet in 30% of record periods, even though the upper limit is 40: order statistics crowd against the end of the range. ∎
See also (companion courses): maximum, minimum and order statistics in Result 2.21 of the graduate course.
pp. 199–206 Knowing the value of one variable changes the law of another. For discrete \(X,Y\) the conditional probability function is \[p_{Y|x}(y)=\P(Y=y\mid X=x)=p_{X,Y}(x,y)/p_X(x)\] (Definition 3.11.1). In Example 3.11.1 a fair coin is tossed five times, \(Y\) is the total number of heads and \(X\) the number of heads on the last two tosses; given \(X=x\), \(Y-x\) counts heads in the first three tosses, so \[p_{Y|x}(y)=\binom3{y-x}/8\] for \(y=x,\dots,x+3\) (Figure 3.11.1). Example 3.11.2: with \(p_{X,Y}(x,y)=xy^2/39\) on \((1,2),(1,3),(2,2),(2,3)\), \(\P(X=1\mid Y=2)=\frac13\). In Example 3.11.3, if \(X,Y\) are independent binomial\((n,p)\), then given \(X+Y=z\) the law of \(X\) is hypergeometric \(\binom nx\binom n{z-x}/\binom{2n}z\), free of \(p\): the identity \(p_{X,Z}=p_Xp_Y\) divided by the binomial law of the sum \(Z\sim\Bin(2n,p)\) (Example 3.8.2) makes all powers of \(p\) cancel. (This "no \(p\) left" property is sufficiency, taken up in Chapter 5 of the book.) Example 3.11.4 conditions a trivariate law on one coordinate.
fig_3_11_1.pp. 204–205 For continuous \(X,Y\) the event \(\{X=x\}\) has probability 0, so the book defines \[\P(Y\le y\mid X=x)=\lim_{h\to0}\P(Y\le y\mid x\le X\le x+h)\] and, using l'Hôpital's rule, arrives at the conditional density
\[ f_{Y|x}(y)=\frac{f_{X,Y}(x,y)}{f_X(x)},\qquad f_X(x)>0. \]The slice of the joint surface at \(X=x\), rescaled to have area 1, is the conditional density; the slicing demo shows how it changes with \(x\).
The book defines the conditional density through a limit that interchanges limit and integral without comment, and never proves that it behaves like a law. Take (3.11.2) as the definition; then:
Dividing the joint density by the marginal is just rescaling a slice. Check area 1, then average over \(x\).
Integrate \(f_{Y|x}\) over \(y\). Aim for: 1.
Integrate \(\P(Y\in B\mid x)\) against \(f_X\). Aim for: \(\P(Y\in B)\).
Do the same with \(y\) in the integrand, justifying the swap by \(\E|Y|<\infty\). Aim for: \(\E Y=\E[\E(Y\mid X)]\).
(1) \[\int f_{Y|x}\d y=\frac1{f_X(x)}\int f_{X,Y}(x,y)\d y=\frac{f_X(x)}{f_X(x)}=1\] by Theorem 3.7.2. (2) \[\int\bigl(\int_Bf_{Y|x}\d y\bigr)f_X(x)\d x=\iint_Bf_{X,Y}(x,y)\d y\d x=\P(Y\in B)\], since \(f_{Y|x}f_X=f_{X,Y}\). (3) By Fubini (valid because \[\iint|y|f_{X,Y}=\E|Y|<\infty\]): \[\E Y=\int y\Bigl(\int f_{X,Y}(x,y)\d x\Bigr)\d y=\int\Bigl(\int yf_{Y|x}(y)\d y\Bigr)f_X(x)\d x\]. ∎
Example: \(f=x+y\) on the unit square gives \(f_X=x+\frac12\), \[f_{Y|x}(y)=\frac{x+y}{x+1/2}\], \[\E(Y\mid x)=\frac{x/2+1/3}{x+1/2}\], and \[\int_0^1\E(Y\mid x)f_X(x)\d x=\int_0^1(\frac x2+\frac13)\d x=\frac14+\frac13=\frac7{12}=\E Y\]. A remark on the limit: conditioning on a null event is only defined up to the choice of how to approach it; the strips \(x\le X\le x+h\) used in the book give (3.11.2), but a different parametrisation of the same null set (for example conditioning on \(Y/X=1\) rather than on \(Y=X\)) can give a different answer, which is why one always conditions on a variable taking a value, not on a bare event.
See also (companion courses): iterated expectation and the law of total variance, Results 3.11 and 3.12 of the graduate course, with the total variance demo.
Example 3.11.5: for \[f_{X,Y}(x,y)=\frac18(6-x-y)\] on \(0\le x\le2\), \(2\le y\le4\), the marginal is \(f_X(x)=\frac{3-x}4\), the conditional density \[f_{Y|x}(y)=\frac{6-x-y}{2(3-x)}\], and \[\P(2<Y<3\mid x=1)=\int_2^3\frac{5-y}4\d y=\frac58\].
A nonnegative \(X\) is memoryless if \[\P(X>s+t\mid X>t)=\P(X>s)\] for all \(s,t\ge0\). (i) The exponential law \(\P(X>x)=e^{-x/\lambda}\) is memoryless. (ii) Conversely, a continuous random variable on \((0,\infty)\) that is memoryless is exponential; on the positive integers the only memoryless laws are geometric.
Memorylessness turns the survival function into a multiplicative equation. Which functions satisfy \(G(s+t)=G(s)G(t)\)?
Check the exponential directly: divide \(e^{-(s+t)/\lambda}\) by \(e^{-t/\lambda}\).
Show \(G(n/m)=G(1)^{n/m}\) for rationals. Aim for: \(G(1)\in(0,1)\) for a continuous variable.
Extend to all \(t\) by monotonicity and write \(G(1)=e^{-1/\lambda}\).
(i) \[\P(X>s+t\mid X>t)=\frac{e^{-(s+t)/\lambda}}{e^{-t/\lambda}}=e^{-s/\lambda}=\P(X>s)\]. (ii) Let \(G(t)=\P(X>t)\), nonincreasing and right-continuous. Memorylessness says \(G(s+t)=G(s)G(t)\). Then \(G(n/m)=G(1/m)^n\) and \(G(1)=G(1/m)^m\), so \(G(n/m)=G(1)^{n/m}\) for all rationals. If \(G(1)=0\) then \(G(t)=0\) for all \(t>0\), impossible for a continuous variable with \(G(0+)=1\); if \(G(1)=1\) then \(G\equiv1\) on the rationals, contradicting \(G(t)\to0\); so \(0<G(1)<1\) and we may write \(G(1)=e^{-1/\lambda}\). Monotonicity and right-continuity extend \(G(t)=e^{-t/\lambda}\) from the rationals to all \(t\). For integer-valued \(X\) the same argument at integers gives \(G(k)=G(1)^k\), the geometric survival function. ∎
This is why the exponential is the model for waiting times with no ageing, and the geometric is its discrete twin (Filling the gap 3.5); a bulb whose lifetime is exponential is "as good as new" while it works, which is a strong assumption.
The mgf of \(W\) is \[M_W(t)=\E e^{tW}=\sum_ke^{tk}p_W(k)\] (discrete) or \(\int e^{tw}f_W(w)\d w\) (continuous), at the values of \(t\) for which the expectation exists.
pp. 206–208 The mgf is a direct application of Theorem 3.5.3 to \(g(w)=e^{tw}\). Example 3.12.1 (geometric): \[M_X(t)=\sum_{k\ge1}e^{tk}(1-p)^{k-1}p=pe^t/[1-(1-p)e^t]\] for \(e^t(1-p)<1\). Example 3.12.2 (binomial): \[M_X(t)=\sum_k\binom nk(pe^t)^k(1-p)^{n-k}=(1-p+pe^t)^n\] by the binomial theorem. Example 3.12.3 (exponential, rate \(\lambda\)): \[M_Y(t)=\lambda/(\lambda-t)\] for \(t<\lambda\). Example 3.12.4 (Normal): \[M_Y(t)=\exp(\mu t+\sigma^2t^2/2)\].
The book quotes \[M_Y(t)=e^{\mu t+\sigma^2t^2/2}\] for \(Y\sim\N(\mu,\sigma^2)\) after an elided computation.
Complete the square in the exponent \(ty-(y-\mu)^2/2\sigma^2\). What density is left under the integral?
Show \(ty-\frac{(y-\mu)^2}{2\sigma^2}=-\frac{(y-\mu-\sigma^2t)^2}{2\sigma^2}+\mu t+\frac{\sigma^2t^2}2\) by expanding.
Recognise a Normal density with mean \(\mu+\sigma^2t\). Aim for: \(M_Y(t)=e^{\mu t+\sigma^2t^2/2}\).
For \(Z\), read the even moments off the series.
The exponent in \[\int e^{ty}\frac1{\sigma\sqrt{2\pi}}e^{-(y-\mu)^2/2\sigma^2}\d y\] is
\[ ty-\frac{(y-\mu)^2}{2\sigma^2}=-\frac{(y-\mu-\sigma^2t)^2}{2\sigma^2}+\mu t+\frac{\sigma^2t^2}2, \]as one checks by expanding the square. The integral of \[\frac1{\sigma\sqrt{2\pi}}e^{-(y-\mu-\sigma^2t)^2/2\sigma^2}\] over \(y\) is 1 (a Normal density with mean \(\mu+\sigma^2t\)), so \[M_Y(t)=e^{\mu t+\sigma^2t^2/2}\] for every real \(t\). ∎
Consequences: for \(Z\sim\N(0,1)\), \[M_Z(t)=e^{t^2/2}=\sum_j\frac{t^{2j}}{2^jj!}\], so \[\E Z^{2j}=\frac{(2j)!}{2^jj!}\] (1, 3, 15, ...) and the odd moments vanish: skewness 0 and \(\E Z^4=3\), i.e. excess kurtosis 0. Example 3.12.11 uses \[M_{(Y-\mu)/\sigma}(t)=e^{-\mu t/\sigma}M_Y(t/\sigma)=e^{t^2/2}\] to show that the standardised variable is \(\N(0,1)\).
If \(M_W(t)\) exists in an interval around 0, then \(M_W^{(r)}(0)=\E W^r\) for \(r=1,2,\dots\). The book differentiates \(\int e^{tw}f_W(w)\d w\) under the integral sign: \[\frac{\d^r}{\d t^r}e^{tw}=w^re^{tw}\], which at \(t=0\) is \(w^r\).
If \(M_W(t)<\infty\) for \(|t|<\delta\), then \(\E|W|^r<\infty\) for every \(r\), \(M_W\) has derivatives of all orders at 0 equal to \(\E W^r\), and \[M_W(t)=\sum_r\E W^r\,t^r/r!\] for \(|t|<\delta\).
Differentiating \(\int e^{tw}f_W\) under the integral needs a dominating function. Which integrable function bounds \(|w|^re^{tw}\) when \(t\) is near 0?
Use the mgf's finiteness at \(\pm\epsilon\) to show \(\E|W|^r<\infty\). Aim for: all moments exist.
Bound \(|w|^re^{tw}\) uniformly for \(|t|\le\epsilon/2\). Aim for: an integrable dominating function.
Apply dominated convergence to the difference quotient, and induct on \(r\).
Fix \(0<\epsilon<\delta\). Since \(|w|^r\le C_{r,\epsilon}e^{\epsilon|w|/2}\) for a constant \(C_{r,\epsilon}\) (exponentials beat powers), \[\E|W|^r\le C\,\E e^{\epsilon|W|/2}\le C\,[M_W(\epsilon/2)+M_W(-\epsilon/2)]<\infty\], because \(e^{a|w|}\le e^{aw}+e^{-aw}\). For \(|t|\le\epsilon/2\) the integrand \(|w|^re^{tw}\) of the \(r\)-th derivative is dominated by \[C_{r,\epsilon}e^{\epsilon|w|/2}e^{\epsilon|w|/2}=C_{r,\epsilon}e^{\epsilon|w|}\le C_{r,\epsilon}[e^{\epsilon w}+e^{-\epsilon w}]\], which is integrable against \(f_W\) since \(M_W(\pm\epsilon)<\infty\). The difference quotients of \(e^{tw}\) are bounded by the same dominating function (mean value theorem), so by dominated convergence the derivative of \(\int e^{tw}f_W\) is \(\int we^{tw}f_W\), and inductively the \(r\)-th derivative is \(\E(W^re^{tW})\); put \(t=0\). The Taylor series follows from \(e^{tw}=\sum(tw)^r/r!\) and dominated convergence, the partial sums being dominated by \(e^{|tw|}\). ∎
Examples with it: for a geometric \(X\), \[M'(0)=\frac{p(1-p)}{p^2}+\frac pp=\frac1p\] (Example 3.12.5); for an exponential \(Y\), \[M'(0)=\lambda/\lambda^2=1/\lambda\] (Example 3.12.6) and \(\E Y^k=k!/\lambda^k\); if \[M_X(t)=(1-p_1-p_2)+p_1e^t+p_2e^{2t}\] then \(\E X^k=p_1+2^kp_2\) (Example 3.12.7); for the binomial, \(M''(0)=n(n-1)p^2+np\) so \(\V X=np(1-p)\) (Example 3.12.8); for the Poisson mgf \(e^{-\lambda+\lambda e^t}\), \(\E X=\lambda\), \(\E X^2=\lambda+\lambda^2\) and \(\V X=\lambda\) (Example 3.12.9).
If \(M_{W_1}(t)=M_{W_2}(t)\) on an interval around 0, then \(W_1\) and \(W_2\) have the same law (Theorem 3.12.2, stated without proof in the book). For \(V=aW+b\), \(M_V(t)=e^{bt}M_W(at)\); for independent \(W_1,W_2\), \[M_{W_1+W_2}(t)=M_{W_1}(t)M_{W_2}(t)\] (Theorem 3.12.3, here).
Theorem 3.12.2 is the reason the mgf is useful for sums: compute \(M_{W_1}M_{W_2}\), recognise a known mgf, conclude. Two things need saying: a proof for the cases of the book, and a warning that the moments alone do not have this property.
For nonnegative-integer laws the mgf is a power series in \(s=e^t\). What do two power series that agree on an interval have in common?
Write both mgfs as \(\sum a_ks^k\), \(\sum b_ks^k\) and compare coefficients. Aim for: \(a_k=b_k\).
For the counterexample substitute \(x=e^y\) in \(\int x^kf(x)\sin(2\pi\ln x)\d x\). Aim for: a Normal-weighted sine integral.
Shift by \(k\) and use that \(\sin\) has period \(2\pi\) and the integrand is odd.
Nonnegative integer values. If \(W_1,W_2\) take values \(0,1,2,\dots\) with probabilities \(a_k,b_k\), then \(M_{W_1}(t)=\sum a_ks^k\) and \(M_{W_2}(t)=\sum b_ks^k\) with \(s=e^t\). Equality for \(t\) in an interval means equality of two power series in \(s\) on an interval of positive length, so their coefficients agree (the coefficients of a power series are the derivatives at 0 divided by \(k!\)): \(a_k=b_k\). This covers the binomial, geometric and Poisson examples (Example 3.12.10: \[M_{X_1}M_{X_2}=e^{-(\lambda_1+\lambda_2)+(\lambda_1+\lambda_2)e^t}\], the Poisson\((\lambda_1+\lambda_2)\) mgf, so the sum is Poisson).
General case. The mgf extends to an analytic function on the strip \(|\mathrm{Re}\,z|<\delta\) (the expectation \(\E e^{zW}\) converges there); on the imaginary axis it is the characteristic function \(\E e^{i\theta W}\), and the inversion theorem for characteristic functions (Lévy) says that this determines the law (Billingsley, Probability and Measure, Theorem 26.2). The extension is what the hypothesis "on an interval around 0" buys.
The moments alone do not determine the law. Let \[f(x)=\frac1{x\sqrt{2\pi}}e^{-(\ln x)^2/2}\], \(x>0\) (the lognormal density), and \[g(x)=f(x)[1+\sin(2\pi\ln x)]\]. Then \(g\ge0\) and, for every integer \(k\ge0\), \[\int_0^\infty x^kf(x)\sin(2\pi\ln x)\d x=0\]: substitute \(x=e^y\) to get \(\int e^{ky}\phi(y)\sin(2\pi y)\d y\) with \(\phi\) the standard Normal density, and since \[e^{ky}\phi(y)=e^{k^2/2}\phi(y-k)\], shift \(y=z+k\): \[e^{k^2/2}\int\phi(z)\sin(2\pi z+2\pi k)\d z=e^{k^2/2}\int\phi(z)\sin(2\pi z)\d z=0\] since the integrand is odd. So \(f\) and \(g\) are different densities with identical moments of all orders. (Neither has an mgf in any interval around 0: for the lognormal law, \(\E e^{tY}=\infty\) for every \(t>0\), which is why the theorem does not apply.) ∎
See also (companion courses): Results 3.13 and 3.14 (properties of the mgf; an mgf determines its law) of the graduate course, and the mgf of sums demo.
pp. 213–215 Examples 3.12.10 and 3.12.11. Independent Poisson variables with means \(\lambda_1,\lambda_2\) have a Poisson sum with mean \(\lambda_1+\lambda_2\) (above); independent Normal variables have a Normal sum (Question 3.12.19), and a sum of independent binomials with the same \(p\) is binomial (Example 3.8.2); but a sum of independent exponentials is not exponential (Example 3.8.3; Question 3.12.19(b)). Finally, \((Y-\mu)/\sigma\) has mgf \(e^{t^2/2}\), so it is standard Normal.
pp. 215–217 A mean describes the centre of the distribution it was computed from, and that distribution may not be the one you think. The book's example is the 2014 state averages of SAT scores (Table 3.13.1): North Dakota heads the list at 1816, yet only about 2% of its college-bound students, roughly 160 seniors and a self-selected, academically strong group, take the SAT (the ACT is the usual test there). The 1816 is the mean of a different population from the one for a state where most students take the test, and the comparison is meaningless as a ranking of schools.
The same point has a one-line algebraic form: if a population is a mixture of groups with shares \(\pi_g\) and group means \(\mu_g\), the overall mean is \(\sum_g\pi_g\mu_g\) (the rule \(\E Y=\E[\E(Y\mid G)]\) of Filling the gap 3.23). Two states with the same group means but different shares of test takers have different overall means; and an average is the mean of whoever happened to be included. Before interpreting a mean, ask which population it summarises and who was selected into the sample.
The Poisson probabilities \(p(s)=e^{-0.82}0.82^s/s!\) are \[0.4404,\ 0.3612,\ 0.1481,\ 0.0405,\ 0.0083,\ 0.0014,\ 0.0002\] for \(s=0,\dots,6\). The book prints \(0.003\) for \(s=5\); the correct value is \(0.001\) (0.0014), and the whole tail \(\P(S\ge5)\) is \(0.0016\). The other entries are right, and the agreement with the observed proportions is as good as the book says.
The book states \[\P(1\le X\le4)=\sum_{k=1}^4(0.905)^{k-1}(0.095)=0.3297\] and then that the area under the curve is "the same". The sum is \(1-0.905^4=0.3292\); the value 0.3297 is the area under the rounded curve \(0.1e^{-0.1x}\), namely \(1-e^{-0.4}\). With the exact exponential rate \(-\ln0.905=0.0998\) the two agree exactly (Filling the gap 3.5).
The proof writes \[\P(Y\ge wX\text{ and }X<0)=1-\P(Y\le wX\text{ and }X<0)\]. The complement of the event \(\{Y\le wX,\ X<0\}\) inside \(\{X<0\}\) is \(\{Y>wX,\ X<0\}\), so the correct identity is \[\P(Y\ge wX,X<0)=\P(X<0)-\P(Y\le wX,X<0)\]; the book's version would give 3/4 instead of 1/4 for standard Normal \(X,Y\) at \(w=0\). Because the term is a constant in \(w\), the derivative, and hence the theorem, is unaffected. A corrected argument is in Filling the gap 3.17.
Solving \(1-33u^{32}+32u^{33}=0.30\) with \(u=h/20-1\) gives \(u=0.96679\) and \(h=39.336\), which rounds to 39.34, not the printed 39.33. In Example 3.3.3 the ratio \(0.301/0.046=6.5\) of the book is \[\log_{10}2/\log_{10}(10/9)=6.58\] without rounding.
Fourteen of the book's questions, restated in my own words and covering every main section, with complete solutions (hidden). Numbers were cross-checked with the book's answers to the odd-numbered questions, which they match.
Question 3.2.9 (Pepys's problem). Which is most likely: at least one six when 6 dice are rolled, at least two sixes with 12 dice, or at least three sixes with 18 dice? Compute the three probabilities.
Each case is a binomial tail with \(6k\) trials. Which complement is shortest?
\(k=1\): \(\P(\text{at least one six})\) in six dice. Aim for: \(1-(5/6)^6\).
\(k=2\): subtract the probabilities of zero and one six from 1.
\(k=3\): subtract three terms. Compare the three values.
With \(6k\) dice the number of sixes is \(\Bin(6k,\frac16)\), and we need \[\P(X\ge k)=1-\sum_{j<k}\binom{6k}j(\frac16)^j(\frac56)^{6k-j}\].
\(k=1\): \(1-(5/6)^6=0.6651\). \(k=2\): \[1-(5/6)^{12}-12\cdot\frac16(5/6)^{11}=1-0.1122-0.2692=0.6187\]. \(k=3\): \[1-(5/6)^{18}-18\cdot\frac16(5/6)^{17}-\binom{18}2\frac1{36}(5/6)^{16}=0.5973\]. So the first event is the most likely, as Newton told Pepys. The mean number of sixes is exactly \(k\) in each case, but with more dice the distribution is more symmetric about \(k\), and \(\P(X\ge k)\) falls towards \(1/2\); the book's answers 0.67, 0.62, 0.60 agree.
Question 3.2.25 (scholarships). Five scholarships are awarded at random among 8 men and 10 women finalists. What is the probability that both men and women receive awards?
The number of men among the winners is hypergeometric. Is the event 'both sexes' easy to count directly, or is its complement easier?
Identify \(N,r,n\). Aim for: the complement is 'all men' or 'all women'.
Count each case with a single binomial coefficient and add.
Subtract the sum from 1.
The number of men among the five winners is hypergeometric with \(N=18\), \(r=8\), \(n=5\). Both sexes are represented unless all five are men or all five are women, so use the complement:
\[ \P(\text{both})=1-\frac{\binom85+\binom{10}5}{\binom{18}5}=1-\frac{56+252}{8568}=1-0.0359=0.9641. \]The book's answer is 0.964. (Doing it with \(k=1,2,3,4\) men requires four terms; the complement needs two.)
Question 3.3.9 (people between two friends). Five people, including you and a friend, line up at random. Let \(X\) be the number of people standing between you and your friend. Find \(p_X(k)\).
Count ordered pairs of positions for you and your friend. How many have exactly \(k\) people between them?
Positions differing by \(k+1\): how many unordered pairs for \(k=0,1,2,3\)? Aim for: \(4-k\).
Double for the order and divide by 20. Aim for: \(p_X(k)\).
Check the sum is 1.
The positions of you and your friend form an ordered pair of distinct places among \(5\cdot4=20\), all equally likely. \(X=k\) means the places differ by \(k+1\). For \(k=0,1,2,3\) there are \(4-k\) unordered pairs of places with difference \(k+1\), hence \(2(4-k)\) ordered ones. So \[p_X(k)=\frac{2(4-k)}{20}=\frac{4-k}{10}\]:
\[p_X(0)=0.4,\quad p_X(1)=0.3,\quad p_X(2)=0.2,\quad p_X(3)=0.1,\]
which sum to 1, and \(\E X=0.3+0.4+0.3=1\). These agree with the book's answer.
Question 3.4.17 (symmetric densities). Suppose \(f_Y\) is a continuous density with \(f_Y(y)=f_Y(-y)\) for all \(y\). Show that \[\P(-a\le Y\le a)=2F_Y(a)-1\] for \(a>0\).
The event \(\{-a\le Y\le a\}\) is a difference of two cdf values. How are \(F_Y(-a)\) and \(F_Y(a)\) related by symmetry?
Write \(\P(-a\le Y\le a)=F_Y(a)-F_Y(-a)\).
Change variables in \(F_Y(-a)=\int_{-\infty}^{-a}f_Y\). Aim for: \(1-F_Y(a)\).
Combine.
By continuity points have probability zero (Filling the gap 3.7), so \[\P(-a\le Y\le a)=F_Y(a)-F_Y(-a)\]. By symmetry \[F_Y(-a)=\int_{-\infty}^{-a}f_Y(y)\d y=\int_a^\infty f_Y(u)\d u=1-F_Y(a)\] (substitute \(u=-y\) and use \(f_Y(-u)=f_Y(u)\)). Therefore \[\P(-a\le Y\le a)=F_Y(a)-[1-F_Y(a)]=2F_Y(a)-1\]. For the standard Normal and \(a=1.96\) this is \(2(0.975)-1=0.95\). ∎
Question 3.5.23 (the World Series). Two evenly matched teams play until one has won four games; games are independent. What is the expected number of games played?
The length of the series is a discrete variable on 4 to 7. Either list its pmf, or use the tail-sum formula.
Write the four probabilities. Aim for: \(\frac18,\frac14,\frac5{16},\frac5{16}\).
Weight the lengths by them. Aim for: a number between 5 and 6.
As a check compute \(4+\sum_{k=5}^7\P(X\ge k)\).
As in Example 3.2.3 the length \(X\) has probabilities \(\frac18,\frac14,\frac5{16},\frac5{16}\) for \(4,5,6,7\) games, so
\[ \E X=4\cdot\tfrac18+5\cdot\tfrac14+6\cdot\tfrac5{16}+7\cdot\tfrac5{16}=0.5+1.25+1.875+2.1875=5.8125. \]By the tail-sum formula of Filling the gap 3.9, the same number is \[4+\P(X\ge5)+\P(X\ge6)+\P(X\ge7)=4+\frac78+\frac58+\frac5{16}=5.8125\]. The book's answer agrees. The observed mean length of the 68 Stanley Cup finals is \(372/68=5.47\), below 5.81, as the shortage of long series in Table 3.2.3 suggests; with the fitted \(p=0.676\) of Figure x3.1(b) the model mean is 5.47.
Question 3.6.13 (the mean minimises squared error). Let \(X\) have finite mean \(\mu\) and variance. For a real number \(a\) put \(g(a)=\E[(X-a)^2]\). Show that \(g(a)=\V X+(\mu-a)^2\) and say what \(\min_ag(a)\) is.
Add and subtract \(\mu\) inside the square. Which cross term vanishes?
Write \(X-a=(X-\mu)+(\mu-a)\) and expand. Aim for: three terms.
Take expectations. Aim for: \(g(a)=\V X+(\mu-a)^2\).
Minimise over \(a\) and name the minimum.
Write \(X-a=(X-\mu)+(\mu-a)\) and expand: \[(X-a)^2=(X-\mu)^2+2(\mu-a)(X-\mu)+(\mu-a)^2\]. Taking expectations and using \(\E(X-\mu)=0\) gives \(g(a)=\V X+(\mu-a)^2\). The second term is nonnegative and vanishes only at \(a=\mu\), so the minimum of \(g\) is attained at \(a=\mu\) and equals \(\V X\): the variance is the smallest mean squared error with which a constant can predict \(X\), and the mean is the best constant predictor. The book's answer agrees. (For absolute error the best constant is the median instead.)
Question 3.7.13 (a probability from a joint density). If \(f_{X,Y}(x,y)=x+y\) on the unit square, find \(\P(X<2Y)\).
Sketch \(\{X<2Y\}\) in the unit square. Which of the region and its complement is a triangle?
Describe \(\{X\ge2Y\}\) as \(0\le x\le1\), \(0\le y\le x/2\).
Integrate \(x+y\) over \(y\) first. Aim for: \(\frac{x^2}2+\frac{x^2}8\).
Integrate over \(x\) and subtract from 1.
The complement is the triangle \[\{X\ge2Y\}=\{0\le y\le x/2,\ 0\le x\le1\}\], which is smaller:
\[ \P(X\ge2Y)=\int_0^1\!\!\int_0^{x/2}(x+y)\d y\d x=\int_0^1\Bigl(\frac{x^2}2+\frac{x^2}8\Bigr)\d x=\frac5{8}\cdot\frac13=\frac5{24}. \]Hence \[\P(X<2Y)=1-\frac5{24}=\frac{19}{24}=0.7917\], the book's answer. (Direct integration over \(x/2<y\le1\) gives the same.) See the slicing demo, preset 1, whose readout shows \(0.7917\).
Question 3.7.47 (showing dependence). For \(f_{X,Y}(x,y)=2x+y-2xy\) on the unit square, find numbers \(a<b\), \(c<d\) for which \[\P(a<X<b,c<Y<d)\ne\P(a<X<b)\P(c<Y<d)\].
To show dependence you need one box where the joint probability differs from the product of marginals. Start by finding the marginals.
Compute \(f_X\) and \(f_Y\). Aim for: \(x+\frac12\) and 1.
Pick the box \((0,\frac12)^2\) and integrate the joint density over it.
Compare with the product of the two marginal probabilities.
Marginals: \[f_X(x)=\int_0^1(2x+y-2xy)\d y=2x+\frac12-x=x+\frac12\] and \[f_Y(y)=\int_0^1(2x+y-2xy)\d x=1+y-y=1\], uniform. Take the box \((0,\frac12)\times(0,\frac12)\):
\[ \P(0<X<\tfrac12,0<Y<\tfrac12)=\int_0^{1/2}\Bigl(\frac{3x}4+\frac18\Bigr)\d x=\frac3{32}+\frac1{16}=\frac5{32}, \]whereas \[\P(0<X<\frac12)\P(0<Y<\frac12)=\bigl(\frac18+\frac14\bigr)\cdot\frac12=\frac3{16}=\frac6{32}\]. The two differ, so \(X\) and \(Y\) are not independent. A second witness: \(\E(XY)=\frac5{18}\), \[\E X\,\E Y=\frac7{12}\cdot\frac12=\frac7{24}\], so \[\Cov(X,Y)=-\frac1{72}\ne0\]. Note that \(Y\) is uniform whatever \(x\) is on average, yet its conditional law depends on \(x\) (see the slicing demo, preset 2). The book gives the same box.
Question 3.8.9 (the square of a variable). Let \(Y\) have density \(f_Y(y)=6y(1-y)\), \(0\le y\le1\). Find the density of \(W=Y^2\).
Express \(F_W(w)=\P(Y^2\le w)\) as a cdf value of \(Y\), then differentiate.
Show \(\P(Y^2\le w)=\P(Y\le\sqrt w)\) because \(Y\ge0\).
Substitute \(\sqrt w\) into \(F_Y\). Aim for: \(3w-2w^{3/2}\).
Differentiate and check that the density integrates to 1.
For \(0<w<1\), \[F_W(w)=\P(Y^2\le w)=\P(Y\le\sqrt w)=F_Y(\sqrt w)=3w-2w^{3/2}\] (since \(F_Y(y)=3y^2-2y^3\)). Differentiate: \[f_W(w)=3-3\sqrt w=3(1-\sqrt w)\], \(0<w<1\). Check: \[\int_0^13(1-\sqrt w)\d w=3(1-\frac23)=1\]. Equivalently use the change-of-variables formula of Filling the gap 3.15: \[ \frac{f_Y(\sqrt w)}{2\sqrt w}=\frac{6\sqrt w(1-\sqrt w)}{2\sqrt w}=3(1-\sqrt w). \]
The density is decreasing, unlike the bell shape of \(f_Y\), because squaring compresses values near 0 and stretches those near 1. ∎
Question 3.8.13 (a ratio). \(X\) and \(Y\) are independent with \(f_X(x)=xe^{-x}\), \(x\ge0\), and \(f_Y(y)=e^{-y}\), \(y\ge0\). Find the density of \(W=Y/X\).
Both variables are positive, so the absolute value in the ratio formula is harmless. What integral do you get?
Write \(f_W(w)=\int_0^\infty x\,f_X(x)f_Y(wx)\d x\) for \(w>0\).
Insert the two densities. Aim for: \(\int x^2e^{-(1+w)x}\d x\).
Evaluate with the gamma integral and verify the total mass.
By Theorem 3.8.4 (Filling the gap 3.17), for \(w>0\) (both variables are positive, so \(|x|=x\) and \(f_Y(wx)=e^{-wx}\) for \(x>0\)):
\[ f_W(w)=\int_0^\infty x\cdot xe^{-x}\cdot e^{-wx}\d x=\int_0^\infty x^2e^{-(1+w)x}\d x=\frac{2}{(1+w)^3},\qquad w>0, \]using \[\int_0^\infty x^2e^{-ax}\d x=2/a^3\]. It integrates to 1 (\[\int_0^\infty2(1+w)^{-3}\d w=1\]); the cdf is \(F_W(w)=1-(1+w)^{-2}\), so for instance \[\P(Y\le X)=F_W(1)=\frac34\]. Note the heavy tail: \[\E W=\int_0^\infty\frac{2w}{(1+w)^3}\d w=1\] is finite but \(\E W^2=\infty\).
Question 3.9.15 (uncorrelated but dependent). Let \(U\) be uniform on \([0,2\pi]\), \(X=\cos U\), \(Y=\sin U\). Show that \(X\) and \(Y\) are dependent but \(\Cov(X,Y)=0\).
Two separate tasks: compute the covariance, and find an event for which the product rule fails.
Compute \(\E X\), \(\E Y\), \(\E(XY)\) by integrating over \([0,2\pi]\). Aim for: all three zero.
What is \(\P(X>0.9,Y>0.9)\)? Use \(X^2+Y^2=1\).
Compare with \(\P(X>0.9)\P(Y>0.9)\).
\[\E X=\frac1{2\pi}\int_0^{2\pi}\cos u\d u=0\], \(\E Y=0\), and \[ \E(XY)=\frac1{2\pi}\int_0^{2\pi}\sin u\cos u\d u=\frac1{4\pi}\int_0^{2\pi}\sin2u\d u=0, \] so \(\Cov(X,Y)=0\). They are nevertheless dependent: \(X^2+Y^2=1\) always, so \(X\) and \(Y\) cannot both exceed 0.9, and \(\P(X>0.9,Y>0.9)=0\). But each of them exceeds 0.9 with positive probability, \[ \P(X>0.9)=\P(Y>0.9)=\frac{\arccos0.9}{\pi}=0.144, \] (the angle must lie within \(0.451\) radians of 0, respectively of \(\pi/2\)), so the product of the marginal probabilities is \(0.021\ne0\). Zero covariance measures only linear association; this pair lies on a circle. (Compare Example 3.9.7, the parabola.)
Question 3.10.13 (a Beta integral from order statistics; with 3.10.14). For a sample from the Uniform(0,1) law use Theorem 3.10.2 to show that \[\int_0^1y^{i-1}(1-y)^{n-i}\d y=\frac{(i-1)!(n-i)!}{n!}\], and use it to find \(\E Y'_i\).
The density of an order statistic must integrate to 1. Specialise Theorem 3.10.2 to the uniform case.
Write the density of \(Y'_i\) for the uniform law. Aim for: a constant times \(y^{i-1}(1-y)^{n-i}\).
Set its integral equal to 1. Aim for: the Beta integral.
For \(\E Y'_i\) apply the same identity with \(i+1\), \(n+1\).
For the Uniform(0,1) law \(F_Y(y)=y\) and \(f_Y=1\) on \([0,1]\), so by Theorem 3.10.2 the \(i\)-th order statistic has density \(\frac{n!}{(i-1)!(n-i)!}y^{i-1}(1-y)^{n-i}\) on \([0,1]\). A density integrates to 1, so \[\frac{n!}{(i-1)!(n-i)!}\int_0^1y^{i-1}(1-y)^{n-i}\d y=1\], which is the identity. For the mean apply the identity with \(i+1\) in place of \(i\) and \(n+1\) in place of \(n\):
\[ \E Y'_i=\frac{n!}{(i-1)!(n-i)!}\int_0^1y^{i}(1-y)^{n-i}\d y=\frac{n!}{(i-1)!(n-i)!}\cdot\frac{i!\,(n-i)!}{(n+1)!}=\frac i{n+1}. \]The \(n\) sample points divide \([0,1]\) into \(n+1\) gaps of equal mean length \(\frac1{n+1}\), and \(Y'_i\) sits at the end of the \(i\)-th (Filling the gap 3.22; the demonstration shows the case \(n=5\), \(i=3\)). ∎
Question 3.11.21 (iterated expectation). For continuous \(X,Y\) with \(\E|Y|<\infty\), prove \(\E(Y)=\E_X[\E(Y\mid X)]\).
Write \(f_Y\) as an integral of the joint density, then split the joint density as \(f_Xf_{Y|x}\).
Start from \(\E Y=\int yf_Y(y)\d y\) and substitute the double integral.
Swap the order of integration. Aim for: an inner integral \(\int yf_{Y|x}(y)\d y\).
Identify it as \(\E(Y\mid x)\) and the outer integral as an expectation over \(X\).
Start from \(\E Y=\int y\,f_Y(y)\d y\) with \[f_Y(y)=\int f_{X,Y}(x,y)\d x\] and \(f_{X,Y}=f_X(x)f_{Y|x}(y)\):
\[ \E Y=\int\!\!\int yf_X(x)f_{Y|x}(y)\d x\d y=\int f_X(x)\Bigl[\int yf_{Y|x}(y)\d y\Bigr]\d x=\int f_X(x)\E(Y\mid x)\d x=\E_X[\E(Y\mid X)], \]where the interchange of the order of integration is Fubini's theorem, valid because \[\iint|y|f_{X,Y}=\E|Y|<\infty\]. (The details are in Filling the gap 3.23.) Example: \(f=x+y\) gives \[\E(Y\mid x)=\frac{x/2+1/3}{x+1/2}\] and \[\int_0^1(x+\frac12)\E(Y\mid x)\d x=\frac7{12}\], the mean of \(Y\) computed from its marginal \(y+\frac12\). ∎
Question 3.12.21 (the sample mean of Normal data). \(Y_1,\dots,Y_n\) is a random sample from \(\N(\mu,\sigma^2)\). Use moment-generating functions to find the law of \(\bar Y=\frac1n\sum Y_i\).
Product of mgfs for the sum, then rescale \(t\) for the average. Which known mgf is the result?
Multiply the \(n\) mgfs. Aim for: \(e^{n\mu t+n\sigma^2t^2/2}\).
Replace \(t\) by \(t/n\). Aim for: \(e^{\mu t+(\sigma^2/n)t^2/2}\).
Recognise a Normal mgf and write the density.
Each \(Y_i\) has \[M_{Y_i}(t)=e^{\mu t+\sigma^2t^2/2}\] (Filling the gap 3.25). By Theorem 3.12.3, for independent variables the mgf of the sum is the product, \[M_{\sum Y_i}(t)=e^{n\mu t+n\sigma^2t^2/2}\], and for the linear map \(\bar Y=\frac1n\sum Y_i\), \[M_{\bar Y}(t)=M_{\sum Y_i}(t/n)\]:
\[ M_{\bar Y}(t)=\exp\Bigl\{n\mu\frac tn+\frac{n\sigma^2}2\frac{t^2}{n^2}\Bigr\}=\exp\Bigl\{\mu t+\frac{\sigma^2}{n}\frac{t^2}2\Bigr\}, \]which is the mgf of \(\N(\mu,\sigma^2/n)\). By the uniqueness theorem (Theorem 3.12.2, Filling the gap 3.27), \(\bar Y\sim\N(\mu,\sigma^2/n)\), with density \[f_{\bar Y}(y)=\frac{\sqrt n}{\sigma\sqrt{2\pi}}\exp\{-\frac{n(y-\mu)^2}{2\sigma^2}\}\]. The mean and variance \(\mu,\sigma^2/n\) agree with Example 3.9.11; the mgf adds that the shape stays Normal. This is the starting point of the \(t\) and \(\chi^2\) theory of the book's Chapter 7 (see the first-year normal sample demo).
Each demonstration runs in the browser and links back to these notes. The ▶ Demo boxes above open them already set to the case under discussion.
| Demonstration | What you can see | Sections and results |
|---|---|---|
| Without replacement or with replacement? | Hypergeometric and binomial bars side by side, the variance ratio \((N-n)/(N-1)\), total variation distance and the operating curve of the plan "accept if at most \(c\) defectives". Presets: 1 Case Study 3.2.1, good lot; 2 bad lot; 3 Example 3.2.8 audit; 4 Fantasy Five; 5 sampling most of a small lot. | Section 3.2; 3.3, 3.20; Question 3.2.25 |
| Slicing a joint density | Heat map of a joint density, marginals, the conditional density and its mean at a chosen \(x_0\), covariance, an independence gap, and the probability of \(X<cY\). Presets: 1 \(x+y\); 2 Question 3.7.47; 3 independent density; 4 triangle; 5 \((3/2)(x^2+y^2)\). | Sections 3.7, 3.9, 3.11; 3.14, 3.23; Questions 3.7.13, 3.7.47 |
| The i-th smallest of n observations | The exact density of \(Y'_i\) over a simulated histogram, the binomial-tail probabilities \(\P(Y'_j\le y)\), exact and simulated means. Presets: 1 Example 3.10.2; 2 median of five uniform; 3 Example 3.10.5; 4 Example 3.10.3; 5 the largest of 20 Normal observations. | Section 3.10; 3.21, 3.22; Question 3.10.13 |
Related demonstrations elsewhere: for transformations and sums (Section 3.8), the cdf method and convolution demos; for iterated expectation and variance (Section 3.11), the total variance demo; for moment-generating functions (Section 3.12), the mgf of sums demo; for the sample mean (Section 3.9), the first-year central limit theorem demo and normal sample demo.