Lect03 2
Lect03 2
• As we have seen, one can define several r.v.s on the sample space of a random
experiment. How do we jointly specify multiple r.v.s, i.e., be able to determine
the probability of any event involving multiple r.v.s?
• Let X and Y be two discrete random variables defined on the same experiment.
They are completely specified by their joint pmf
• Notation: We use (X, Y ) ∼ pX,Y (x, y) to mean that the two discrete r.v.s have
the specified joint pmf
X
1 2 3 4
1 1/16 0 1/8 1/16
Y 2 1/32 1/32 1/4 0
3 0 1/8 1/16 1/16
4 1/16 1/32 1/16 1/32
Marginal PMFs
• Consider two discrete r.v.s X and Y . They are described by their joint pmf
pX,Y (x, y). We can also define their marginal pmfs pX (x) and pY (y). How are
these related?
• To find the marginal pmf of X , we use the law of total probability
X
pX (x) = p(x, y) for x ∈ X
y∈Y
pX,Y (x, y)
pX|Y (x|y) = for pY (y) 6= 0 and x ∈ X
pY (y)
pX,Y (x, y)
pY |X (y|x) = for pX (x) 6= 0 and y ∈ Y
pX (x)
• Bayes rule for pmfs: Given pX (x) and pY |X (y|x) for all (x, y) ∈ X × Y , we can
find
pX,Y (x, y)
pX|Y (x|y) =
pY (y)
pY |X (y|x)
= pX (x)
pY (y)
pY |X (y|x)
= P pX (x), by total probability
pX,Y (x′, y)
x′ ∈X
• The random variables X and Y are said to be independent if for any events
A ∈ X and B ∈ Y
• Can show that the above definition is equivalent to saying that the r.v.s X and
Y are independent if
Z ∈ {0, 1}
X ∈ {0, 1} Y ∈ {0, 1}
The bit sent X ∼ Bern(p), the noise Z ∼ Bern(ǫ), the bit received
Y = (X + Z) mod 2 = X ⊕ Z , and X and Z are independent. Find
1. pX|Y (x|y),
2. pY (y), and
3. the probability of error P{X 6= Y }
So we have
pY |X (0|0) = pZ (0 ⊕ 0) = pZ (0) = 1 − ǫ, pY |X (0|1) = pZ (0 ⊕ 1) = pZ (1) = ǫ
pY |X (1|0) = pZ (1 ⊕ 0) = pZ (1) = ǫ, pY |X (1|1) = pZ (1 ⊕ 1) = pZ (0) = 1 − ǫ
pY |X (0|0)
pX|Y (0|0) = pX (0)
pY |X (0|0)pX (0) + pY |X (0|1)pX (1)
(1 − ǫ)(1 − p)
=
(1 − ǫ)(1 − p) + ǫp
pY |X (0|1)
pX|Y (1|0) = pX (1) = 1 − pX|Y (0|0)
pY |X (0|0)pX (0) + pY |X (0|1)pX (1)
ǫp
=
(1 − ǫ)(1 − p) + ǫp
pY |X (1|0)
pX|Y (0|1) = pX (0)
pY |X (1|0)pX (0) + pY |X (1|1)pX (1)
ǫ(1 − p)
=
ǫ(1 − p) + (1 − ǫ)p
pY |X (1|1)
pX|Y (1|1) = pX (1) = 1 − pX|Y (0|1)
pY |X (1|0)pX (0) + pY |X (1|1)pX (1)
(1 − ǫ)p
=
ǫ(1 − p) + (1 − ǫ)p
• Two continuous r.v.s defined over the same experiment are jointly continuous if
they take on a continuum of values each with probability 0. They are completely
specified by a joint pdf fX,Y such that for any event A ∈ (−∞, ∞)2 ,
Z
P{(X, Y ) ∈ A} = fX,Y (x, y) dx dy
(x,y)∈A
• The Marginal pdf of X can be obtained from the joint pdf by integrating the
joint over the other variable y
Z ∞
fX (x) = fX,Y (x, y) dy
−∞
x
x x + ∆x
1. Find c
2. Find fY (y)
3. Find P{X ≥ 21 Y }
• Solution:
1. To find c, note that Z ∞ Z ∞
f (x, y) dx dy = 1,
−∞ −∞
thus 12 c = 1, or c = 2
2(1 − y) 0 ≤ y ≤ 1
=
0 otherwise
fY (y)
2
y
0 1
x
1
• The plane is ruled with equidistant parallel lines at distance d apart. Throw
needle of length l < d at random. What is the probability that it will intersect
one of the lines?
d
Θ
X
l
• Solution:
Let X be the distance from the midpoint of the needle to the nearest of the
parallel lines, and Θ be the acute angle determined by a line through the needle
and the nearest parallel line
4
fX,Θ(x, θ) = , x ∈ [0, d/2], θ ∈ [0, π/2]
πd
Example: Darts
1
if x2 + y 2 ≤ r 2
πr 2
,
fX,Y (x, y) =
0, otherwise
• Let X and Y be continuous random variables with joint pdf fX,Y (x, y), we
define the conditional pdf of Y given X as
fX,Y (x, y)
fY |X (y|x) = for fX (x) 6= 0
fX (x)
• Example: Let
2, x, y ≥ 0, x + y ≤ 1
f (x, y) =
0, otherwise
Find fX|Y (x|y).
2(1 − y), 0 ≤ y ≤ 1
Solution: We already know that fY (y) =
0, otherwise
Therefore
1
1−y , x, y ≥ 0, x + y ≤ 1, y < 1
fX,Y (x, y)
fX|Y (x|y) = =
fY (y) 0, otherwise
fX|Y (x|y)
1
(1−y)
x
(1 − y)
λ
0 1
fΛ|X (λ|3)
1.378
0.56
1 λ
3 1
Joint cdf
• If X and Y are two r.v.s over the same experiment, they are completely
specified by their joint cdf
(x, y)
c
x
a b
P{a < X ≤ b, c < Y ≤ d} = F (b, d) − F (a, d) − F (b, c) + F (a, c)
• If X and Y are continuous random variables having a joint pdf fX,Y (x, y), then
Z x Z y
FX,Y (x, y) = fX,Y (u, v) du dv for x, y ∈ (−∞, ∞)
−∞ −∞
• Let X and Y be two r.v.s with known pdf fX,Y (x, y) and Z = g(x, y) be a
function of X and Y . We wish to find fZ (z)
• We use the same procedure as before: First calculate the cdf of Z , then
differentiate it to find fZ (z)
• Example: Max and Min of Independent Random Variables
Let X ∼ fX (x) and Y ∼ fY (y) be independent, and define
U = max{X, Y }, and V = min{X, Y }
Find the pdfs of U and V
• Solution: To find the pdf of U , we first find its cdf
FU (u) = P{U ≤ u}
= P{X ≤ u, Y ≤ u}
= FX (u)FY (u), by independence
thus
fV (v) = fX (v) + fY (v) − fX (v)FY (v) − fY (v)FX (v)
Thus
fW |X (w|x) = fY (w − x), a very useful result
Now, to find the pdf of W , consider
Z ∞
fW (w) = fW,X (w, x) dx
−∞
Z ∞ Z ∞
= fX (x)fW |X (w|x) dx = fX (x)fY (w − x) dx
−∞ −∞
• Example: Assume that X ∼ U[0, 1] and Y ∼ U[0, 1] are independent r.v.s. Find
the pdf of their sum W = X + Y
Solution: To find the pdf of the sum, we convolve the two pdfs
Z ∞
fW (w) = fX (x)fY (w − x) dx
−∞
R
w
R0 dx, if 0 ≤ w ≤ 1
1
= w−1
dx, if 1 < w ≤ 2
0, otherwise
w, if 0 ≤ w ≤ 1
= 2 − w, if 1 < w ≤ 2
0, otherwise
• Example: If X ∼ N (µ1, σ12 ) and Y ∼ N (µ2 , σ22) are indepedent, then their sum
W ∼ N (µ1 + µ2, σ12 + σ22), i.e., Gaussian is also an infinitely divisible
distribution– any Gaussian r.v. can be written as the sum of any number of
independent Gaussians as long as their means sum to its mean and their
variances sum to its variance (will prove this using transforms later)
fY |Θ(y|θ)
pΘ|Y (θ|y) = P ′ ′ Θ
p (θ)
θ ′ pΘ(θ )fY |Θ (y|θ )
Z ∼ N (0, N )
Θ Y
• Now, let p = 1/2. Suppose the receiver decides that the signal transmitted is 1
if Y > 0, otherwise he decides that it is a −1. What is the probability of
decision error?
• Solution: First we plot the conditional pdfs
fY |Θ(y| − 1) fY |Θ(y|1)
y
−1 1
This decision rule make sense, since you decide that the signal transmitted is 1 if
fY |Θ(y|1) > fY |Θ(y| − 1)
An error occurs if
◦ Θ = 1 is transmitted and Y ≤ 0, or
◦ Θ = −1 is transmitted and Y > 0
• Let X1, X2, . . . , Xn be random variables (defined over the same experiment)
• If the r.v.s are discrete then they can be jointly specified by their joint pmf
pX1,X2,...,Xn (x1, x2, . . . , xn), for all (x1, x2, . . . , xn) ∈ X1 × X2×, . . . × Xn
• If the r.v.s are jointly continuous, then they can be specified by the joint pdf
fX1,X2,...,Xn (x1 , x2, . . . , xn), for all (x1, x2 , . . . , xn)
• Marginal pdf (or pmf) is the joint pdf (or pmf) for a subset of {X1, . . . , Xn};
e.g. for three r.v.s X1, X2, X3 , the marginals are fXi (xi) and fXi,Xj (xi, xj ) for
i 6= j
• The marginals can be obtained from the joint in the usual way, e.g. for the
n = 3 example
Z ∞
fX1,X2 (x1, x2) = fX1,X2,X3 (x1, x2, x3) dx3
−∞
• Conditional pmf or pdf can be defined in the usual way, e.g. the conditional pdf
of (Xk+1, Xk+2, . . . , Xn) given (X1, X2, . . . , Xk ) is
FX1,...,Xn (x1, . . . , xn) = P{X1 ≤ x1, . . . , Xn ≤ xn}, for all (x1, . . . , xn)
• Important special case, i.i.d. r.v.s: X1, X2, . . . , Xn are said to be independent
and identically distributed (i.i.d.) if they are independent and have the same
marginal, e.g. if we flip a coin n times independently we can generate
X1, X2, . . . , Xn i.i.d. Bern(p) r.v.s
• The r.v.s X1 and X3 are said to be conditionally independent given X2 iff
fX1,X3|X2 (x1, x3|x2) = fX1|X2 (x1|x2)fX3|X2 (x3|x2) for all (x1, x2, x3)
X2
X1 X3