程序代写代做代考 clock C discrete mathematics EECS 70 Discrete Mathematics and Probability Theory Fall 2020

EECS 70 Discrete Mathematics and Probability Theory Fall 2020
Continuous Probability Distributions
Note 20
Up to now we have focused exclusively on discrete sample spaces Ω, where the number of sample points ω ∈ Ω is either finite or countably infinite (such as the integers). As a consequence, we have only been able to talk about discrete random variables, which take on only a finite or countably infinite number of values.
But in real life many quantities that we wish to model probabilistically are real-valued; examples include the position of a particle in a box, the time at which an certain incident happens, or the direction of travel of a meteorite. In this lecture, we discuss how to extend the concepts we’ve seen in the discrete setting to this continuous setting. As we shall see, everything translates in a natural way once we have set up the right framework. The framework involves some elementary calculus but (at this level of discussion) nothing too daunting.
1 Continuous Uniform Probability Space
Suppose we spin a “wheel of fortune” and record the position of the pointer on the outer circumference of the wheel. Assuming that the circumference is of length l and that the wheel is unbiased, the position is presumably equally likely to take on any value in the real interval [0, l]. How do we model this experiment using a probability space?
Consider for a moment the analogous discrete setting, where the pointer can stop only at a finite number m
of positions distributed evenly around the wheel. (If m is very large, then this is in some sense similar to the
continuous setting, which we can think of as the limit m → ∞.) Then we would model this situation using
the discrete sample space Ω = {0, l , 2l,…, (m−1)l}, with uniform probabilities P[ω] = 1 for each ω ∈ Ω. mmmm
In the continuous setting, however, we get into trouble if we try the same approach. If we let ω range over all real numbers in Ω = [0,l], what value should we assign to each P[ω]? By uniformity, this probability should be the same for all ω. But if we assign P[ω] to be any positive value, then because there are infinitely many ω in Ω, the sum of all probabilities P[ω] will be ∞! Thus, P[ω] must be zero for all ω ∈ Ω. But if all of our sample points have probability zero, then we are unable to assign meaningful probabilities to any events!
To resolve this problem, consider instead any interval [a, b] ⊆ [0, l], where b > a. Can we assign a non-zero probability value to this interval? Since the total probability assigned to [0, l] must be 1, and since we want our probability to be uniform, the logical value for the probability of interval [a, b] is
length of [a,b] = b−a. length of [0,l] l
In other words, the probability of an interval is proportional to its length.
Note that intervals are subsets of the sample space Ω and are therefore events. So in contrast to discrete probability, where we assigned probabilities to points in the sample space, in continuous probability we are assigning probabilities to certain basic events (in this case intervals). What about probabilities of other
EECS 70, Fall 2020, Note 20 1

