# Segment 18: The Correlation Matrix - 3/18/2012

## Contents

### Problem 1

Random points i are chosen uniformly on a circle of radius 1, and their (xi,yi) coordinates in the plane are recorded. What is the 2x2 covariance matrix of the random variables X and Y? (Hint: Transform probabilities from θ to x. Second hint: Is there a symmetry argument that some components must be zero, or must be equal?)
$\theta$ ~ $U(0,2\pi)$
$p(\theta) = \frac{1}{2\pi}$ for $0\leq \theta \leq 2\pi$
$X=cos(\theta)$
$Y=sin(\theta)$
$E[X] = \int_0^{2\pi}\frac{cos(\theta)}{2\pi} = 0$
$E[Y] = \int_0^{2\pi}\frac{sin(\theta)}{2\pi} = 0$
$E[X] = \int_0^{2\pi}\frac{sincos(\theta)}{2\pi} = \int_0^{2\pi}\frac{sin(2\theta)}{4\pi} = 0$
Cov(X,Y) = E[XY] - E[X]E[Y] = 0 $Var[X] = E[X^2] - E[X]^2 = E[X^2] = \int_0^{2\pi}\frac{cos^2(\theta)}{2\pi} = 0.5$
$Var[Y] = E[Y^2] - E[Y]^2 = E[Y^2] = \int_0^{2\pi}\frac{sin^2(\theta)}{2\pi} = 0.5$
Cov(X, Y) = $\begin{bmatrix} 0.5 & 0 \\ 0 & 0.5 \end{bmatrix}$

### Problem 2

Points are generated in 3 dimensions by this prescription: Choose λ uniformly random in (0,1). Then a point's (x,y,z) coordinates are (αλ,βλ,γλ). What is the covariance matrix of the random variables (X,Y,Z) in terms of α,β, and γ? What is the linear correlation matrix of the same random variables?
Since X, Y, and Z are all calculated in the same way with the exception of the coefficient, I will show how to calculate one variable by hand and then apply to the other 2 variables.
E[X] = E[$\alpha \lambda$] = $\alpha$E[$\lambda$] = $\alpha\int_0^1 \lambda d\lambda = \frac{\alpha}{2}$
E[Y] = $\frac{\beta}{2}$ and E[Z] = $\frac{\gamma}{2}$

Var[X]= Var[$\alpha \lambda$] = E[$(\alpha \lambda)^2$] - E[$\alpha \lambda ]^2$ = ${\alpha}^2 \int_0^1{\lambda}^2 d \lambda - (\frac{\alpha}{2})^2 = \frac{\alpha^2}{3} - \frac{\alpha^2}{4} = \frac{\alpha^2}{12}$
Var[Y] = $\frac{\beta}{12}$ and Var[Z] = $\frac{\gamma}{12}$

Cov(X,Y) = Cov(Y, X) = E[XY] - E[X]E[Y] = E[$\alpha \beta \lambda^2$] - $\frac{\alpha}{2}*\frac{\beta}{2}$ = $\alpha \beta$ E[$\lambda^2$] - $\frac{\alpha \beta}{4}$ = $\frac{\alpha \beta}{3} - \frac{\alpha \beta}{4} = \frac{\alpha \beta}{12}$
Cov(X,Z) = Cov(Z,X) = $\frac{\alpha\gamma}{12}$
Cov(Y,Z) = Cov(Z,Y) = $\frac{\beta\gamma}{12}$

Thus our Covariance Matrix = $\begin{bmatrix} \frac{\alpha}{12} & \frac{\alpha \beta}{12} & \frac{\alpha\gamma}{12} \\ \frac{\alpha \beta}{12} & \frac{\beta}{12} &\frac{\beta\gamma}{12} \\ \frac{\alpha\gamma}{12} & \frac{\beta\gamma}{12} & \frac{\gamma}{12} \end{bmatrix}$
Since Corr(X,Y) = $\frac{Cov(X,Y)}{Var(X) Var(Y)}$, our Correlation Matrix = $\begin{bmatrix} 1 & 1 & 1 \\ 1 & 1 &1 \\ 1& 1& 1 \end{bmatrix}$

If w is the band around the 45-degree line between the points (0,0) and (10,10), width would represent a point P($x_0,y_0$)'s Distance to the line. Thus, it would be in a similar of form of $\sqrt{(x - x_0)^2 + (y- y_0)^2}$ which is similar to $\sqrt{Var[X] + Var[Y]}$ I would roughly say r would be roughly $\frac{Cov(X,Y)}{w^2}$ where the covariance is some function of w because w could act as a Var[X] +Var[Y]. the bigger the w, the smaller the r is. The smaller the w, which would mean the points don't deviate too much from the line, the closer the value would be to 1.
If we let Cov(X,Y) = w + 1 and let Var[X] + Var[Y] = $w^2$ + 1 where taking the square root of this function is approximately w, r could be represented correctly. When the width is 0, r = 1. As the width gets bigger, r gets closer to 0. My function would look similar to this: r = $\frac{w+1}{w^2 + 1}$ where w represents the width. To represent negative or positive correlation, one can just look at the function it is bounded by and add a negative if the function is a decreasing function.