Professional Documents
Culture Documents
100 A HW5 Soln
100 A HW5 Soln
Homework 5 Solutions
Ryan Rosario
Problem 1 For a continuous variable X f (x). For each part, it is not sufficient to simply use
the properties of expectation and variance.
(1) Prove E[aX + b] = aE[X] + b.
Proof.
Z
E[aX + b] = (aX + b) f (x) dx
Z Z
= aXf (x) dx + bf (x) dx
Z Z
= a Xf (x) dx +b f (x) dx
| {z } | {z }
=E(X) =1
= aE[X] + b
Proof.
Z
Var (Z) = (z E(Z))2 f (x) dx
Z 2
= ax + b a + b f (x) dx
Z
= (ax a)2 f (x) dx
Z
= a2 (x )2 f (x) dx
Z
= a 2
(x E[X])2 f (x) dx
2
= a Var (X)
1
(3) Prove Var (X) = E[X 2 ] E[X]2 .
Proof.
Z
Var (X) = (x )2 f (x) dx
Z
x2 + 2 2x f (x) dx
=
Z Z Z
2 2
= x f (x) f (x) + f (x) dx 2 xf (x) dx
2 2 2
= E[X ] + 2
= E[X 2 ] 2
= E[X 2 ] E[X]2
X
(4) Let = E[X], 2 = Var (X) and Z = . Calculate E[Z] and Var (Z).
X
Let Z = .
Z
E[Z] = zf (z) dz
Z
x
= f (x) dx
Z
1
= (x )f (x) dx
Z
Z
1
= xf (x) dx f (x) dx
1
= (E(X) )
=
= 0
2
But it is also acceptable to use what we just proved.
X
E[Z] = E
1
= E(X )
1
= [E(X) ]
1
= ( )
= 0
Similarly,
X
Var (Z) = Var
1
= Var (X)
2
1
= 2
2
= 1
Problem 2
For U U nif orm[0, 1], calculate E[U ], E[U 2 ], Var (U ), and F (u) = P (U u).
1
By definition, the PDF for the uniform distribution is f (x) = ba . In this problem, b = 1 and
a = 0 so f (x) = 1. Then,
Z1
E(U ) = uf (u) du
0
Z1
= u du
0
1 2 1
= u
2 0
1
=
2
ba
E(U ) =
2
3
Z1
2
u2 f (u) du
E U =
0
Z1
= u2 du
0
1 3 1
= u
3 0
1
=
3
Then
Var (U ) = E U 2 E(U )2
2
1 1
=
3 2
1 1
=
3 4
1
=
12
ba
Var (U ) =
12
Problem 3
For T Exp(),
(1) Calculate F (t) = P (T t). For a > b > 0, f indP (T > a|T > b).
By definition
F (t) = P (T t)
Zt
= et dt
0
Zt
= et dt
0
1 t t
= e
0
t
= e 1
= 1 et
4
(2) Calculate E[T ] and Var (T ).
By definition
Z
E(T ) = tet dt
0
Z
= tet dt
0
Use integration by parts, u = t, dv = et and the IBP formula uv
R
v du.
Z
1 t 1 t
= t e e dt
Z
1 t 1 t
= t e + e dt
1 1 1
= t et + et
0
1 t
1 t
= t e 2e
0
1
tet et
=
0
t 1
= e t+
0
1
t
lim e t+ =0
t
another indeterminate form, but now we can use LHopitals Rule yielding
1
lim =0
t et
Then,
t 1 1 1
e t+ =0 =
0
5
Now we compute Var (T ). Recall that Var (T ) = E T 2 E(T )2 . We find E(T 2 ).
Z
2
t2 et dt
E T =
0
Z
= t2 et dt
0
By integration by parts, u = t2 , dv = et and the IBP formula uv v du.
R
Z
2 1 t 1 t
= t e 2t e dt
0
t2 t 2
Z
= e + tet dt
Z 0
= t2 et + 2 tet dt
0
By ingration by parts, u = t, dv = et and the IBP formula uv v du.
R
Z
2 t 1 t 1 t
= t e +2 t e e dt
0
Z
t 1
= t2 et + 2 et + et dt
0
2 t t t 1 1 t
= t e +2 e + e
0
t 1
= t2 et + 2 et 2 et
0
2t 2
= t2 et et 2 et
0
2t 2
= et t2 + + 2
0
2t 2
lim et t2 + + 2 =0
t
2t 2
t2 + + 2
lim =
t et
LHopitals Rule then yields
2t + 2
lim t
=
t e
So we use LHopitals Rule again, which yields
2
lim =0
t 2 et
6
So we get
2
t 2 2t 2 = 0 2
2
E T = e t + + 2 2
= 2
0
Var (T ) = E T 2 E(T )2
2
2 1
= 2
2 1
=
2 2
1
=
2
(3) If U Uniform[0, 1], let X = log U . Calculate F (x) = P (X x), and f (x) = F (x). What
is the distribution of X?
To find the distribution of X, we need to find fX (x). We do this by starting with the CDF
of x and differentating it with respect to x.
FX (x) = P (X x)
log U
= P x
= P (log U x)
= P U ex
= 1 P U ex
But notice that P U ex is the CDF for U , FU (u).
= 1 FU ex
Recall from an earlier problem that the CDF for the uniform distribution
is FU (u) = u, so replace u with ex .
= 1 ex
And notice that the above is the CDF for the exponential distribution.
To get the distribution of X, differentiation w/r/t x.
f (x) = ex
which is the PDF f (x) for the exponential distribution with parameter , thus X Exp ().
7
(4) Let Y = aT where a > 0. What is the density function of Y ?
Again, to get f (y), we start with the CDF of Y , FY and then differentiate it with respect to
y.
4FY (y) = P (Y y)
= P (aT y)
y
= P T
a
which is the CDF for T w/r/t y, FT (y).
y
= FT
a
Now differentiate with respect to y.
y d y
= fT
a dy a
1 y
= fT
a a
where fT (t) = et
1 y
= e a
a
( )y
= e a
a
Thus Y Exp a .
Problem 4
Suppose Z N (0, 1). The density of Z is
1 z2
f (z) = e 2
2
(1) Calculate E[Z] and Var[Z].
By definition,
Z
z z2
E(Z) = e 2 dz
2
Z
1 z2
E(Z) = ze 2 dz
2
8
z2
Trick: Note that the function ze 2 is an odd function. Recall from Math 31B that if f (x)
is odd, then
Za
f (x) dx = 0
a
Thus, E(Z) = 0.
Recall that
Z Z
1 z2 1 z2
Var (Z) = (z E(Z)) e 2 dz =
2
z 2 e 2 dz
2 2
z 2
We integrate by parts. Let u = z, dv = ze 2 . Then,
Z Z
1 2
z2 1 z 2 z 2
z2 e dz = [ ze 2 ]
+ e 2 dz
2 2
z2 z2
But note that since ze 2 is odd, [ ze 2 ]
= 0.
Z
1 z2
Var (Z) = e 2 dz
2
But note that the integrand is the standard normal distribution! This means that when
integrated over its domain (infinite), the integral is 1!
So Var (Z) = 1.
(2) Let X = + Z. What are E[X] and Var (X)? What is the density function of X? Please!
One at a time! No pushing... Lets start with E[X]. Since X = + Z,
E(X) = E( + Z)
= E() + E(Z)
= + E(Z)
=
And,
9
Now the hard part. We want to find the density function of X. There is a theorem that you
will learn in 100B that is related to this problem. That theorem states that if Z is a standard
normal random variable (Z N (0, 1)), then X = + Z is also a normal random variable.
We just proved that the mean is and the variance is . What we have not proven is that
the distribution of X is normal... yet.
We start with the CDF of and then differentiate it to get the density function f (x).
In my notation below, FX denotes that we are finding the CDF of X.
FX (x) = P (X x)
= P ( + Z x)
x
= P Z
x
Z
1 z2
= e 2 dt
2
x
= FZ
x
Now we have that FX (x) = FZ where FZ is the cumulative distribution function of the
distribution of Z.
Recall that we want to differentiate FX (x) so that we get fX (x) (which is the density func-
x
tion), but since FX (x) = FZ , differentiating FX is the same as differentiating FZ . Is
everybody with me?
So we proceed as follows.
d d x
FX (x) = FZ
dx dx
x d x
= fZ
dx
where
the above
is the chain rule.
x 1
= fZ
1 x
= fZ
1 z2
fZ (z) = e 2
2
10
So
x 1 1 x 2
fZ = e 2 ( )
2
Thus,
1 x 1 1 x 2
fX (x) = fZ = e 2 ( )
2
Cool, eh?
Problem 5
Suppose we flip a fair coin 1000 times independently. Let X be the number of heads. Answer the
following questions using normal approximation.
Note that we would usually solve this problem using the binomial. The computation would be
cumbersome, but more importantly, since p = 21 is not too close to 0 or 1, and n is large, and since
np > 10, n(1 p) > 10, we use the normal approximation to the binomial. Since the binomial
distribution is discrete and the normal distribution is continuous, we must use a correction.
1000
Using the normal approximation, we have that = np = 2 = 500 and 2 = np(1 p) = 500 12 =
250.
(1) What is the probability that 480 X 520?
Note that the range around the mean is symmetric so it is also true that
11
Problem 6
Suppose among the population of voters, 31 of the people support a candidate. If we sample 1000
people from the population, and let X be the number of supporters of this candidate among these
1000 people. Let p = X/ n be the sample proportion. Answer the following questions using normal
approximation.
Note that by the Central Limit Theorem, p N p, p(1p)
n = 0.0002 .
0.35 0.33
P (p > 0.35) = P p >
0.0002
= 1 P (Z 1.41)
= 0.079
0.3 0.33
P (p < 0.3) = P Z <
0.0002
= P (Z < 2.12)
= 0.017
Problem 7
Consider the following joint probability mass function p(x, y) of the discrete random variables
(X, Y ):
x/y 1 2 3
1 0.1 0.1 0.1
2 0.2 0.1 0.2
3 0.1 0.05 0.05
(1) Calculate pX (x) for x = 1, 2, 3. Calculate pY (y) for y = 1, 2, 3.
Note that pX (x) is the marginal of X and is just the row sums, thus,
Note that pY (y) is the marginal of Y and is just the column sums, thus
12
(2) Calculate P (X = x|Y = y) and calculate P (Y = y|X = x) for all pairs of (x, y).
By Bayes Rule,
p(x, y)
P (X = x|Y = y) =
P (Y = y)
p(x, y)
P (Y = y|X = x) =
P (X = x)
E(X) = 1 P (X = 1) + 2 P (X = 2) + 3 P (X = 3)
= 0.3 + 2 0.5 + 3 0.2
= 1.9
E(Y ) = 1 P (Y = 1) + 2 P (Y = 2) + 3 P (Y = 3)
= 0.4 + 2 0.25 + 3 0.35
= 1.95
13
(4) Calculate E(XY ). Calculate Cov(X, Y ). Calculate Corr(X, Y ).
Note that E(XY ) = E(X)E(Y ) if and only if X and Y are independent.
XX
E(XY ) = p(x, y)
x y
= 1 1 p(1, 1) + 1 2 p(1, 2) + 1 3 p(1, 3)
2 1 p(2, 1) + 2 2 p(2, 2) + 2 3 p(2, 3)
3 1 p(3, 1) + 3 2 p(3, 2) + 3 3 p(3, 3)
= 0.1 + 2 0.1 + 3 0.1 + 2 0.2 + 4 0.1 + 6 0.2
3 0.1 + 6 0.05 + 9 0.05
= 3.65
Since the covariance is not 0, X and Y are dependent. They have a negative relationship.
Since the covariance can be anything, we normalize to get a value between -1 (perfect negative
correlation), and +1 (perfect positive correlation) where 0 means no correlation.
Cov(X, Y )
Corr(X, Y ) =
x y
Cov(X, Y )
= p p
Var (X) Var (Y )
0.055
=
0.49 0.7475
= 0.091
14