The purpose of this exercise is to compute densities and distributions of
quantities related to random matrices both analytically and numerically.
The two quantities you would be required to compute are
For both exercises you would need the mhg package here.
Make sure mhg and mhgi work and compile them if necessary by typing, e.g.,
"mex mhgi.c" at the command prompt. Test to make sure they work. Type
"mhgi(5,2,1,1,2,2)" and "hg(7,2,1.1,1.1,[1,3,3])". You should get the
values 42.8667 and 656.5694, respectively.
- the density of the largest principal angle between random subspaces
- the distribution of the largest eigenvalue of a Wishart matrix
Largest principal angle
Refer to the following paper.
To get the largest principal angle between two p-planes in Rn,
start with a random matrix A=randn(n,p). If A=QR is its QR decomposition,
then the smallest singular value of the upper p-by-p submatrix of Q is
the cosine our
desired angle. I.e., theta = acos(min(svd(Q(1:p,1:p)))).
Pick small values of n and p, e.g., n=7, p=3, and generate
about 10,000 random samples of that angle. Histogram the result.
Compare it with the density of the angle given analytically by
Theorem 1 in the above paper. Plot both the empirical and analytical
results on the same graph.
Largest eigenvalue of a Wishart matrix
For this exercise we need to generate a large number of Wishart matrices
and compare the distribution of the largest eigenvalue with the
Again, pick small values for n and p, e.g., n=3, p=4. The value of n
must not exceed that of p. To generate an
n-by-n random Wishart matrix A with p degrees of freedom and covariance
matrix S (S is also n-by-n), one does this: B=randn(p,n)*sqrt(S); A=B'*B.
Pick S to be symmetric
positive definite but otherwise arbitrary. You may assume it is diagonal
without any loss of generality.
Generate about 10,000 Wishart matirces and get a vector of the largest
eigenvalues. Compare this empirical result with the analytical prediction
given, e.g., by the last equation on page 842 of this