events? By specifying the probability of intervals, we have also specified the probability of any event E
which can be written as the disjoint union of (a finite or countably infinite number of) intervals, E = ∪iEi.
For then we can write P[E] = ∑i P[Ei], in analogous fashion to the discrete case. Thus for example the
probability that the pointer ends up in the first or third quadrants of the wheel is l/4 + l/4 = 1 . For all
practical purposes, such events are all we really need.1
2 Continuous Random Variables
Recall that in the discrete setting we typically work with random variables and their distributions, rather than directly with probability spaces and events. The simplest example of a continuous random variable is the position X of the pointer in the wheel of fortune, as discussed above. This random variable has the uniform distribution on [0,l]. How, precisely, should we define the distribution of a continuous random variable? In the discrete case the distribution of a r.v. X is described by specifying, for each possible value a, the probability P[X = a]. But for the r.v. X corresponding to the position of the pointer, we have P[X = a] = 0 for every a, so we run into the same problem as we encountered above in defining the probability space.
The resolution is the same: instead of specifying P[X = a], we specify P[a ≤ X ≤ b] for all intervals [a, b].2 To do this formally, we need to introduce the concept of a probability density function (sometimes referred to just as a “density”, or a “p.d.f.”).
Definition 20.1 (Probability Density Function). A probability density function (p.d.f.) for a real-valued random variable X is a function f : R → R satisfying:
1. f is non-negative: f(x) ≥ 0 for all x ∈ R.
2. Thetotalintegralof f isequalto1:􏰞∞ −∞
Then the distribution of X is given by:
P[a≤X ≤b]=
Let us examine this definition. Note that the definite integral is just the area under the curve f between the values a and b. Thus f plays a similar role to the “histogram” we sometimes draw to picture the distribution of a discrete random variable. The first condition that f be non-negative ensures that the probability of every event is non-negative. The second condition that the total integral of f equal to 1 ensures that it defines a valid probability distribution, because the r.v. X must take on real values:
􏰟∞ −∞
For example, consider the wheel-of-fortune r.v. X , which has uniform distribution on the interval [0, l]. This means the density f of X vanishes outside this interval: f (x) = 0 for x < 0 and for x > l. Within the interval [0, l] we want the distribution of X to be uniform, which means we should take f to be a constant f (x) = c for 0 ≤ x ≤ l. The value of c is determined by the requirement (1) that the total area under f is 1:
􏰟∞ 􏰟l
1= f(x)dx= cdx=cl,
−∞ 0
1A formal treatment of which events can be assigned a well-defined probability requires a discussion of measure theory, which is beyond the scope of this course.
2Note that it does not matter whether or not we include the endpoints a,b; since P[X = a] = P[X = b] = 0, we have P[a l.
Remark: Following the “histogram” analogy above, it is tempting to think of f (x) as a “probability.” How-
ever, f (x) doesn’t itself correspond to the probability of anything! In particular, there is no requirement that
f (x) be bounded by 1. For example, the density of the uniform distribution on the interval [0, l] with l = 1 is 2
equalto f(x)=1/(1)=2for0≤x≤ 1,whichisgreaterthan1. Toconnectdensity f(x)withprobabilities, 22
we need to look at a very small interval [x,x+dx] close to x; then we have
􏰟 x+dx x
f(z)dz ≈ f(x)dx. (2)
For a continuous random variable X , one often starts the discussion with the cumulative distribution function (c.d.f.), which is the function F(x) = P[X ≤ x]. It is closely related to the probability density function for X,
P[x ≤ X ≤ x+dx] =
Thus, we can interpret f (x) as the “probability per unit length” in the vicinity of x.
2.1 Cumulative Distribution Function
f (x), as
Thus, one can describe a random variable X by its c.d.f., denoted by F(x), which then gives the probability
density function, f (x), as
F(x) = P[X ≤ x] = f(x)= dF(x).
dx
f(z)dz. (3)
􏰟x −∞
To connect to discrete probability, one might think of approximating a continuous random variable, X, as the set of probabilities for X being in one of a countably infinite set of intervals of length dx on the real line. That is, the set of probabilities P[xk < X ≤ xk +dx] where xk = kdx for k ∈ Z. In this view, P[X ≤ xi] = ∑j≤i P[xj < X ≤ xj +dx]. Connecting this to the probability density function, f(x), we have for “small” dx, and P[xj < X ≤ xj +dx] ≈ f(xj)dx F(xi) = P[X ≤ xi] ≈ ∑ f(xj)dx. j≤i Calculus comes in when we see the expression above is a Riemann sum. Taking the limit as dx goes to zero yields the integral we see in (3). 2.2 Expectation and Variance As in the discrete case, we define the expectation of a continuous r.v. as follows: Definition 20.2 (Expectation). The expectation of a continuous r.v. X with probability density function f is 􏰟∞ E[X]= xf(x)dx. −∞ EECS 70, Fall 2020, Note 20 3 Note that the integral plays the role of the summation in the discrete formula E[X ] = ∑a aP[X = a]. Similarly, we can define the variance as follows: Definition 20.3 (Variance). The variance of a continuous r.v. X with probability density function f is Example 􏰂 2􏰃􏰂2􏰃2􏰟∞2 􏰊􏰟∞ 􏰋2 Var(X)=E (X−E[X]) =E X −E[X] = x f(x)dx − xf(x)dx . −∞ −∞ Let X be a uniform r.v. on the interval [0, l]. Then intuitively, its expected value should be in the middle, l . 2 Indeed, we can use our definition above to compute 􏰟l1 x2􏰄l l E[X]= xdx= 􏰄􏰄=, 0 l 2l􏰄0 2 as claimed. We can also calculate its variance using the above definition and plugging in the value E[X ] = l 2 to get: 􏰟l 21 2 x3􏰄l 􏰊l􏰋2 l2 l2 l2 Var(X)= x dx−E[X]= 􏰄􏰄− = − = . 12 come as no surprise. Like its discrete counterpart, this distribution has large variance. 2.3 Joint Distribution Recall that for discrete random variables X and Y , their joint distribution is specified by the probabilities P[X = a, Y = c] for all possible values a, c. Similarly, if X and Y are continuous random variables, then their jointdistributionsarespecifiedbytheprobabilitiesP[a≤X ≤b,c≤Y ≤d]foralla≤b,c≤d. Moreover, just as the distribution of X can be characterized by its density function, the joint distribution of X and Y can be characterized by their joint density. Definition 20.4 (Joint Density). A joint density function for two random variable X and Y is a function f : R2 → R satisfying: 1. f is non-negative: f(x,y) ≥ 0 for all x,y ∈ R. 2. Thetotalintegralof f isequalto1:􏰞∞ 􏰞∞ f(x,y)dxdy=1. Then the joint distribution of X and Y is given by: square [x,x+dx]×[y,y+dy] close to (x,y); then we have 0 l 3l􏰄0 2 3 4 12 The factor of 1 here is not particularly intuitive, but the fact that the variance is proportional to l2 should −∞ −∞ 􏰟d􏰟b ca P[a≤X ≤b, c≤Y ≤d]= In analogy with (2), we can connect the joint density f(x,y) with probabilities by looking at a very small f(x,y)dxdy foralla≤bandc≤d. 􏰟 y+dy 􏰟 x+dx yx P[x≤X ≤x+dx, y≤Y ≤y+dy]= Thus we can interpret f (x, y) as the “probability per unit area" in the vicinity of (x, y). EECS 70, Fall 2020, Note 20 4 f(u,v)dudv≈ f(x,y)dxdy. (4) 2.4 Independence Recall that two discrete random variables X and Y are said to be independent if the events X = a and Y = c are independent for every possible values a, c. We have a similar definition for continuous random variables: Definition 20.5 (Independence for Continuous R.V.’s). Two continuous r.v.’s X,Y are independent if the events a ≤ X ≤ b and c ≤ Y ≤ d are independent for all a ≤ b and c ≤ d: P[a≤X ≤b, c≤Y ≤d]=P[a≤X ≤b]·P[c≤Y ≤d]. What does this definition say about the joint density of independent r.v.’s X and Y ? Applying (4) to connect the joint density with probabilities, we get, for small dx and dy: f(x,y)dxdy ≈ P[x≤X ≤x+dx, y≤Y ≤y+dy] = P[x≤X ≤x+dx]·P[y≤Y ≤y+dy] (byindependence) ≈ fX (x)dx × fY (y)dy = fX(x)fY(y)dxdy, where fX and fY are the (marginal) densities of X and Y respectively. So we get the following result: Theorem 20.1. The joint density of independent r.v.’s X and Y is the product of the marginal densities: f(x,y)= fX(x)fY(y) forall x,y∈R. 3 Exponential Distribution We have already seen one important continuous distribution, namely the uniform distribution. In this and next sections we will see two more: the exponential distribution and the normal (or Gaussian) distribution. These three distributions cover the vast majority of continuous random variables arising in applications. The exponential distribution is a continuous version of the geometric distribution, which we have already seen. Recall that the geometric distribution describes the number of tosses of a coin until the first Head appears; the distribution has a single parameter p, which is the bias (Heads probability) of the coin. Of course, in real life applications we are usually not waiting for a coin to come up Heads but rather waiting for a system to fail, a clock to ring, an experiment to succeed, etc. In such applications we are frequently not dealing with discrete events or discrete time, but rather with continuous time: for example, if we are waiting for an apple to fall off a tree, it can do so at any time at all, not necessarily on the tick of a discrete clock. This situation is naturally modeled by the exponential distribution, defined as follows. Definition 20.6 (Exponential Distribution). For λ > 0, a continuous random variable X with p.d.f. 􏰅λe−λx, ifx≥0,
f (x) = 0, otherwise,
is called an exponential random variable with parameter λ , and we write X ∼ Exp(λ ).
Note that by definition f (x) is non-negative. Moreover, we can check that it satisfies (1): 􏰟∞ 􏰟∞ −λx −λx􏰄∞
f(x)dx= λe dx=−e 􏰄􏰄 =1, −∞ 0 0
so f (x) is indeed a valid probability density function. Figure 1 shows the probability density function for the exponential distribution with a few different values of λ .
EECS 70, Fall 2020, Note 20 5

2.0 1.5 1.0 0.5
λ0.5 λ1 λ2
3.1
0.0 0.5 1.0
Figure 1: The probability density function f (x) for the exponential distribution with λ = 0.5, 1, 2.
Mean and Variance of an Exponential Random Variable
1.5 2.0 2.5 3.0
x
Let us now compute the expectation and variance of X ∼ Exp(λ ).
Theorem 20.2. Let X be an exponential random variable with parameter λ > 0. Then
E[X]=1 and Var(X)= 1. λ λ2
Proof. We can calculate the expected value using integration by parts:
􏰟∞ 􏰟∞ −λx −λx􏰄∞􏰟∞−λx 􏰊e−λx􏰋􏰄∞ 1
E[X]= xf(x)dx= λxe dx=−xe 􏰄􏰄 + e dx=0+ − 􏰄􏰄 = . −∞0 00 λ􏰄0λ
To compute the variance, we first evaluate E􏰂X2􏰃, again using integration by parts:
􏰂2􏰃􏰟∞2 􏰟∞2−λx 2−λx􏰄∞􏰟∞ −λx 2 2
E X = x f ( x ) d x = λ x e d x = − x e 􏰄􏰄 + 2 x e d x = 0 + E [ X ] = −∞ 0 00 λλ
2 .
The variance is therefore as claimed.
Var(X)=E􏰂X2􏰃−E[X]2 = 2 − 1 = 1 , λ2 λ2 λ2
3.2 As Continuous Time Analog of Geometric Distribution
Like the geometric distribution, the exponential distribution has a single parameter λ , which characterizes the rate at which events happen. Note that the exponential distribution satisfies, for any t ≥ 0,
􏰟∞ −λx −λx􏰄∞ −λt
P[X>t]= λe dx=−e 􏰄􏰄=e . (5)
tt
In other words, the probability that we have to wait more than time t for our event to happen is e−λ t , which
is an exponential decay with rate λ .
Now consider a discrete-time setting in which we perform one trial every δ seconds (where δ is very small
— in fact, we will take δ → 0 to make time “continuous”), and where our success probability is p = λ δ . EECS 70, Fall 2020, Note 20 6
ProbabilityDensity f(x)

Making the success probability proportional to δ makes sense, as it corresponds to the natural assumption that there is a fixed rate of success per unit time, which we denote by λ = p/δ . In this discrete setting, the number of trials until we get a success has the geometric distribution with parameter p, so if we let the r.v. Y denote the time (in seconds) until we get a success, we have
P[Y > kδ] = (1− p)k = (1−λδ)k, for any integer k ≥ 0. Hence, for any t > 0, we have
P[Y >t]=P[Y >(t )δ]=(1−λδ)t/δ ≈e−λt, (6) δ
where this final approximation holds in the limit as δ → 0 with λ and t fixed. (We are ignoring the detail of rounding t to an integer since we are taking an approximation anyway.)
δ
Comparing the expression (6) with (5), we see that this distribution has the same form as the exponential distribution with parameter λ, where λ (the success rate per unit time) plays an analogous role to p (the probability of success on each trial) — though note that λ is not constrained to be ≤ 1. Thus we may view the exponential distribution as a continuous time analog of the geometric distribution.
4 Normal Distribution
Another continuous distribution we will consider, and by far the most prevalent in applications, is called the normal or Gaussian distribution. It has two parameters, μ and σ2, which are the mean and variance of the distribution, respectively.
Definition 20.7 (Normal Distribution). For any μ ∈ R and σ > 0, a continuous random variable X with p.d.f.
f(x) = √ 1 e−(x−μ)2/(2σ2) 2πσ2
is called a normal random variable with parameters μ and σ2, and we write X ∼ N(μ,σ2). In the special case μ = 0 and σ = 1, X is said to have the standard normal distribution.
Let’s first check that this is a valid definition of a probability density function. Clearly f (x) ≥ 0 from the definition. For condition (1):
􏰟 ∞ 1 􏰟 ∞ −(x−μ)2/(2σ2)
f(x)dx= √ 2 e dx=1. (7)
−∞ 2πσ −∞
The fact that this integral evaluates to 1 is a routine exercise in (multivariable) integral calculus, and is left
as an exercise .
A plot of the p.d.f. f reveals a classical “bell-shaped” curve, centered at (and symmetric around) x = μ, and with “width” determined by σ . Figure 2 shows that the normal density with different values of μ and σ are very similar to each other. Indeed, the normal distribution has the following nice property with respect to shifting and rescaling.
Lemma 20.1. If X ∼ N(μ,σ2), then Y = X−μ ∼ N(0,1). Equivalently, if Y ∼ N(0,1), then
σ
X = σY +μ ∼ N(μ,σ2).
Proof. Given that X ∼ N(μ,σ2), we can calculate the distribution of Y = X−μ as:
1 􏰟 b −y2/2 dx= √ e
2π a
P[a≤Y ≤b]=P[σa+μ ≤X ≤σb+μ]= √ 2
2πσ σa+μ
e
dy,
σ
1 􏰟 σb+μ −(x−μ)2/(2σ2)
EECS 70, Fall 2020, Note 20
7

0.4 0.3 0.2 0.1 0.0
(μ,σ2) = (0,1) (μ,σ2) = (0,4) (μ,σ2) = (2,1)
-6 -4 -2 0 2 4 6 x
Figure 2: The density function for the normal distribution with several different choices for μ and σ2. by a simple change of variable x = σ y + μ in the integral. Hence Y is indeed standard normal. Note that Y
is obtained from X just by shifting the origin to μ and scaling by σ .
4.1 Mean and Variance of a Normal Random Variable
Let us now calculate the expectation and variance of a normal random variable. Theorem 20.3. For X ∼ N(μ,σ2),
E[X] = μ and Var(X) = σ2.
Proof. First consider the case when X ∼ N(0,1). By definition, its expectation is
E[X]=
−∞
=0.
1 􏰟 ∞ xf(x)dx= √
−x2/2 1 􏰊􏰟 0 −x2/2 xe dx= √ xe
−x2/2 􏰋 xe dx
􏰟 ∞
􏰂 2􏰃 2 1 􏰟 ∞ 2 −x2/2 Var(X)=EX −E[X] = √ xe dx
2π −∞
1 􏰀 −x2/2􏰁􏰄∞ 1 􏰟 ∞ −x2/2
= √ −xe 􏰄􏰄 +√ e dx
dx+
The last step follows from the fact that the function e−x2/2 is symmetrical about x = 0, so the two integrals
2π −∞
are the same except for the sign. For the variance, we have
2π −∞
􏰟 ∞ 0
2π −∞ 2π −∞ 1 􏰟∞ −x2/2
=√ edx=1. 2π −∞
In the first line here we used the fact that E[X ] = 0; in the second line we used integration by parts; and in the last line we used (7) in the special case μ = 0, σ = 1. So the standard normal distribution has expectation E[X]=0=μ andvarianceVar(X)=1=σ2.
Now consider the general case when X ∼ N(μ,σ2). By Lemma 20.1, we know that Y = X−μ is a standard σ
normal random variable, so E[Y ] = 0 and Var(Y ) = 1, as we have just established above. Therefore, we can read off the expectation and variance of X from those of Y . For the expectation, using linearity, we have
􏰚X−μ􏰛 E[X]−μ 0=E[Y]=E = ,
σσ
EECS 70, Fall 2020, Note 20
8
ProbabilityDensity f(x)

and hence E[X] = μ. For the variance we have
1=Var(Y)=Var σ = σ2 ,
and hence Var(X) = σ2.
The bottom line, then, is that the normal distribution has expectation μ and variance σ2. This explains the
notation for the parameters μ and σ2.
The fact that the variance is σ2 (so that the standard deviation is σ) explains our earlier comment that σ determines the “width” of the normal distribution. Namely, by Chebyshev’s inequality, a constant fraction of the distribution lies within distance (say) 2σ of the expectation μ.
Note: The above analysis shows that, by means of a simple origin shift and scaling, we can relate any normal distribution to the standard normal. This means that, when doing computations with normal distributions, it’s enough to do them for the standard normal. For this reason, books and online sources of mathematical formulas usually contain tables describing the density of the standard normal. From this, one can read off the corresponding information for any normal r.v. X ∼ N(μ,σ2) from the formula
P[X ≤a]=P[Y ≤ a−μ], σ
where Y is standard normal.
The normal distribution is ubiquitous throughout the sciences and the social sciences, because it is the standard model for any aggregate data that results from a large number of independent observations of the same random variable (such as the weights of mosquitos in Berkeley, or the observational error in a physical experiment). Such data, as is well known, tends to cluster around its mean in a “bell-shaped” curve, with the correspondence becoming more accurate as the number of observations increases. A theoretical explanation of this phenomenon is the Central Limit Theorem, which we discuss in Section 5.
4.2 Sum of Independent Normal Random Variables
An important property of the normal distribution is that the sum of independent normal random variables is also normally distributed. We begin with the simple case when X and Y are independent standard normal random variables. In this case the result follows because the joint distribution of X and Y is rotationally symmetric. The general case follows from the translation and scaling property of normal distribution in Lemma 20.1.
Theorem 20.4. Let X ∼ N(0,1) and Y ∼ N(0,1) be independent standard normal random variables, and suppose a,b ∈ R are constants. Then Z = aX +bY ∼ N(0,a2 +b2).
Proof. 3 Since X and Y are independent, by Theorem 20.1 we know that the joint density of (X , Y ) is f(x,y)=f(x)·f(y)= 1e−(x2+y2)/2.

The key observation is that f (x, y) is rotationally symmetric around the origin, i.e., f (x, y) only depends on
the value x2 +y2, which is the distance of the point (x,y) from the origin (0,0); see Figure 3.
3The following proof and figures are adapted from “Why Is the Sum of Independent Normal Random Variables Normal?” by
B. Eisenberg and R. Sullivan, Mathematics Magazine, Vol. 81, No. 5.
􏰊X−μ􏰋 Var(X)
EECS 70, Fall 2020, Note 20 9

0.15
0.1
0.05
0
f(x,y)
2
0
2
y -2
Figure 3: The joint density function f (x, y) = 1 e−(x2 +y2 )/2 is rotationally symmetric.

Thus, f (T (x, y)) = f (x, y) where T is any rotation of the plane R2 about the origin. It follows that for any
set A ⊆ R2,
P[(X,Y) ∈ A] = P[(X,Y) ∈ T(A)] (8) where T is a rotation of R2. Now given any t ∈ R, we have
P[Z≤t] = P[aX+bY≤t] = P[(X,Y)∈A] whereAisthehalfplane{(x,y)|ax+by≤t}.Theboundarylineax+by=tliesatadistanced=√ t
from the origin. Therefore, as illustrated in Figure 4, the set A can be rotated into the set 􏰜 􏰄􏰄 t 􏰝
a2 +b2
d=p t
a2 + b2
(0, 0)
x=p t
a2 + b2
xTx (0, 0)
T(A)= (x,y)􏰄x≤√a2+b2 . 􏰄
yy ax + by = t
Figure4:Thehalfplaneax+by≤tisrotatedintothehalfplanex≤√ t . a2 +b2
By (8), this rotation does not change the probability:
P[Z≤t] = P[(X,Y)∈A] = P[(X,Y)∈T(A)] = P X≤√ = P a2+b2X≤t .
Since the equation above holds for all t ∈ R, we conclude that Z has th√e same distribution as √a2 + b2 X . Since X has standard normal distribution, we know by Lemma 20.1 that a2 + b2 X has normal distribution with mean 0 and variance a2 + b2 . Hence we conclude that Z = aX + bY also has normal distribution with mean 0 and variance a2 + b2 .
EECS 70, Fall 2020, Note 20 10
-2
x
􏰚t􏰛 a2 + b2
􏰖􏰘 􏰗
0

The general case now follows easily from Lemma 20.1 and Theorem 20.4.
Corollary 20.1. Let X ∼ N(μX,σX2) and Y ∼ N(μY,σY2) be independent normal random variables. Then for any constants a, b ∈ R, the random variable Z = aX + bY is also normally distributed with mean μ = aμX+bμY andvarianceσ2=a2σX2+b2σY2.
Proof. By Lemma 20.1, Z1 = (X − μX )/σX and Z2 = (Y − μY )/σY are independent standard normal random variables. We can write:
Z = aX+bY = a(μX +σXZ1)+b(μY +σYZ2) = (aμX +bμY)+(aσXZ1+bσYZ2).
ByTheorem20.4,Z′ =aσXZ1+bσYZ2 isnormallydistributedwithmean0andvarianceσ2 =a2σX2+b2σY2. Since μ = aμX +bμY is a constant, by Lemma 20.1 we conclude that Z = μ +Z′ is a normal random variable with mean μ and variance σ2, as desired.
5 The Central Limit Theorem
Recall from an earlier note the Law of Large Numbers for i.i.d. random variables Xi’s: it says that the probability of any deviation ε > 0, however small, of the sample average Sn , where Sn = ∑n Xi, from the
n i=1
mean tends to zero as the number of observations n in our average tends to infinity. Thus, by taking n large
enough, we can make the probability of any given deviation as small as we like.
Actually we can say something much stronger than the Law of Large Numbers: namely, the distribution of
the sample average Sn , for large enough n, looks like a normal distribution with mean μ and variance σ2 . nn
distribution approaches a sharp spike at μ.
Recall from the last section that the density of the normal distribution is a symmetrical bell-shaped curve
centered around the mean μ. Its height and width are determined by the standard deviation σ as follows:
the height at the mean x = μ is √ 1 ≈ 0.4 ; 50% of the mass is contained in the interval of width 0.67σ 2πσ2 σ
either side of the mean, and 99.7% in the interval of width 3σ either side of the mean. (Note that, to get the correct scale, deviations are on the order of σ rather than σ2.)
(Of course, we already know that these are the mean and variance of Sn ; the point is that the distribution
n
becomes normal!) The fact that the standard deviation decreases with n (specifically, as √n ) means that the
σ
To state the Central Limit Theorem precisely (so that the limiting distribution is a constant rather than something that depends on n), we standardize Sn as
n
Sn −μ Sn−nμ
n=√.
σ
Theorem 20.5 (Central Limit Theorem). Let X1,X2,… be a sequence of i.i.d. random variables with com-
mon finite expectation E[Xi] = μ and finite variance Var(Xi) = σ2. Let Sn = ∑ni=1 Xi. Then, the distribution
of Sn−nμ converges to N(0,1) as n → ∞. In other words, for any constant c ∈ R, σ√n
􏰚Sn−nμ 􏰛 1􏰟c−x2/2 P√≤c→√ edxasn→∞.
σ n 2π −∞
√n
Sn−nμ
σn
The Central Limit Theorem then says that the distribution of σ √n converges to the standard normal distri-
bution.
EECS 70, Fall 2020, Note 20
11

Figure 5: Buffon’s Needle.
The Central Limit Theorem is a very striking fact. What it says is the following: If we take an average of n observations of any arbitrary r.v. X, then the distribution of that average will be a bell-shaped curve centered at μ = E[X]. Thus all trace of the distribution of X disappears as n gets large: all distributions, no matter how complex,4 look like the normal distribution when they are averaged. The only effect of the original distribution is through the variance σ2, which determines the width of the curve for a given value of n, and hence the rate at which the curve shrinks to a spike.
6 Optional: Buffon’s Needle
Here is a simple yet interesting application of continuous random variables to the analysis of a classical procedure for estimating the value of π; this is known as Buffon’s needle problem, after its 18th century inventor Georges-Louis Leclerc, Comte de Buffon.
As illustrated in Figure 5, we are given a needle of length l, and a board ruled with horizontal lines at distance l apart. The experiment consists of throwing the needle randomly onto the board and observing whether or not it crosses one of the lines. We shall see below that (assuming a perfectly random throw) the probability of this event is exactly 2/π. This means that, if we perform the experiment many times and record the proportion of throws on which the needle crosses a line, then the Law of Large Numbers tells us that we will get a good estimate of the quantity 2/π, and therefore also of π; and we can use Chebyshev’s inequality as in the other estimation problems we considered in an earlier note to determine how many throws we need in order to achieve specified accuracy and confidence.
6.1 Integrating a Joint Density Function
To analyze the experiment, let’s consider what random variables are in play. Note that the position where the needle lands is completely specified by two random variables: the vertical distance Y between the midpoint of the needle and the closest horizontal line, and the angle Θ between the needle and the vertical. The r.v. Y ranges between 0 and l/2, while Θ ranges between −π/2 and π/2. Since we assume a perfectly random throw, we may assume that their joint distribution has density f(y,θ) that is uniform over the rectangle [0,l/2]×[−π/2,π/2]. Since this rectangle has area πl, the density should be
􏰅 2 , f(y,θ)= πl
0,
4We do need to assume that the mean and variance of X are finite.
(9)
2
for (y,θ) ∈ [0,l/2]×[−π/2,π/2],
otherwise.
EECS 70, Fall 2020, Note 20 12

Equivalently, Y and Θ are independent random variables, each uniformly distributed in their respective range. As a sanity check, let’s verify that the integral of this density over all possible values is indeed 1:
􏰟∞􏰟∞ −∞ −∞
􏰟π/2􏰟l/2 2 −π/2 0 πl
􏰟π/2 2y􏰄l/2 􏰄􏰄
􏰟π/2 1 −π/2 π
θ􏰄π/2
􏰄􏰄 =1.
f(y,θ)dydθ =
This is an analog of (1) for our joint distribution; rather than the area under the curve f (x), we are now
computing the area under the “surface” f (y, θ ).
Now let E denote the event that the needle crosses a line. How can we express this event in terms of the
values of Y and Θ? Well, by elementary geometry the vertical distance of the endpoint of the needle from
dydθ =
−π/2 πl􏰄0
dθ =
dθ =
π􏰄−π/2
its midpoint is l cos Θ, so the needle will cross the line if and only if Y ≤ l cos Θ. Therefore we have 22
P[E]=P[Y ≤ 2 cosΘ]=
Substituting the density f (y, θ ) from (9) and performing the integration we get
l 􏰟 π/2 􏰟 (l/2)cosθ
􏰟 π/2 􏰟 (l/2)cosθ 2
􏰟 π/2 2y􏰄(l/2)cosθ 􏰄􏰄
1 􏰟 π/2 π −π/2
1
π
􏰄π/2 sinθ􏰄􏰄
−π/2
2
π
P[E]=
This is exactly what we claimed at the beginning of the section!
dydθ =
dθ =
cosθdθ =
=
.
−π/2 0
f(y,θ)dydθ.
−π/2 0 πl
6.2 Using Indicator Random Variables
−π/2πl􏰄0
Suppose we toss a unit length needle on (an infinite) board ruled with horizontal lines spaced at unit length apart. We wish to calculate the chance that the needle intersects a horizontal line. Let X be a random variable defined as the number of intersections of such a needle:
􏰅1, if the needle intersects a line, X = 0, otherwise.
Here we are assuming that the case where the needle lies perfectly on two lines cannot happen, since the
probability of this particular event is 0. Since X is an indicator random variable, E[X ] = P[X = 1]. We wish
toshowthatP[X =1]= 2. π
Suppose we were tossing a needle of length 2, and let Z be the random variable representing the number of times such a needle intersects horizontal lines on the plane. We can “split” the needle into two length-1 parts and get Z = I1 + I2, where Ii is 1 if segment i of the needle intersects and 0 otherwise. Thus, E[Z] = E[I1 + I2 ] = E[I1 ] + E[I2 ] = 2 E[X ], since each segment is of unit length. A similar argument holds if we split a unit length needle into m equal segments, so that X = I1 + · · · + Im , where Ii is 1 if segment i (which has length
1 ) intersects a line and 0 otherwise. We have that E[X] = E[I1 +···+Im] = E[I1]+···+E[Im]. But each of m
the E[Ii]’s are equal, so we get E[X] = mE[Ii], which implies E[Ii] = (length of segment i)·E[X]. Thus, if we drop a needle of an arbitrary length l and let Y be the number of intersections, then E[Y ] = l · E[X ].
Now, as shown in Figure 6, consider a “noodle” comprised of two needles of arbitrary lengths l1 and l2 (with corresponding random variables Y1 and Y2 for the number of intersections), where the needles are connected by a rotating joint. We can conclude by linearity of expectation that E[Y1 +Y2] = E[Y1]+E[Y2]. In general, we can have a noodle comprised of n needles of arbitrary lengths l1,…,ln, in which case E[Y1 +···+Yn] = E[Y1]+···+E[Yn] = l1 E[X]+···+ln E[X] = (l1 +···+ln)·E[X]. Hence, we conclude that the expected number of intersections of a noodle is (total length of the noodle) × E[X ].
EECS 70, Fall 2020, Note 20 13

Figure 6: A “Noodle” consisting of 5 needles.
Figure 7: A circle with a unit length diameter always has two intersections.
To determine E[X], we utilize the following observation: since we are allowed to string together needles at connected rotating joints and since each needle can be arbitrarily short, we are free to pick any shape. As illustrated in Figure 7, consider a circle with a unit length diameter (and therefore circumference π). Such a shape must always intersect a horizontal line twice, which implies E[number of circle intersections] = π·E[X]=2,andthusE[X]=P[X =1]= 2.
π
EECS 70, Fall 2020, Note 20 14