Homework 9
Linear Algebra and Probability, Fall 2024
Due Friday, November 22, at 5 PM
1. Let X and Y be random variables, each taking values 0, 1, 2, and having
joint PMF pX,Y described by the table below.
X
0 1 2
0 1/18 1/9 1/18
Y 1 2/9 1/9 1/9
2 1/18 1/18 2/9
Do the following:
(a) Find pX and pY (the marginal PMFs of X and Y ).
(b) Find the conditional PMF of X given Y = 1.
(c) find the conditional PMF of Y given X = 2.
(d) Find the mean and variance of X and Y .
(e) Find the covariance of X and Y .
(f) Find the corelation of X and Y .
(g) Find E[(X + Y )3 ].
2. Let X be a random variable satisfying
1 1
P (X = −1) = P (X = 1) = , and P (X = 0) = ,
4 2
and define Y from X by setting
(
5 if X = 0
Y =
1 ̸ 0.
if X =
Prove that X and Y are uncorrelated, but not independent.
3. Suppose an urn contains 4 blue and 5 red balls. We will choose 3 at
random without replacement. Let R be the number of red balls selected
and B be the number of blue balls selected. Find the joint PMF of R and
B.
1
4. Let X be an m × n matrix consisting of m features (variables) and n data
points, and let S be its sample covariance matrix. Prove that, if P is an
m × m matrix, then the sample covariance matrix of the transformed data
P T X is P T SP . Hint: Recall that
1
S= BB T ,
n−1
where B is the matrix obtained from X by subtracting off the mean of
each row. Use linearity of expectation to show that the recentered data
matrix for P T X is P T B.
5. Let
2 0
A = 1 1
0 2
Do the following by hand:
(a) Find the singular value decomposition of A.
(b) Find the rank 1 approximation of A.
6. Let
4 6 9 12 25 12
3 9 2 5 9 11
A=
.
2 5 3 4 9 17
8 7 2 3 14 1
(a) Use the numpy package in Python to compute the singular value de-
composition of A. Example code from class is here https://colab.
research.google.com/drive/1uGg_3lgZDRmIG5TO_BYKn4UpMg5dGSLZ?
usp=sharing.
(b) Use numpy to find the rank 1, 2, and 3 approximations of A.
7. Find the trace of the following matrix.
3 5 9
2 8 12
4 9 15
8. Suppose the sample covariance matrix of an 2 × n matrix X of data is
5 2
S=
2 5
Find an orthogonal matrix P such that the transformed data set P T X is
uncorrelated. What percentage of the total variance is captured by the
first principal component?