# Finding correlation coefficient from covariance matrix

I've been looking all over the interwebs and have been having trouble finding good uses of a covariance matrix to find the correlation coefficient.

For example, given a problem like:

Suppose that $x = \begin{bmatrix} x_1 \\ x_2 \end{bmatrix}$ is a vector with a mean of $0$ and covariance $P = \begin{bmatrix}4.5 & -1 \\ -1 & 2 \end{bmatrix}$. What is the correlation coefficient of $x_1$ and $x_2$?

I know that to find the correlation coefficient of $x_1$ and $x_2$, it is: $$P_{x_1 x_2} = \frac{cov(x_1, x_2)}{\sigma_1 \sigma_2}$$

Furthermore, I believe the $\sigma$ can be derived from the diagonals of the covariance matrix, but I'm not sure how to find $cov(x_1, x_2)$. How can one derive a single covariance from the matrix?

There's no derivation needed. All you have is to read the covariances appropriately from their corresponding position in the covariance matrix. The covariance matrix is read as follows $$P = \begin{bmatrix} var(X_1) & cov(X_1,X_2) \\\\ cov(X_1,X_2) & var(X_2) \\ \end{bmatrix}$$ where $\sigma_1^2 = var(X_1)$ and $\sigma_2^2 = var(X_2)$. So, yes, as you say, the $\sigma^2_k$'s are at the diagonals and the covariances are at the off-diagonals. Therefore $$P_{x_1x_2} = \frac{cov(x_1, x_2)}{\sigma_1 \sigma_2}= \frac{-1}{\sqrt{4.5}\sqrt{2}}$$
• Awesome, answer, thank you so much! Is there ever a possibility where the opposite $cov(X_1,X_2)$ diagonals could be different? – Billy Thorton Sep 17 '18 at 3:06
• No you always have $cov(X_1,X_2) = cov(X_2,X_1)$. – Ahmad Bazzi Sep 17 '18 at 3:06